} // Init public virtual void Init(ASafeLog log = null) { Log = log.Safe(); Env = new Ezbob.Context.Environment(Log); DB = new SqlConnection(Env, Log); Culture = CreateCultureInfo(); } // Init
} // Init public virtual void Init(Ezbob.Context.Environment env, AConnection db, ASafeLog log) { Log = log; Env = env; DB = db; Culture = CreateCultureInfo(); } // Init
public virtual void Init(Ezbob.Context.Name name, string variant, ASafeLog log = null) { Log = log.Safe(); Env = new Ezbob.Context.Environment(name, variant, Log); DB = new SqlConnection(Env, Log); Culture = CreateCultureInfo(); } // Init
} // static constructor private Program() { this.log = new FileLog(Assembly.GetExecutingAssembly().GetName().Name); Ezbob.Context.Environment env = new Ezbob.Context.Environment(this.log); this.db = new SqlConnection(env, this.log); this.agreements = new List <Agreement>(); } // constructor
} // constructor protected AConnection(Ezbob.Context.Environment oEnv, ASafeLog log = null) { Log = log.Safe(); Env = oEnv; m_sConnectionString = null; m_nLogVerbosityLevel = LogVerbosityLevel.Compact; ms_oPool.Log.SetInternal(log); } // constructor
} // ConnectionString protected AConnection(ASafeLog log = null, string sConnectionString = null) { Log = log.Safe(); Env = new Ezbob.Context.Environment(log); m_sConnectionString = sConnectionString; m_nLogVerbosityLevel = LogVerbosityLevel.Compact; m_nCommandTimeout = 30; ms_oPool.Log.SetInternal(log); } // constructor
} // Main private Program() { m_oLog = new ConsoleLog(new FileLog("UiEventAddressFixer")); var env = new Ezbob.Context.Environment(m_oLog); m_oDB = new SqlConnection(env, m_oLog); m_oEvents = new SortedTable <int, long, EventInfo>(); m_oLastKnown = new SortedSet <string>(); } // constructor
} // Main private Program() { Ezbob.Context.Environment environment = new Ezbob.Context.Environment(); new Log4Net(environment).Init(); this.log = new SafeILog(this); this.db = new SqlConnection(environment, this.log); this.alertList = new List <string>(); this.cashRequestsToAlert = new List <ResetCashRequest>(); } // constructor
} // static constructor public static void Initialize(Ezbob.Context.Environment env, AConnection db, ASafeLog log) { if (!isInitialized) { lock (lockInstance) { if (!isInitialized) { instance = new Library(); instance.Init(env, db, log); isInitialized = true; } // if } // lock } // if } // Initialize
static void Main(string[] args) { var env = new Ezbob.Context.Environment(); new Log4Net(env).Init(); log = new SafeILog(typeof(Program)); db = new SqlConnection(env, log); CurrentValues.Init(db, log); var app = new Program(); app.Run(); app.Done(); } // Main
} // Usage private Program(string[] args) { ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls | SecurityProtocolType.Ssl3; m_aryArgs = args; m_oEnv = null; try { m_oEnv = new Ezbob.Context.Environment(); } catch (Exception e) { throw new NullReferenceException("Failed to determine current environment.", e); } // try var oLog4NetCfg = new Log4Net(m_oEnv).Init(); m_oLog = new SafeILog(this); NotifyStartStop("started"); m_oLog.Debug("Current environment: {0}", m_oEnv.Context); m_oLog.Debug("Error emails will be sent to: {0}", oLog4NetCfg.ErrorMailRecipient); m_oLog.Debug("ServicePointManager.SecurityProtocol = {0}", ServicePointManager.SecurityProtocol); NHibernateManager.FluentAssemblies.Add(typeof(User).Assembly); NHibernateManager.FluentAssemblies.Add(typeof(Customer).Assembly); NHibernateManager.FluentAssemblies.Add(typeof(eBayDatabaseMarketPlace).Assembly); NHibernateManager.FluentAssemblies.Add(typeof(AmazonDatabaseMarketPlace).Assembly); NHibernateManager.FluentAssemblies.Add(typeof(PayPalDatabaseMarketPlace).Assembly); NHibernateManager.FluentAssemblies.Add(typeof(EkmDatabaseMarketPlace).Assembly); NHibernateManager.FluentAssemblies.Add(typeof(DatabaseMarketPlace).Assembly); NHibernateManager.FluentAssemblies.Add(typeof(YodleeDatabaseMarketPlace).Assembly); NHibernateManager.FluentAssemblies.Add(typeof(PayPointDatabaseMarketPlace).Assembly); NHibernateManager.FluentAssemblies.Add(typeof(FreeAgentDatabaseMarketPlace).Assembly); NHibernateManager.FluentAssemblies.Add(typeof(SageDatabaseMarketPlace).Assembly); NHibernateManager.FluentAssemblies.Add(typeof(CompanyFilesDatabaseMarketPlace).Assembly); } // constructor
} // static constructor public static void Initialize(Ezbob.Context.Environment env, AConnection db, ASafeLog log) { if (!isInitialized) { lock (lockInstance) { if (!isInitialized) { instance = new Library(); instance.Init(env, db, log); isInitialized = true; } // if } // lock } // if Ezbob.Backend.Extensions.Library.Initialize(env, db, log); Ezbob.Models.Library.Initialize(env, db, log); AutomationCalculator.Library.Initialize(env, db, log); Ezbob.Backend.CalculateLoan.LoanCalculator.Library.Initialize(env, db, log); EZBob.DatabaseLib.Library.Initialize(env, db, log); Ezbob.Integration.LogicalGlue.Library.Initialize(env, db, log); } // Initialize
} // enum WorkingMode private Program(string[] args) { this.workingMode = WorkingMode.None; if ((args != null) && (args.Length > 0)) { Enum.TryParse(args[0], true, out this.workingMode); } this.log = new FileLog("ExtractDataForLsa"); this.cfg = CustomConfiguration.Load(); var env = new Ezbob.Context.Environment(this.cfg.Environment.Name, this.cfg.Environment.Variant, this.log); this.log.Msg("Target path: {0}", TargetPath); this.log.Msg("Dropbox root path: {0}", DropboxRootPath); this.log.Msg("Working mode: {0}", this.workingMode); if (this.workingMode == WorkingMode.None) { return; } var db = new SqlConnection(env, this.log); this.loans = new SortedDictionary <string, LoanData>(); this.nameToLoan = new SortedDictionary <string, SortedSet <string> >(); this.loansForLsa = new RptLoansForLsa(db, this.log); this.loansForLsaDirectors = new RptLoansForLsaDirectors(db, this.log); this.loansForLsaExperian = new RptLoansForLsaExperian(db, this.log); this.loansForLsaAgreements = new RptLoansForLsaAgreements(db, this.log); this.loansForLsaAgreementsBasePaths = new RptLoansForLsaAgreementsBasePaths(db, this.log); this.loansForLsaEchoSign = new RptLoansForLsaEchoSign(db, this.log); this.loansForLsaCrm = new RptLoansForLsaCRM(db, this.log); this.loansForLsaEmails = new RptLoansForLsaEmails(db, this.log); this.loansForLsaSms = new RptLoansForLsaSms(db, this.log); this.loansForLsaSnailmails = new RptLoansForLsaSnailmails(db, this.log); } // constructor
} // constructor public SqlConnection(Ezbob.Context.Environment oEnv, ASafeLog log = null) : base(oEnv, log) { } // constructor
public static void Main(string[] args) { var log = new LegacyLog(); var env = new Ezbob.Context.Environment(log); DateTime dNow = DateTime.Today; var oArgs = new Queue <string>(args); ReportType?nReportToExecute = null; bool bStdSet = false; bool bDateSet = false; while (oArgs.Count > 0) { string sArg = oArgs.Dequeue(); switch (sArg) { case "--std": bStdSet = true; dNow = dNow.AddDays(-1); break; case "--date": bDateSet = true; string sDate = (oArgs.Count > 0) ? oArgs.Dequeue() : string.Empty; DateTime.TryParseExact(sDate, "yyyy-MM-dd", new CultureInfo("en-GB"), DateTimeStyles.None, out dNow); break; case "--report": if (oArgs.Count > 0) { ReportType nRptType; if (Enum.TryParse(oArgs.Dequeue(), true, out nRptType)) { nReportToExecute = nRptType; } } // if break; } // switch } // while if (bDateSet && bStdSet) { log.Fatal("Both --std and --date set. There can be only one!"); throw new Exception("Both --std and --date set. There can be only one!"); } // if log.Info("Report delivery daemon started..."); log.Info("Current environment is {0}", env.Context); log.Info("Running with current date {0}", dNow.ToString("MMMM d yyyy H:mm:ss")); var reportsHandler = new EmailReportHandler(new SqlConnection(log), log); reportsHandler.ExecuteReportHandler(dNow, nReportToExecute); log.Info("Report delivery daemon completed all the tasks."); } // Main