}                                                                                 // Name

        public override void Execute()
        {
            var oValidator = new ValidateMobileCode(this.mobilePhoneNumber, this.confirmationCode);

            oValidator.Execute();
            if (!oValidator.IsValidatedSuccessfully())
            {
                throw new StrategyWarning(this, "Failed to validate mobile code.");
            }

            var sp = new SpBrokerLoadOwnProperties(DB, Log)
            {
                ContactMobile = this.mobilePhoneNumber,
            };

            BrokerProperties props = sp.FillFirst <BrokerProperties>();

            if ((props == null) || (props.BrokerID == 0))
            {
                throw new StrategyWarning(this, string.Format(
                                              "No broker found with this phone number {0}.",
                                              this.mobilePhoneNumber
                                              ));
            }             // if

            Log.Debug("Broker properties search result for mobile phone {0}:\n{1}", this.mobilePhoneNumber, props);

            new BrokerPasswordRestored(props.BrokerID).Execute();
        }         // Execute
Exemple #2
0
        public override void Execute()
        {
            if (!this.isCaptchaEnabled)
            {
                var oValidator = new ValidateMobileCode(this.sp.ContactMobile, this.mobileCode);
                oValidator.Execute();

                if (!oValidator.IsValidatedSuccessfully())
                {
                    Properties.ErrorMsg = "Failed to validate mobile code.";
                }
            }             // if

            this.sp.FillFirst(Properties);

            if (!string.IsNullOrWhiteSpace(Properties.ErrorMsg))
            {
                Log.Warn("Failed to create a broker: {0}", Properties.ErrorMsg);
                return;
            }             // if

            if (Properties.BrokerID < 1)
            {
                Log.Alert("Failed to create a broker: no error message from DB but broker id is 0.");
                throw new StrategyException(this, "Failed to create a broker.");
            }     // if
        }         // Execute
        }         // CreateSecurityUserStuff

        private void CreateCustomerStuff()
        {
            Log.Debug("Sign up attempt '{0}': validating mobile phone...", this.uniqueID);

            bool mobilePhoneVerified = false;

            if (!this.model.CaptchaMode)
            {
                var vmc = new ValidateMobileCode(this.model.MobilePhone, this.model.MobileVerificationCode)
                {
                    Transaction = this.dbTransaction
                };
                vmc.Execute();
                mobilePhoneVerified = vmc.IsValidatedSuccessfully();
            }             // if

            Log.Debug("Sign up attempt '{0}': creating a customer entry...", this.uniqueID);

            var customer = new CreateCustomer(this, mobilePhoneVerified);

            customer.ExecuteNonQuery(this.dbTransaction);
            RefNumber = customer.RefNumber;

            Log.Debug("Sign up attempt '{0}': creating a campaign source reference entry...", this.uniqueID);

            if (!this.model.BrokerFillsForCustomer)
            {
                new CreateCampaignSourceRef(this).ExecuteNonQuery(this.dbTransaction);
            }

            Log.Debug("Sign up attempt '{0}': creating a requested loan entry...", this.uniqueID);

            new CreateCustomerRequestedLoan(this).ExecuteNonQuery(this.dbTransaction);

            Log.Debug("Sign up attempt '{0}': creating a source reference history entry...", this.uniqueID);

            SaveSourceRefHistory();

            if (this.model.IsAlibaba())
            {
                Log.Debug("Sign up attempt '{0}': creating an Alibaba buyer entry...", this.uniqueID);
                new CreateAlibabaBuyer(this).ExecuteNonQuery(this.dbTransaction);
            }             // if

            Log.Debug("Sign up attempt '{0}': customer stuff was created.", this.uniqueID);
        }         // CreateCustomerStuff