示例#1
0
        }        // constructor

        public ActionResult Download(decimal amount, string viewName, int loanType, int repaymentPeriod)
        {
            var oLog = new SafeILog(LogManager.GetLogger(GetType()));

            oLog.Info("Download agreement: amount = {0}, view = {1}, loan type = {2}, repayment period = {3}", amount, viewName, loanType, repaymentPeriod);

            var lastCashRequest = this.customer.LastCashRequest;

            if (this.customer.IsLoanTypeSelectionAllowed == 1)
            {
                var oDBHelper = ObjectFactory.GetInstance <IDatabaseDataHelper>() as DatabaseDataHelper;
                lastCashRequest.RepaymentPeriod = repaymentPeriod;
                lastCashRequest.LoanType        = oDBHelper.LoanTypeRepository.Get(loanType);
            }             // if

            var loan = this.loanBuilder.CreateLoan(lastCashRequest, amount, DateTime.UtcNow);

            var model = this.builder.Build(this.customer, amount, loan);

            var productSubTypeID = loan.CashRequest.ProductSubTypeID;
            var originId         = loan.CashRequest.Customer.CustomerOrigin.CustomerOriginID;
            var isRegulated      = this.customer.PersonalInfo.TypeOfBusiness.IsRegulated();

            LoanAgreementTemplate loanAgreementTemplate = this.serviceClient.Instance.GetLegalDocs(this.customer.Id, this.context.UserId, originId, isRegulated, productSubTypeID ?? 0).LoanAgreementTemplates.FirstOrDefault(x => x.TemplateTypeName == viewName);

            if (loanAgreementTemplate != null)
            {
                var template = loanAgreementTemplate.Template;
                var pdf      = this.agreementRenderer.RenderAgreementToPdf(template, model);
                return(File(pdf, "application/pdf", viewName + " Summary_" + DateTime.Now + ".pdf"));
            }
            return(null);
        }         // Download
示例#2
0
        public JsonResult Index(int id, bool getFromLog = false, long?logId = null)
        {
            var log = new SafeILog(this);

            log.Debug("Loading a credit bureau model for customer {0}, getFromLog = {1}, logId = {2}.", id, getFromLog, logId);
            var customer = _customers.Get(id);
            var model    = _creditBureauModelBuilder.Create(customer, getFromLog, logId);

            return(Json(model, JsonRequestBehavior.AllowGet));
        }
示例#3
0
		} // static constructor

		public static AConnection Get(ASafeLog oLog = null) {
			if (!ReferenceEquals(null, ms_oDB))
				return ms_oDB;

			if (oLog == null)
				oLog = new SafeILog(typeof(DbConnectionGenerator));

			var env = new Context.Environment(oLog);

			lock (ms_oLock) {
				if (ReferenceEquals(null, ms_oDB))
					ms_oDB = new SqlConnection(env, oLog);
			} // lock

			return ms_oDB;
		} // operator AConnection
示例#4
0
        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
示例#5
0
        public JsonResult Calculate(int customerId, string pricingModelModel)
        {
            var oLog = new SafeILog(this);

            oLog.Debug("Model received: {0}", pricingModelModel);

            PricingModelModel inputModel = JsonConvert.DeserializeObject <PricingModelModel>(pricingModelModel);

            oLog.Debug("Parsed model: {0}", JsonConvert.SerializeObject(inputModel));

            PricingModelModelActionResult pricingModelCalculateResponse =
                this.serviceClient.Instance.PricingModelCalculate(customerId, this.context.UserId, inputModel);

            oLog.Debug("Calculated model: {0}", JsonConvert.SerializeObject(pricingModelCalculateResponse.Value));

            return(Json(pricingModelCalculateResponse.Value, JsonRequestBehavior.AllowGet));
        }         // Calculate
示例#6
0
        }         // 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
示例#7
0
		} // Get

		public Customer ReallyTryGet(int clientId) {
			try {
				return Get(clientId);
			} catch (Exception e) {
				var oLog = new SafeILog(this);
				oLog.Warn(e, "Could not retrieve customer by id {0}.", clientId);

				var os = new StringBuilder();

				StackTrace st = new StackTrace(true);

				for (int i = 0; i < st.FrameCount; i++) {
					StackFrame sf = st.GetFrame(i);
					os.AppendFormat("{0} at {1}:{2}\n", sf.GetMethod(), sf.GetFileName(), sf.GetFileLineNumber());
				} // for
				oLog.Debug("Stack trace:\n{0}", os.ToString());

				return null;
			} // try
		} // ReallyTryGet
示例#8
0
        public void Start()
        {
            NHibernateManager.FluentAssemblies.Add(typeof(User).Assembly);
            NHibernateManager.FluentAssemblies.Add(typeof(Customer).Assembly);
            Scanner.Register();
            ObjectFactory.Configure(x => {
                x.For <ISession>().LifecycleIs(new ThreadLocalStorageLifecycle()).Use(ctx => NHibernateManager.OpenSession());
                x.For <ISessionFactory>().Use(() => NHibernateManager.SessionFactory);
            });

            m_oLog = new SafeILog(Log);

            this.oLog4NetCfg = new Log4Net().Init();

            m_oDB = new SqlConnection(oLog4NetCfg.Environment, m_oLog);

            ConfigManager.CurrentValues.Init(m_oDB, m_oLog);
            DbConnectionPool.ReuseCount = CurrentValues.Instance.ConnectionPoolReuseCount;
            AConnection.UpdateConnectionPoolMaxSize(CurrentValues.Instance.ConnectionPoolMaxSize);
        }         // Start
        public void TestHmrcPdfThrasher()
        {
            var oLog = new SafeILog(LogManager.GetLogger(typeof(TestRetrieveDataHelper)));

            var p = new VatReturnPdfThrasher(true, oLog);

            foreach (string sFilePah in Directory.GetFiles(@"c:\ezbob\test-data\vat-return", "vat*.pdf"))
            {
                oLog.Msg("Processing file {0} started...", sFilePah);

                var smd = new SheafMetaData {
                    BaseFileName = sFilePah,
                    DataType     = DataType.VatReturn,
                    FileType     = FileType.Pdf,
                    Thrasher     = p
                };

                ISeeds s = p.Run(smd, File.ReadAllBytes(sFilePah));

                oLog.Msg("Processing file {0} complete.", sFilePah);
            }     // for each
        }         // TestHmrcPdfThrasher
示例#10
0
 public NonLimitedParser(AConnection db, ASafeLog log)
 {
     this.log = new SafeILog(log);
     this.db  = db;
 }
示例#11
0
        }         // constructor

        public Transactional(Action oAction, IsolationLevel nLevel = IsolationLevel.ReadCommitted)
        {
            m_oAction      = oAction;
            IsolationLevel = nLevel;
            m_oLog         = new SafeILog(this);
        }         // constructor
示例#12
0
 static ABrokerBaseController()
 {
     ms_oLog = new SafeILog(typeof(BrokerHomeController));
     m_oDB   = DbConnectionGenerator.Get(ms_oLog);
 }         // static constructor
 public FinancialAccountsParser()
 {
     log4net.Config.XmlConfigurator.Configure();
     log = new SafeILog(LogManager.GetLogger(typeof(FinancialAccountsParser)));
     db  = new SqlConnection(new Ezbob.Context.Environment(Name.Production), log);
 }