/// <summary> /// test locally without saving to database /// for debugging purposes only: call this method in Main() /// </summary> /// <param name="myService">Service Code</param> private static void TestTransactionId(ServiceCode myService) { PrintHelper.Trace(string.Format(Messages.GetServiceName, myService.ToString())); ServiceHelper sh = new ServiceHelper(myService); List <FileInfo> logFiles = ReadHelper.Read_SW_Logs(inputDate, sh); foreach (FileInfo file in logFiles) { DateTime createDate = file.CreationTime; DateTime modifiedDate = file.LastWriteTime; string id = ReadHelper.GetTransactionId_StreamReader(file); PrintHelper.Trace(string.Format("the output transaction ID is {0}", id)); } }
/// <summary> /// Main will call this function. Start Here /// </summary> /// <param name="myService"></param> private static void StartProgram(ServiceCode myService) { PrintHelper.Trace(string.Format(Messages.GetServiceName, myService.ToString())); try { ServiceHelper sh = new ServiceHelper(myService); //SWTNBHelper sWTNB = new SWTNBHelper(); //List<string> retString = sWTNB.GetTransId(inputDate, sh); //get logfiles from folder based on date and insert data to SOA Transaction List <FileInfo> logFiles = ReadHelper.Read_SW_Logs(inputDate, sh); PrintHelper.Trace(Messages.InsertSOA_TRANSACTION); Insert_SOA_Transaction(logFiles, sh); //Compare with QS Report and save difference in KSF_SYSTEM_SOA_FAIL_TRANS List <string> soaTransactionList = ReadHelper.Read_QS_TransactionId(inputDate, sh); List <string> swTransactionList = ReadHelper.Read_SW_Transaction_ID(logFiles); PrintHelper.Trace(Messages.RemoveDuplicates); soaTransactionList = soaTransactionList.Distinct().ToList(); swTransactionList = swTransactionList.Distinct().ToList(); PrintHelper.Trace(string.Format(Messages.TotalTransId_QS, soaTransactionList.Count)); PrintHelper.Trace(string.Format(Messages.TotalTransId_SW, swTransactionList.Count)); //this will insert the difference into KSF_SYSTEM_SOA_FAIL_TRANS table PrintHelper.Trace(Messages.InsertKSF_SYSTEM_SOA_FAIL_TRANS); var difference = soaTransactionList.Except(swTransactionList); //var difference = swTransactionList.Except(soaTransactionList); if (difference.Count() == 0) { PrintHelper.Trace(string.Format(Messages.TotalDifferenceZero, difference.Count().ToString())); } else { PrintHelper.Trace(string.Format(Messages.TotalDifference, difference.Count().ToString())); Insert_SOA_Fail_Trans(difference, sh, inputDate); } } catch (Exception ex) { PrintHelper.Error(ex.Message); PrintHelper.Error(ex.ToString()); } }