Ejemplo n.º 1
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
Ejemplo n.º 2
0
        }         // constructor

        protected override void ExecuteStep()
        {
            ForceNhibernateResync.ForCustomer(this.customerID);
        }         // ExecuteStep
Ejemplo n.º 3
0
        }         // SetTag

        public override void Execute()
        {
            Log.Debug("Executing for customer '{0}'...", this.customerID);

            LoadMainStrategyExecutedBefore();

            if (!this.mainStrategyExecutedBefore)
            {
                Log.Debug("Not executing: main strategy has never run before for customer '{0}'.", this.customerID);
                return;
            }             // if

            SafeReader sr = DB.GetFirst(
                "LoadLastCustomerCashRequest",
                CommandSpecies.StoredProcedure,
                new QueryParameter("CustomerID", this.customerID)
                );

            if (sr.IsEmpty)
            {
                Log.Debug(
                    "Not running silent automation for customer {0}: there is no available cash request.",
                    this.customerID
                    );

                return;
            }             // if

            this.cashRequestID = sr["CashRequestID"];

            this.nlCashRequestID = sr["NLCashRequestID"];

            ForceNhibernateResync.ForCustomer(this.customerID);

            Log.Debug(
                "Executing silent reject for customer '{0}' using cash request 'o {1}/n {2}'...",
                this.customerID,
                this.cashRequestID,
                this.nlCashRequestID
                );

            LoadCompanyAndMonthlyPayment(DateTime.UtcNow);

            var rejectAgent = new Ezbob.Backend.Strategies.AutoDecisionAutomation.AutoDecisions.Reject.LogicalGlue.Agent(
                new AutoRejectionArguments(
                    this.customerID,
                    CompanyID,
                    this.cashRequestID,
                    this.nlCashRequestID,
                    Tag,
                    DateTime.UtcNow,
                    DB,
                    Log
                    )
                )
            {
                CompareTrailsQuietly = true,
            };

            rejectAgent.MakeAndVerifyDecision();

            MedalResult medal = CalculateMedal();

            int offeredCreditLine = CapOffer(medal);

            Log.Debug(
                "Executing silent approve for customer '{0}' using cash request '{1}', nlCashRequest '{2}'...",
                this.customerID,
                this.cashRequestID,
                this.nlCashRequestID
                );

            var approveAgent = new Ezbob.Backend.Strategies.AutoDecisionAutomation.AutoDecisions.Approval.LogicalGlue.Agent(
                new AutoApprovalArguments(
                    this.customerID,
                    this.cashRequestID,
                    this.nlCashRequestID,
                    offeredCreditLine,
                    (AutomationCalculator.Common.Medal)medal.MedalClassification,
                    (AutomationCalculator.Common.MedalType)medal.MedalType,
                    (AutomationCalculator.Common.TurnoverType?)medal.TurnoverType,
                    rejectAgent.Output.FlowType,
                    rejectAgent.Output.ErrorInLGData,
                    Tag,
                    DateTime.UtcNow,
                    DB,
                    Log
                    )
                )
            {
                CompareTrailsQuietly = true,
            }.Init();

            approveAgent.MakeAndVerifyDecision();

            if (this.caller == Callers.AddMarketplace)
            {
                bool isRejected = !rejectAgent.WasMismatch && rejectAgent.Trail.HasDecided;
                bool isApproved = !approveAgent.WasMismatch && (
                    (
                        (rejectAgent.Output.FlowType == AutoDecisionFlowTypes.LogicalGlue) &&
                        approveAgent.Trail.HasDecided
                    ) || (
                        (rejectAgent.Output.FlowType != AutoDecisionFlowTypes.LogicalGlue) &&
                        (approveAgent.Trail.RoundedAmount > 0)
                        )
                    );

                if (!isRejected && isApproved)
                {
                    ExecuteMain();
                }
                else
                {
                    Log.Debug(
                        "Not running auto decision for customer {0} using cash request 'o {3}/n {4}': " +
                        "no potential ({1} and {2}).",
                        this.customerID,
                        isRejected ? "rejected" : "not rejected",
                        isApproved ? "approved" : "not approved",
                        this.cashRequestID,
                        this.nlCashRequestID
                        );
                }         // if
            }             // if

            Log.Debug("Complete for customer '{0}'.", this.customerID);
        }         // Execute