public List<LoadManagerErrors> SaveScrapeData(List<ScrapeData> scrapedData) { ReferenceGenerator refGen = new ReferenceGenerator(); string refNum = refGen.GenerateReference(); List<LoadManagerErrors> loadManagerErrors = new List<LoadManagerErrors>(); Logging log = new Logging(); int rowsSavedCount = 0; try { foreach (ScrapeData data in scrapedData) { int dataSaved = dataConnection.ExecuteStatement("Insert each scraped row of data in the DB"); rowsSavedCount = rowsSavedCount + dataSaved; } log.LogMessage(Enumeration.LoggingPriority.Low, refNum, rowsSavedCount.ToString() + " scraped data rows stored in DB"); loadManagerErrors.Add(new LoadManagerErrors { ErrorCode = 00, ErrorDescription = "Scraped Data Saved", Message = rowsSavedCount.ToString() + " records saved" }); } catch (Exception ex) { log.LogMessage(Enumeration.LoggingPriority.High, refNum, ex); loadManagerErrors.Add(new LoadManagerErrors { ErrorCode = 91, ErrorDescription = "Error Occured", Message = ex.InnerException.Message }); } return loadManagerErrors; }
public void CreateLoggingTest() { Logging MyService = new Logging(); bool retVal = MyService.LogMessage(Enumeration.LoggingPriority.Medium, "123456", new Exception()); ; Assert.IsTrue(retVal); }
public List<LoadManagerRule> LoadRules() { Logging log = new Logging(); ReferenceGenerator refGen = new ReferenceGenerator(); string refNum = refGen.GenerateReference(); List<LoadManagerRule> listRules = new List<LoadManagerRule>(); try { // This retrieves all Load Manager Rules via the DBConnetion listRules = new List<LoadManagerRule>(); } catch (Exception ex) { log.LogMessage(Enumeration.LoggingPriority.High, refNum, ex); listRules.Add(new LoadManagerRule()); } return listRules; }