Example #1
0
 private void LoadPaymentControl()
 {
     try
     {
         // load payment method control
         Control ctlMethod = LoadControl("PaymentMethods/" + ecPanelRequest.PaymentMethod + "_Payment.ascx");
         //
         ctlMethod.ID = CTL_PAYMENT_FORM;
         //
         IPaymentMethod methodObj = (IPaymentMethod)ctlMethod;
         //
         PaymentMethod method = StorefrontHelper.GetContractPaymentMethod(ecPanelRequest.ContractId,
                                                                          ecPanelRequest.PaymentMethod);
         //
         ContractAccount account = StorefrontHelper.GetContractAccount(ecPanelRequest.ContractId);
         //
         methodObj.LoadContractAccount(account);
         //
         methodObj.CheckSupportedItems(method.SupportedItems);
         //
         btnComplete.Visible = !method.Interactive;
         //
         btnProceed.Visible = method.Interactive;
         //
         phPaymentMethod.Controls.Add(ctlMethod);
     }
     catch (Exception ex)
     {
         ShowErrorMessage("LOAD_PAYMENT_CTL", ex);
         //
         DisableActionCtls();
     }
 }
        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);
            }
        }
        private void PrepearePayPalCheckoutParams()
        {
            // setup checkout options
            KeyValueBunch options = new KeyValueBunch();

            options["target_site"] = EcommerceSettings.AbsoluteAppPath;
            // load checkout params
            CheckoutFormParams fParams = StorefrontHelper.GetCheckoutFormParams(ecPanelRequest.ContractId,
                                                                                ecPanelRequest.InvoiceId, ecPanelRequest.PaymentMethod, options);

            // register all hidden fields
            foreach (string keyName in fParams.GetAllKeys())
            {
                Page.ClientScript.RegisterHiddenField(keyName, fParams[keyName]);
            }
            // build bootstrap javascript
            string bootstrapJs = String.Format(
                "var checkout_form_method = '{0}', checkout_routine_url = '{1}';",
                fParams.Method,
                fParams.Action
                );

            // bootstrap checkout form
            Page.ClientScript.RegisterStartupScript(
                GetType(),
                "BootStrapCheckoutForm",
                bootstrapJs,
                true
                );
        }
        public bool SaveContractAccount()
        {
            ContractAccount account = null;

            //
            if (!Page.User.Identity.IsAuthenticated)
            {
                //
                string username = txtUsername.Text.Trim();
                //
                if (StorefrontHelper.UsernameExists(username))
                {
                    HostModule.ShowResultMessage(BusinessErrorCodes.ERROR_USER_ALREADY_EXISTS);
                    return(false);
                }
                //
                string state = (txtCountryState.Visible) ? txtCountryState.Text.Trim() : ddlCountryStates.SelectedValue;
                //
                account = ecUtils.GetContractAccountFromInput(username, txtPassword.Text, txtFirstName.Text.Trim(),
                                                              txtLastName.Text.Trim(), txtEmail.Text.Trim(), txtCompany.Text.Trim(), txtAddress.Text.Trim(),
                                                              txtCity.Text.Trim(), ddlCountry.SelectedValue, state, txtPostalCode.Text.Trim(), txtPhoneNumber.Text.Trim(),
                                                              txtFaxNumber.Text.Trim(), txtInstantMsngr.Text.Trim(), ddlMailFormat.SelectedValue);
            }
            else
            {
                account = ecUtils.GetContractAccountFromUserInfo(WSP.PanelSecurity.EffectiveUser);
            }
            //
            ViewState[VIEWSTATE_KEY] = account;
            //
            return(true);
        }
Example #5
0
 private void CompleteCheckout()
 {
     try
     {
         // lookup for payment form
         IPaymentMethod methodObj = (IPaymentMethod)FindControl(CTL_PAYMENT_FORM);
         //
         CheckoutDetails details = methodObj.GetCheckoutDetails();
         //
         CheckoutResult result = StorefrontHelper.CompleteCheckout(ecPanelRequest.ContractId,
                                                                   ecPanelRequest.InvoiceId, ecPanelRequest.PaymentMethod, details);
         //
         if (!result.Succeed)
         {
             ShowErrorMessage(result.StatusCode);
             return;
         }
         //
         ecUtils.Navigate("ecOrderComplete", true);
     }
     catch (Exception ex)
     {
         ShowErrorMessage("COMPLETE_CHECKOUT", ex);
     }
 }
        private void CheckDomain(ManualValidationEventArgs args)
        {
            // ensure domain name not empty
            reqDomainVal.Validate();
            //
            if (!reqDomainVal.IsValid)
            {
                return;
            }

            string domain = EnsureDomainCorrectness(txtDomainReg.Text);
            //
            CheckDomainResult result = StorefrontHelper.CheckDomain(ResellerId, domain, ddlTopLevelDoms.SelectedItem.Text);

            // domain is available for purchase
            if (result.Succeed && result.ResultCode == 0)
            {
                //
                lblDomainAvailable.Visible = true;
                //
                args.ContextIsValid = true;
                //
                return;
            }

            //
            if (result.Succeed && result.ResultCode != 0)
            {
                //
                args.ContextIsValid = false;
                // show error message
                ctxDomainValidator.ErrorMessage = GetSharedLocalizedString(Keys.ModuleName, "CHECK_DOMAIN." + (result.ResultCode * -1));
                //
                return;
            }

            //
            if (!result.Succeed)
            {
                //
                args.ContextIsValid = false;
                //
                ctxDomainValidator.ErrorMessage = result.ErrorMessage;
                //
                return;
            }

            //
            args.ContextIsValid = false;
        }
 private void BindTopLevelDomains(DropDownList ctl_list, bool transfer)
 {
     ctl_list.DataSource = StorefrontHelper.GetStorefrontProductsByType(ResellerId,
                                                                        Product.TOP_LEVEL_DOMAIN);
     ctl_list.DataBind();
     // bind cycles
     if (transfer)
     {
         BindDomainCyclesForTransfer();
     }
     else
     {
         BindDomainCyclesForRegistration();
     }
     //
     ShowExtensionFields();
 }
Example #8
0
 private void LoadCustomerInvoice()
 {
     try
     {
         //
         string invoiceTemplate = StorefrontHelper.GetContractInvoiceTemplated(ecPanelRequest.ContractId,
                                                                               ecPanelRequest.InvoiceId);
         //
         ctlCustomerInvoice.ShowCustomerInvoice(invoiceTemplate);
     }
     catch (Exception ex)
     {
         ShowErrorMessage("LOAD_CUSTOMER_INVOICE", ex);
         //
         DisableActionCtls();
     }
 }
Example #9
0
        private void ShowRecurringAddon()
        {
            // turn off
            ecUtils.ToggleControls(false, pnlOneTimeFee);
            // turn on
            if (AddonInfo.Countable)
            {
                ecUtils.ToggleControls(true, pnlRecurring, lclAddonPrice, lclSetupFee, pnlQuantity);
            }
            else
            {
                ecUtils.ToggleControls(true, pnlRecurring, lclAddonPrice, lclSetupFee);
            }

            int resellerId = (Page.User.Identity.IsAuthenticated) ? PanelSecurity.SelectedUser.OwnerId : ecPanelRequest.ResellerId;

            rptAddonCycles.DataSource = StorefrontHelper.GetHostingAddonCycles(resellerId, AddonInfo.ProductId);
            rptAddonCycles.DataBind();
        }
        private void BindDomainCyclesForRegistration()
        {
            // try parse product id
            int productId = ecUtils.ParseInt(ddlTopLevelDoms.SelectedValue, 0);

            // bind
            if (productId > 0)
            {
                DomainNameCycle[] cycles = StorefrontHelper.GetTopLevelDomainCycles(
                    ResellerId, productId);
                // cleanup all of items
                ddlDomCycles.Items.Clear();
                // re-create items from scratch
                foreach (DomainNameCycle cycle in cycles)
                {
                    ddlDomCycles.Items.Add(CreateDomainCycleItem(cycle, false));
                }
            }
        }
Example #11
0
        private void DisplayProductInfo()
        {
            ltrProductName.Text      = productInfo.ProductName;
            ltrCurrencySymb.Text     = EcommerceSettings.CurrencyCodeISO;
            btnOrder.CommandArgument = productInfo.ProductId.ToString();

            // highlights
            rptHighlights.DataSource = StorefrontHelper.GetProductHighlights(ecPanelRequest.ResellerId,
                                                                             productInfo.ProductId);
            rptHighlights.DataBind();

            // price
            HostingPlanCycle[] cycles = StorefrontHelper.GetHostingPlanCycles(ecPanelRequest.ResellerId,
                                                                              productInfo.ProductId);
            //
            if (cycles != null && cycles.Length > 0)
            {
                ltrProductPrice.Text = cycles[0].RecurringFee.ToString("C");
            }
        }
        private void SyncDomainOption(int domainOption)
        {
            // check for tlds in stock
            if (!StorefrontHelper.HasTopLevelDomainsInStock(ResellerId))
            {
                ecUtils.ToggleControls(false, pnlTopLevelDomain, chkSelected);
                ecUtils.ToggleControls(true, lclNoTLDsInStock);
                return;
            }

            switch (domainOption)
            {
            case HostingPlan.DOMAIN_OPTIONAL:
                // turn on
                ecUtils.ToggleControls(true, chkSelected, this);
                // turn off
                ecUtils.ToggleControls(false, pnlTopLevelDomain);
                break;

            case HostingPlan.DOMAIN_REQUIRED:
                // turn on
                ecUtils.ToggleControls(true, this, pnlTopLevelDomain);
                // turn off
                ecUtils.ToggleControls(false, chkSelected);
                //
                chkSelected.Checked = false;
                break;

            case HostingPlan.DOMAIN_HIDE:
                // turn off
                ecUtils.ToggleControls(false, this);
                //
                chkSelected.Checked = false;
                break;
            }
        }
Example #13
0
 private void BindPaymentMethods(int resellerId)
 {
     rptPaymentMethods.DataSource = StorefrontHelper.GetResellerPaymentMethods(resellerId);
     rptPaymentMethods.DataBind();
 }
        private void BindData()
        {
            repCatalogPath.DataSource = StorefrontHelper.GetStorefrontPath(ecPanelRequest.CategoryId);

            repCatalogPath.DataBind();
        }
Example #15
0
 public void LoadHostingAddons(int resellerId, int planId)
 {
     rptHostingAddons.DataSource = StorefrontHelper.GetHostingPlanAddons(resellerId, planId);
     rptHostingAddons.DataBind();
 }
 public void LoadHostingPlanCycles(int productId)
 {
     rptPlanCycles.DataSource = StorefrontHelper.GetHostingPlanCycles(ecPanelRequest.ResellerId, productId);
     rptPlanCycles.DataBind();
 }
Example #17
0
 private void BindQuickHostingPlans()
 {
     rptHostingPlans.DataSource = StorefrontHelper.GetStorefrontProductsByType(ecPanelRequest.ResellerId, Product.HOSTING_PLAN);
     rptHostingPlans.DataBind();
 }
Example #18
0
 private void BindPaymentMethods()
 {
     rptPaymentMethods.DataSource = StorefrontHelper.GetResellerPaymentMethods(PanelSecurity.SelectedUserId);
     rptPaymentMethods.DataBind();
 }