private void simpleButton1_Click(object sender, EventArgs e) { Workbook workbook = msExcelUtil.OpenExcelByMSExcel(btnModule.Text); Worksheet worksheet_FengMian = workbook.Worksheets["Link"] as Worksheet; Worksheet worksheet_Subjects = workbook.Worksheets["Subjects"] as Worksheet; for (int i = 2; i < 146; i++) { string subjectCode = msExcelUtil.GetCellValue(worksheet_Subjects, "A", i); if (!string.IsNullOrEmpty(subjectCode)) { string linkCode = msExcelUtil.GetCellValue(worksheet_Subjects, "B", i); string checkItem = msExcelUtil.GetCellValue(worksheet_Subjects, "C", i); string standard = msExcelUtil.GetCellValue(worksheet_Subjects, "D", i); decimal weight = Convert.ToDecimal(msExcelUtil.GetCellValue(worksheet_Subjects, "E", i)); int orderNo = Convert.ToInt32(msExcelUtil.GetCellValue(worksheet_Subjects, "F", i)); webService.Area_SubjectSave("201701", "0", checkItem, standard, orderNo, weight, linkCode, "sysadmin", subjectCode); } } //Workbook workbook = msExcelUtil.OpenExcelByMSExcel(btnModule.Text); //Worksheet worksheet_FengMian = workbook.Worksheets["Subjects"] as Worksheet; //for (int i = 2; i < 300; i++) //{ // string subjectCode = msExcelUtil.GetCellValue(worksheet_FengMian, "B", i); // if (!string.IsNullOrEmpty(subjectCode)) // { // string projectCode = msExcelUtil.GetCellValue(worksheet_FengMian, "A", i); // int orderNo = 0; // decimal weight = 0; // if (!string.IsNullOrEmpty(msExcelUtil.GetCellValue(worksheet_FengMian, "C", i))) // { // orderNo = Convert.ToInt32(msExcelUtil.GetCellValue(worksheet_FengMian, "C", i)); // } // if (!string.IsNullOrEmpty(msExcelUtil.GetCellValue(worksheet_FengMian, "D", i))) // { // weight = Convert.ToDecimal(msExcelUtil.GetCellValue(worksheet_FengMian, "D", i)); // } // webService.UpDateSubject(projectCode, subjectCode, orderNo, weight); // } //} CommonHandler.ShowMessage(MessageType.Information, "上传完毕"); }