public List <CONTACT1ChangeTracking_Result> GetContact1ChangeTrackingResults(int _contact1StartVersionNumber) { List <CONTACT1ChangeTracking_Result> results = new List <CONTACT1ChangeTracking_Result>(); try { using (GoldmineEntities context = new GoldmineEntities()) { results = (from c in context.CONTACT1ChangeTracking(_contact1StartVersionNumber) select c).ToList(); } if (results.Count > 0) { _versionNumberProcess.UpdateContact1VersionNumber(int.Parse(results.OrderByDescending(x => x.SYS_CHANGE_VERSION).FirstOrDefault().SYS_CHANGE_VERSION.Value.ToString())); } } catch (Exception ex) { _exceptionLogging.LogException(ex); } return(results); }
public void Run() { VersionNumberProcess vnp = new VersionNumberProcess(); ChangeTrackingProcess changeTrackingProcess = new ChangeTrackingProcess(); ResultsProcessor resultsProcessor = new ResultsProcessor(); ApplicationLogging applicationLogging = new ApplicationLogging(); ExceptionLogging exceptionLogging = new ExceptionLogging(); AppSettings appSettings = new AppSettings(); do { List <CONTACT1ChangeTracking_Result> contact1Results = new List <CONTACT1ChangeTracking_Result>(); List <CONTACT2ChangeTracking_Result> contact2Results = new List <CONTACT2ChangeTracking_Result>(); List <CONTSUPPChangeTracking_Result> contsuppResults = new List <CONTSUPPChangeTracking_Result>(); try { if (appSettings.RunAsConsole) { Console.Clear(); Console.WriteLine("Getting CONTACT1 changes"); } contact1Results = changeTrackingProcess.GetContact1ChangeTrackingResults(vnp.GetCurrentContact1Version()); if (appSettings.RunAsConsole) { Console.WriteLine("CONTACT1 changes: {0}", contact1Results.Count); } if (appSettings.RunAsConsole) { Console.WriteLine("Getting CONTACT2 changes"); } contact2Results = changeTrackingProcess.GetContact2ChangeTrackingResults(vnp.GetCurrentContact2Version()); if (appSettings.RunAsConsole) { Console.WriteLine("CONTACT2 changes: {0}", contact2Results.Count); } if (appSettings.RunAsConsole) { Console.WriteLine("Getting CONTSUPP changes"); } contsuppResults = changeTrackingProcess.GetContSuppChangeTrackingResults(vnp.GetCurrentContsuppVersion()); if (appSettings.RunAsConsole) { Console.WriteLine("CONTSUPP changes: {0}", contsuppResults.Count); } } catch (Exception dataRetrieveError) { exceptionLogging.LogException(dataRetrieveError); } try { List <ResultsObject> results = resultsProcessor.ProcessAPICalls(contact1Results, contact2Results, contsuppResults); if (appSettings.RunAsConsole) { Console.WriteLine("Finished Processing: results count.... {0}", results.Count); } } catch (Exception processError) { exceptionLogging.LogException(processError); } Thread.Sleep(appSettings.ThreadSleep); } while (true); }