Exemplo n.º 1
0
        public JsonResult RunNewCreditLine(int Id, int newCreditLineOption)
        {
            log.Debug("RunNewCreditLine({0}, {1}) start", Id, newCreditLineOption);

            NewCreditLineOption typedNewCreditLineOption = (NewCreditLineOption)newCreditLineOption;

            User underwriter = this.users.GetUserByLogin(User.Identity.Name, null);

            ActionMetaData amd = ExecuteNewCreditLine(underwriter.Id, Id, typedNewCreditLineOption);

            // Reload from DB
            Customer customer = this.customerRepository.Load(Id);

            string strategyError = amd.Status == ActionStatus.Done ? null : "Error: " + amd.Comment;

            EZBob.DatabaseLib.Model.Database.CreditResultStatus?status = customer.CreditResult;

            log.Debug(
                "RunNewCreditLine({0}, {1}) ended; status = {2}, error = '{3}'",
                Id,
                typedNewCreditLineOption,
                status,
                strategyError
                );

            return(Json(new {
                status = (status ?? EZBob.DatabaseLib.Model.Database.CreditResultStatus.WaitingForDecision).ToString(),
                strategyError = strategyError,
            }));
        }         // RunNewCreditLine
Exemplo n.º 2
0
 public UpdateLandRegistryData(
     string outerContextDescription,
     int customerID,
     string customerFullName,
     bool customerIsAutoRejected,
     AutoDecisionFlowTypes flowType,
     bool isOwnerOfMainAddress,
     bool isOwnerOfOtherProperties,
     NewCreditLineOption newCreditLineOption,
     bool customerIsTest,
     bool avoidAutoDecision,
     bool customerIsAutoReapproved
     ) : base(outerContextDescription)
 {
     this.customerID             = customerID;
     this.customerFullName       = customerFullName;
     this.customerIsAutoRejected = customerIsAutoRejected;
     this.flowType                 = flowType;
     this.isOwnerOfMainAddress     = isOwnerOfMainAddress;
     this.isOwnerOfOtherProperties = isOwnerOfOtherProperties;
     this.newCreditLineOption      = newCreditLineOption;
     this.customerIsTest           = customerIsTest;
     this.avoidAutoDecision        = avoidAutoDecision;
     this.customerIsAutoReapproved = customerIsAutoReapproved;
 }         // constructor
Exemplo n.º 3
0
 public CheckAutoRulesRequested(
     string outerContextDescription,
     NewCreditLineOption newCreditLineOption
     ) : base(outerContextDescription)
 {
     this.newCreditLineOption = newCreditLineOption;
 }         // constructor
Exemplo n.º 4
0
        public CheckUpdateDataRequested(
            string outerContextDescription,
            NewCreditLineOption newCreditLineOption,
            int customerID,
            int marketplaceUpdateValidityDays
            ) : base(outerContextDescription)
        {
            this.newCreditLineOption           = newCreditLineOption;
            this.customerID                    = customerID;
            this.marketplaceUpdateValidityDays = marketplaceUpdateValidityDays;

            MarketplacesToUpdate = new List <string>();
        }         // constructor
Exemplo n.º 5
0
        }         // ResetPassword123456

        private ActionMetaData ExecuteNewCreditLine(
            int underwriterID,
            int customerID,
            NewCreditLineOption newCreditLineOption
            )
        {
            Customer customer = this.customerRepository.Get(customerID);

            EZBob.DatabaseLib.Model.Database.CashRequestOriginator originator;

            switch (newCreditLineOption)
            {
            case NewCreditLineOption.SkipEverything:
                originator = EZBob.DatabaseLib.Model.Database.CashRequestOriginator.NewCreditLineSkipAll;
                break;

            case NewCreditLineOption.SkipEverythingAndApplyAutoRules:
                originator = EZBob.DatabaseLib.Model.Database.CashRequestOriginator.NewCreditLineSkipAndGoAuto;
                break;

            case NewCreditLineOption.UpdateEverythingAndApplyAutoRules:
                originator = EZBob.DatabaseLib.Model.Database.CashRequestOriginator.NewCreditLineUpdateAndGoAuto;
                break;

            case NewCreditLineOption.UpdateEverythingAndGoToManualDecision:
                originator = EZBob.DatabaseLib.Model.Database.CashRequestOriginator.NewCreditLineUpdateAndGoManual;
                break;

            default:
                originator = EZBob.DatabaseLib.Model.Database.CashRequestOriginator.NewCreditLineBtn;
                log.Alert(
                    "New credit line option not specified for customer {0}, underwriter {1} - defaulting to obsolete value.",
                    customerID,
                    underwriterID
                    );
                break;
            }             // switch

            ActionMetaData amd = new MainStrategyClient(
                underwriterID,
                customer.Id,
                customer.IsAvoid,
                newCreditLineOption,
                null,
                originator
                ).ExecuteSync();

            ForceNhibernateResync.ForCustomer(customerID);

            return(amd);
        } // ExecuteNewCreditLine
Exemplo n.º 6
0
		public MainStrategyClient(
			int underwriterID,
			int customerID,
			bool isAvoid,
			NewCreditLineOption newCreditLineOption,
			long? cashRequestID,
			CashRequestOriginator? cashRequestOriginator
		) {
			this.underwriterID = underwriterID;
			this.customerID = customerID;
			this.avoidAutoDecision = isAvoid ? 1 : 0;
			this.newCreditLineOption = newCreditLineOption;
			this.cashRequestID = cashRequestID;
			this.cashRequestOriginator = cashRequestOriginator;
			this.serviceClient = new ServiceClient();
		} // constructor
Exemplo n.º 7
0
 public ActionMetaData MainStrategyAsync(
     int underwriterId,
     int customerId,
     NewCreditLineOption newCreditLine,
     int avoidAutoDescison,
     long?cashRequestID,
     CashRequestOriginator?cashRequestOriginator
     )
 {
     return(Execute(PrepareMainStrategyArguments(
                        underwriterId,
                        customerId,
                        newCreditLine,
                        avoidAutoDescison,
                        cashRequestID,
                        cashRequestOriginator
                        )));
 }         // MainStrategyAsync
Exemplo n.º 8
0
        }         // MainStrategySync

        private ExecuteArguments PrepareMainStrategyArguments(
            int underwriterId,
            int customerId,
            NewCreditLineOption newCreditLine,
            int avoidAutoDescison,
            long?cashRequestID,
            CashRequestOriginator?cashRequestOriginator
            )
        {
            var onfail = new Action <ActionMetaData>(
                amd => DB.ExecuteNonQuery(
                    "UpdateMainStratFinishDate",
                    CommandSpecies.StoredProcedure,
                    new QueryParameter("CustomerID", customerId),
                    new QueryParameter("Now", DateTime.UtcNow)
                    )
                );

            var mainStrategyArgs = new MainStrategyArguments {
                UnderwriterID         = underwriterId,
                CustomerID            = customerId,
                NewCreditLine         = newCreditLine,
                AvoidAutoDecision     = avoidAutoDescison,
                FinishWizardArgs      = null,
                CashRequestID         = cashRequestID,
                CashRequestOriginator = cashRequestOriginator,
            };

            return(new ExecuteArguments(mainStrategyArgs)
            {
                CustomerID = customerId,
                UserID = underwriterId,
                StrategyType = typeof(MainStrategy),
                OnException = onfail,
                OnFail = onfail,
            });
        } // PrepareMainStrategyArguments
Exemplo n.º 9
0
		} // AvoidAutoDecision

		public static bool UpdateData(this NewCreditLineOption nco) {
			return
				(nco == NewCreditLineOption.UpdateEverythingAndApplyAutoRules) ||
				(nco == NewCreditLineOption.UpdateEverythingAndGoToManualDecision);
		} // UpdateData
Exemplo n.º 10
0
		public static bool AvoidAutoDecision(this NewCreditLineOption nco) {
			return
				(nco == NewCreditLineOption.SkipEverything) ||
				(nco == NewCreditLineOption.UpdateEverythingAndGoToManualDecision);
		} // AvoidAutoDecision