private string TestNameDuplicates(List <string> testNameFilterList) { TypeWiseReportModel twrModel = new TypeWiseReportModel(); int index = 0; int count = 1; twrModel.NoOfTest = 1; foreach (string str1 in testNameFilterList) { foreach (string str2 in testNameFilterList) { if (str1.Equals(str2)) { if (count == 1) { count++; continue; } index++; twrModel.NoOfTest++; twrModel.TestName = str1; testNameFilterList.RemoveAt(index); twrModels.Add(twrModel); return("Duplication Found"); } else { index++; } } index = 0; count = 1; } return("Duplicate Not Found"); }
private string OmitAdded(List <string> testNameFilterList) { TypeWiseReportModel twrModel = new TypeWiseReportModel(); int index = 0; foreach (TypeWiseReportModel twrM in twrModels) { foreach (string s in testNameFilterList) { if (twrM.TestName == s) { testNameFilterList.RemoveAt(index); return("Not Done Yet"); } else { index++; } } index = 0; } return("DONE"); }
public List <TypeWiseReportModel> GetAllTestNames(DateTime fromDate, DateTime toDate) { List <string> testNameList = twrGateway.GetAllTestNames(fromDate, toDate); // Seperate All Test Names List <string> testNameFilterList = TestNameFiltering(testNameList); // Remove Duplicate Value & Also Collect No. of Test string testNameDupRemoveList = TestNameDuplicates(testNameFilterList); while (testNameDupRemoveList == "Duplication Found") { testNameDupRemoveList = TestNameDuplicates(testNameFilterList); } // Remove Duplicate From Result Model string notify = ResultModelFilter(); while (notify == "Not Done") { notify = ResultModelFilter(); } // Omit Added Informations in Result Model string omit = OmitAdded(testNameFilterList); while (omit == "Not Done Yet") { omit = OmitAdded(testNameFilterList); } // Adding Others Informations foreach (string strName in testNameFilterList) { TypeWiseReportModel twrModel = new TypeWiseReportModel(); twrModel.TestName = strName; twrModel.NoOfTest = 1; twrModels.Add(twrModel); } // Getting Test Type By Test Names foreach (TypeWiseReportModel twReportModel in twrModels) { string strType = twrGateway.GetTypeName(twReportModel.TestName); twReportModel.TypeName = strType; double strFee = twrGateway.GetFee(twReportModel.TestName); strFee = (strFee * twReportModel.NoOfTest); twReportModel.Amount = strFee; } // Final Filtering By Removing Duplicates string notification = FinalFilter(); while (notification == "Not Done Yet") { notification = FinalFilter(); } return(twrModels); }