static void Main(string[] args) { var log = new ConsoleLog(new LegacyLog()); var env = new Ezbob.Context.Environment(Name.Production, oLog: log); var oDB = new SqlConnection(env, log); RunExperianLimitedCompanyData(oDB, log); RunLoanDateScore(oDB, log); } // Main
static void Main(string[] args) { Log = new LegacyLog(); var app = new GoogleAnalytics(Log); Environment = new EzEnv(Log); string thumb = System.Configuration.ConfigurationManager.AppSettings["gaCertThumb"]; m_oReportDate = DateTime.Today.AddDays(-1); if (Environment.Name == Name.Dev) { Log = new ConsoleLog(); if ((args.Length > 1) && (args[0] == "--date")) { DateTime.TryParseExact(args[1], "yyyy-MM-dd", CultureInfo.InvariantCulture, DateTimeStyles.None, out m_oReportDate); } if (app.Init(m_oReportDate, thumb)) { Run(app); } Done(); } else { try { if (app.Init(m_oReportDate, thumb)) { if ((args.Length > 1) && (args[0] == "--backfill")) { RunBackfill(app, args[1], args[2]); } else { Run(app); } } Done(); } catch (Exception ex) { app.Log.Error("Error Occured!\n\nStatement: {0}\n\nDescription: {1}", ex.Message, ex.ToString()); app.Log.Error("\nPress enter to exit"); } // try } // if dev/non-dev env }
static void Main(string[] args) { const string DataFileName = "ez-1091.csv"; var log = new FileLog("ez1091", oLog: new ConsoleLog()); var env = new Ezbob.Context.Environment(Name.Production, oLog: log); RequestedTransactionsLibrary oRequested = LoadRequested(DataFileName, log); // if (oRequested.Count > 1) log.Dispose(); } // Main
public Log4Net(Ezbob.Context.Environment oEnv = null) { if (oEnv == null) { try { oEnv = new Ezbob.Context.Environment(); } catch (Exception e) { throw new NullReferenceException("Failed to determine current environment.", e); } // try } // if Environment = oEnv; ErrorMailHashtag = string.Empty; string sErrMailRec = string.Empty; switch (oEnv.Name) { case Name.Dev: sErrMailRec = oEnv.UserName; if (oEnv.UserName.StartsWith("alexb")) { ErrorMailHashtag = "#devalexboerror"; } break; case Name.Qa: sErrMailRec = "qa"; break; case Name.Integration: case Name.Uat: sErrMailRec = "uatmail"; break; case Name.Production: sErrMailRec = "ProdLogs"; ErrorMailHashtag = "#proderror"; break; default: throw new ArgumentOutOfRangeException("Unsupported environment name: " + oEnv.Name, (Exception)null); } // switch ErrorMailRecipient = sErrMailRec + "@ezbob.com" + ( string.IsNullOrWhiteSpace(ErrorMailHashtag) ? string.Empty : ",[email protected]" ); string ipStr = string.Empty; foreach (var address in Dns.GetHostEntry(Dns.GetHostName()).AddressList) { string addressStr = address.ToString(); if (addressStr.StartsWith("192")) { ipStr = addressStr; break; } // if } // for each MailSubject = oEnv.MachineName + " (" + ipStr + "): EzBob log"; } // constructor
static void Main(string[] args) { using (var oLog = new FileLog(oLog: new ConsoleLog())) { // var oEnv = new Ezbob.Context.Environment(Name.Dev, "alexbo", oLog: oLog); var oEnv = new Ezbob.Context.Environment(Name.Production, oLog: oLog); var oDB = new SqlConnection(oEnv, oLog); var oLoans = new SortedDictionary <int, Loan>(); var oProgress = new ProgressCounter("{0} transaction entries processed.", oLog, 64); oDB.ForEachRow( (oReader, bRowsetStart) => { int nLoanID = Convert.ToInt32(oReader["LoanID"]); if (oLoans.ContainsKey(nLoanID)) { oLoans[nLoanID].Transactions.Add(new Transaction(oReader, oLog)); } else { oLoans[nLoanID] = new Loan(oReader, oLog); } oProgress++; return(ActionResult.Continue); }, GetQuery("Transactions") ); oProgress.Log(); oProgress = new ProgressCounter("{0} schedule entries processed.", oLog, 64); oDB.ForEachRow( (oReader, bRowsetStart) => { int nLoanID = Convert.ToInt32(oReader["LoanID"]); if (oLoans.ContainsKey(nLoanID)) { var oSh = new Schedule(oReader, oLog); oLoans[nLoanID].Actual.Add(oSh); } // if oProgress++; return(ActionResult.Continue); }, GetQuery("Schedule") ); oProgress.Log(); oLog.Msg("Loans status:"); var oStateStat = new SortedDictionary <ScheduleState, int>(); foreach (Loan l in oLoans.Values) { if (!Loan.Step2.Contains(l.ID)) { continue; } if (l.ProcessedTransactionCount == l.Transactions.Count) { continue; } l.BuildWorkingSet(); l.Calculate(); oLog.Msg("{0}", l.ToString()); if (oStateStat.ContainsKey(l.ScheduleState)) { oStateStat[l.ScheduleState]++; } else { oStateStat[l.ScheduleState] = 1; } l.Save(oDB); } // for each loan double nTotal = (double)oStateStat.Values.Sum(); foreach (KeyValuePair <ScheduleState, int> pair in oStateStat) { oLog.Msg("Status {0}: {1} loans = {2}", pair.Key, pair.Value, ((double)pair.Value / nTotal).ToString("p2")); } } // using log file } // Main