frmMain.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Configuration;
  5. using System.Data;
  6. using System.Drawing;
  7. using System.Linq;
  8. using System.Text;
  9. using System.Threading.Tasks;
  10. using System.Windows.Forms;
  11. using wispro.sp.entity;
  12. using wispro.sp.utility;
  13. namespace wispro.sp.winform
  14. {
  15. public partial class frmMain : Form
  16. {
  17. public frmMain()
  18. {
  19. InitializeComponent();
  20. }
  21. private void button1_Click(object sender, EventArgs e)
  22. {
  23. DateTime startTime = DateTime.Now;
  24. frmMerageExcel frm = new frmMerageExcel();
  25. if(frm.ShowDialog() == DialogResult.OK)
  26. {
  27. MessageBox.Show($"合并完成,合并后文件保存在:\r\n{frm.SaveFilePath}\r\n用时:{DateTime.Now - startTime }");
  28. }
  29. }
  30. private void button1_Click_1(object sender, EventArgs e)
  31. {
  32. OpenFileDialog ofd = new OpenFileDialog()
  33. {
  34. Multiselect = false,
  35. Filter = "*.xls|*.xlsx"
  36. };
  37. string strDinashuRegularFile = ConfigurationSettings.AppSettings["DinashuRegularFile"];
  38. if (ofd.ShowDialog()== DialogResult.OK)
  39. {
  40. new ExcelHelper().FillDianShu(ofd.FileName, strDinashuRegularFile);
  41. }
  42. }
  43. private void btnCalPerformance_Click(object sender, EventArgs e)
  44. {
  45. DataTable dt = wispro.sp.utility.NPOIExcel.ExcelToDataTable(@"D:\users\luowen\Documents\工作文档\深圳威世博人力绩效\210730-威世博人员清单v1r01-xm.xls", true);
  46. //List<Staff> retList = new List<Staff>();
  47. //if (dt != null)
  48. //{
  49. // foreach (DataRow row in dt.Rows)
  50. // {
  51. // retList.Add(new Staff()
  52. // {
  53. // Name = row["姓名"].ToString(),
  54. // Status = row["姓名"].ToString(),
  55. // isCalPerformsnce = (row["是否核算绩效"].ToString() == "是"),
  56. // StaffGrade = new StaffGrade() { Grade = row["工程师等级"].ToString(), GradeCoefficient = decimal.Parse(row["等级系数"].ToString()) },
  57. // Department = row["部门"].ToString(),
  58. // WorkPlace = row["工作地"].ToString(),
  59. // EntyDate = DateTime.Parse(row["入职时间"].ToString()),
  60. // Memo = row["备注"].ToString()
  61. // });
  62. // }
  63. //}
  64. //string str = Newtonsoft.Json.JsonConvert.SerializeObject(retList);
  65. //using (var file = System.IO.File.CreateText("d:\\temp\\Staff.json")) {
  66. // file.Write(str);
  67. //}
  68. frmExcelViewer frm = new frmExcelViewer();
  69. frm.Data = dt;
  70. frm.ShowDialog();
  71. }
  72. }
  73. }