using System; using System.Collections.Generic; using System.ComponentModel; using System.Configuration; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using wispro.sp.entity; using wispro.sp.utility; namespace wispro.sp.winform { public partial class frmMain : Form { public frmMain() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { DateTime startTime = DateTime.Now; frmMerageExcel frm = new frmMerageExcel(); if(frm.ShowDialog() == DialogResult.OK) { MessageBox.Show($"合并完成,合并后文件保存在:\r\n{frm.SaveFilePath}\r\n用时:{DateTime.Now - startTime }"); } } private void button1_Click_1(object sender, EventArgs e) { OpenFileDialog ofd = new OpenFileDialog() { Multiselect = false, Filter = "*.xls|*.xlsx" }; string strDinashuRegularFile = ConfigurationSettings.AppSettings["DinashuRegularFile"]; if (ofd.ShowDialog()== DialogResult.OK) { new ExcelHelper().FillDianShu(ofd.FileName, strDinashuRegularFile); } } private void btnCalPerformance_Click(object sender, EventArgs e) { DataTable dt = wispro.sp.utility.NPOIExcel.ExcelToDataTable(@"D:\users\luowen\Documents\工作文档\深圳威世博人力绩效\210730-威世博人员清单v1r01-xm.xls", true); //List retList = new List(); //if (dt != null) //{ // foreach (DataRow row in dt.Rows) // { // retList.Add(new Staff() // { // Name = row["姓名"].ToString(), // Status = row["姓名"].ToString(), // isCalPerformsnce = (row["是否核算绩效"].ToString() == "是"), // StaffGrade = new StaffGrade() { Grade = row["工程师等级"].ToString(), GradeCoefficient = decimal.Parse(row["等级系数"].ToString()) }, // Department = row["部门"].ToString(), // WorkPlace = row["工作地"].ToString(), // EntyDate = DateTime.Parse(row["入职时间"].ToString()), // Memo = row["备注"].ToString() // }); // } //} //string str = Newtonsoft.Json.JsonConvert.SerializeObject(retList); //using (var file = System.IO.File.CreateText("d:\\temp\\Staff.json")) { // file.Write(str); //} frmExcelViewer frm = new frmExcelViewer(); frm.Data = dt; frm.ShowDialog(); } } }