private void openExcelStripMenuItem_Click_1(object sender, EventArgs e) { addressofexcelfile = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) + "\\cases" + DateTime.Now.ToShortDateString().Replace("/", "_") + ".xlsx"; if (!File.Exists(addressofexcelfile)) { excelfile myexcelfile2 = new excelfile(addressofexcelfile); // totalnumberofcases = myexcelfile2.getlastrow(); myexcelfile2.savefile(); myexcelfile2.closefile(); } else { excelfile myexcelfile2 = new excelfile(addressofexcelfile); totalnumberofcases = myexcelfile2.getlastrow(); label1.Text = "Total number of Cases: " + totalnumberofcases.ToString(); label1.Visible = true; // myexcelfile2.savefile(); myexcelfile2.closefile(); } }
private void getCPTsToolStripMenuItem_Click(object sender, EventArgs e) { myexcelfile1 = new excelfile(addressofexcelfile); int l = 1; while (l <= myexcelfile1.getlastrow()) { string orcode = myexcelfile1.GetCellValue(string.Concat("h", l)); { string cptcode = ""; switch (orcode) { case ("1670"): cptcode = "61140"; break; case ("1134"): cptcode = "61313"; break; case ("1133"): cptcode = "62140"; break; case ("1132"): cptcode = "61697"; //this is Leurssen, Bollo not available break; case ("1022"): cptcode = "61312"; break; case ("1346"): cptcode = "61510"; break; case ("1200"): cptcode = "63081"; break; case ("1775"): cptcode = "22548"; break; case ("1469"): cptcode = "22600"; break; case ("1202"): cptcode = "61548"; break; case ("1279"): cptcode = "61885"; break; case ("1163"): cptcode = "63001"; break; case ("1434"): cptcode = "22808"; break; case ("2008"): cptcode = "22612"; break; case ("1199"): cptcode = "63005"; break; case ("1501"): cptcode = "62161"; break; case ("1164"): cptcode = "62223"; break; case ("1402"): cptcode = "61312"; break; case ("1158"): cptcode = "31600"; break; case ("1165"): cptcode = "62200"; break; } myexcelfile1.WriteCell(string.Concat("j", l), cptcode); l++; } } myexcelfile1.closefile(); MessageBox.Show("CPT Codes updated"); }