private void button5_Click(object sender, EventArgs e) { LoadRetailFile GetJAVAData = new LoadRetailFile(MyJavaData); WriteToMainDB(); /* * List<JavaData> MyJavaData = new List<JavaData>(); * LoadRetailFile GetRetailData = new LoadRetailFile(MyJavaData); * * int j = 1; * while (j <= MyJavaData.Count - 1) * { * Console.WriteLine("****************** Record ************" + j + " - Begin"); * Console.WriteLine("ApplicationServiceList ==>"+ MyJavaData[j].ApplicationServiceList); * Console.WriteLine("Criticality ==>" + MyJavaData[j].Criticality); * Console.WriteLine("CriticalityupdateFor2020 ==>" + MyJavaData[j].CriticalityupdateFor2020); * Console.WriteLine("HostField ==>" + MyJavaData[j].HostField); * Console.WriteLine("Title ==>" + MyJavaData[j].Title); * Console.WriteLine("****************** Record ************" + j + " - End"); * j++; * } */ }
private void button5_Click(object sender, EventArgs e) { List <RetailData> MyRetailDData = new List <RetailData>(); LoadRetailFile GetRetailData = new LoadRetailFile(MyRetailDData); // ***************************************************************************************** // This is the main comparison file. This is will always be the same. The Calls above // Will change from EMPLOYEES, ICD, REATIL //****************************************************************************************** List <IcapData> GetiCapData = new List <IcapData>(); LoadFromFile GetData = new LoadFromFile(GetiCapData); int i = 0; int j = 0; int QuitFlag = 0; // Deletes file so you can do multiple runs and the file // doesn't get bigger because the StreamWriter appends data //********************* Header for FOUND employees FILE ************************** using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"./Employee.csv", true)) { file.WriteLine("************** RETAIL Data ****************"); file.WriteLine("PROD-AM ID," + "ROLE," + "NAME"); } //********************* Header for EXCEPTIONS employees file ************************** using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"./EmployeeException.csv", true)) { file.WriteLine("************** RETAIL Data ****************"); file.WriteLine("PROD-AM ID," + "ROLE," + "NAME"); } // Search the whole file... if you get to the end and you don't find anything // then write it to the exception file while (j <= MyRetailDData.Count - 1) { while (i <= GetiCapData.Count - 1 && QuitFlag != 1) { if (GetiCapData[i].IdentityID.ToUpper() == MyRetailDData[j].PRODAMID.ToUpper()) { using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"./Employee.csv", true)) { file.WriteLine(MyRetailDData[j].PRODAMID + "," + MyRetailDData[j].ROLENAME + "," + MyRetailDData[j].LASTNAME + "," + MyRetailDData[j].FIRSTNAME); QuitFlag = 1; } } i++; } if (QuitFlag == 0) { using (System.IO.StreamWriter file = new System.IO.StreamWriter(@"./EmployeeException.csv", true)) { file.WriteLine(MyRetailDData[j].PRODAMID + "," + MyRetailDData[j].ROLENAME + "," + MyRetailDData[j].LASTNAME + "," + MyRetailDData[j].FIRSTNAME); } } j++; i = 0; //reset inner loop QuitFlag = 0; } }