public bool CreateNewAccount(int resellerId)
        {
            if (!Page.IsValid)
            {
                return(false);
            }

            try
            {
                GenericResult result = StorefrontHelper.AddContract(Account);
                // check result
                if (!result.Succeed)
                {
                    HostModule.ShowResultMessage(result.GetProperty <int>("ResultCode"));
                    return(false);
                }
                //
                contractId = result["ContractId"];
                //
                return(true);
            }
            catch (Exception ex)
            {
                HostModule.ShowErrorMessage("CREATE_NEW_ACCOUNT", ex);
                return(false);
            }
        }
Пример #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            // Step #1: Disable "On Behalf Of" feature if that the case
            if (PanelSecurity.LoggedUserId != PanelSecurity.SelectedUserId)
            {
                DisablePageFunctionality();
                ShowWarningMessage("WORK_ON_BEHALF_DISABLED");
                return;
            }

            // Step #2: Create customer contract if necessary
            if (!StorehouseHelper.CheckCustomerContractExists())
            {
                ContractAccount accountSettings = ecUtils.GetContractAccountFromUserInfo(PanelSecurity.SelectedUser);
                GenericResult   result          = StorefrontHelper.AddContract(PanelSecurity.SelectedUser.OwnerId, accountSettings);
                // Show error message
                if (!result.Succeed)
                {
                    DisablePageFunctionality();
                    ShowResultMessage(result.GetProperty <int>("ResultCode"));
                    return;
                }
            }

            // Step #3: Load customer contract
            myContract = StorehouseHelper.GetCustomerContract(PanelSecurity.SelectedUserId);

            // Step #4: Bind payment profile
            if (!IsPostBack)
            {
                BindPaymentProfile();
            }
        }