Ejemplo n.º 1
0
        public bool LoadServiceInfo(int serviceId)
        {
            EnsureChildControls();

            try
            {
                // load hosting package svc
                HostingPackageSvc packageSvc = StorehouseHelper.GetHostingPackageService(serviceId);
                if (packageSvc == null)
                {
                    RedirectToBrowsePage();
                }
                //
                ecUtils.ToggleControls(PanelSecurity.LoggedUser.Role != UserRole.User, pnlUsername);
                //
                ltrServiceName.Text     = packageSvc.ServiceName;
                ltrUsername.Text        = packageSvc.Username;
                ltrServiceTypeName.Text = ecPanelFormatter.GetSvcItemTypeName(packageSvc.TypeId);
                ltrSvcCycleName.Text    = packageSvc.CycleName;
                ltrSvcCyclePeriod.Text  = String.Concat(packageSvc.PeriodLength, " ", packageSvc.BillingPeriod, "(s)");
                ltrSvcSetupFee.Text     = String.Concat(packageSvc.Currency, " ", packageSvc.SetupFee.ToString("C"));
                ltrSvcRecurringFee.Text = String.Concat(packageSvc.Currency, " ", packageSvc.RecurringFee.ToString("C"));
                ltrSvcCreated.Text      = packageSvc.Created.ToString();
                ltrServiceStatus.Text   = ecPanelFormatter.GetServiceStatusName(packageSvc.Status);
            }
            catch (Exception ex)
            {
                HostModule.ShowErrorMessage("LOAD_HOSTING_PACKAGE_SVC", ex);
                return(false);
            }

            return(true);
        }
        private void LoadHostingAddonsAvailable()
        {
            HostingPlansHelper plans = new HostingPlansHelper();

            string[] addonsTaken = Array.ConvertAll <int, string>(
                StorehouseHelper.GetHostingAddonsTaken(),
                new Converter <int, string>(Convert.ToString)
                );

            DataSet ds = plans.GetRawHostingAddons();

            // check empty dataset
            if (ds != null && ds.Tables.Count > 0)
            {
                // apply filter only if necessary
                if (addonsTaken.Length > 0)
                {
                    // apply filter for plans already created
                    ds.Tables[0].DefaultView.RowFilter = "PlanID NOT IN (" + String.Join(",", addonsTaken) + ")";
                }

                // bind default view
                ddlHostingPlans.DataSource = ds.Tables[0].DefaultView;
                ddlHostingPlans.DataBind();
            }
        }
Ejemplo n.º 3
0
        private void BindAvailableProducts()
        {
            dlProductAddons.DataSource = StorehouseHelper.GetProductsByType(1);
            dlProductAddons.DataBind();

            dataSourceBinded = true;
        }
 public void LoadCustomerInvoiceTemplate(int invoiceId)
 {
     try
     {
         //
         string invoiceTemplate = StorehouseHelper.GetCustomerInvoiceFormatted(invoiceId);
         //
         ShowCustomerInvoice(invoiceTemplate);
     }
     catch (Exception ex)
     {
         HostModule.ShowErrorMessage("LOAD_CUSTOMER_INVOICE", ex);
     }
 }
        public void BindServiceHistory(int serviceId)
        {
            // load hosting addon svc
            HostingAddonSvc addonSvc = StorehouseHelper.GetHostingAddonService(serviceId);

            //
            ecUtils.ToggleControls(addonSvc.Recurring, pnlAddonSvcHistory);
            //
            if (addonSvc.Recurring)
            {
                gvServiceHistory.DataSource = StorehouseHelper.GetServiceHistory(serviceId);
                gvServiceHistory.DataBind();
            }
        }
 private void LoadHostingAddonData()
 {
     // toggle controls
     ecUtils.ToggleControls(!EditingAddon.DummyAddon, ddlHostingPlans);
     ecUtils.ToggleControls(EditingAddon.DummyAddon, txtAddonName);
     chkTaxInclusive.Checked = EditingAddon.TaxInclusive;
     //
     reqAddonName.ControlToValidate = EditingAddon.DummyAddon ? "txtAddonName" : "ddlHostingPlans";
     //
     if (EditingAddon.DummyAddon)
     {
         txtAddonName.Text = EditingAddon.ProductName;
     }
     else
     {
         ecUtils.SelectListItem(ddlHostingPlans, EditingAddon.PlanId);
     }
     //
     txtProductSku.Text = EditingAddon.ProductSku;
     //
     txtHostingAddonDesc.Text = EditingAddon.Description;
     //
     rblAddonStatus.SelectedIndex = (EditingAddon.Enabled) ? 0 : 1;
     //
     rblRecurringAddon.SelectedIndex = (EditingAddon.Recurring) ? 0 : 1;
     //
     rblDummyAddon.SelectedIndex = (EditingAddon.DummyAddon) ? 0 : 1;
     //
     rblShowQuantity.SelectedIndex = (EditingAddon.Countable) ? 0 : 1;
     //
     ctlPlanCycles.Visible = EditingAddon.Recurring;
     ctlOneTimeFee.Visible = !EditingAddon.Recurring;
     //
     if (EditingAddon.Recurring)
     {
         ctlPlanCycles.LoadHostingPlanCycles(
             StorehouseHelper.GetHostingAddonCycles(ecPanelRequest.ProductId));
     }
     else
     {
         ctlOneTimeFee.SyncDataAssigned(EditingAddon.SetupFee, EditingAddon.OneTimeFee);
     }
     //
     ctlAssignedProds.AssignedProducts = StorehouseHelper.GetAddonProductsIds(
         ecPanelRequest.ProductId);
 }
        public bool LoadServiceInfo(int serviceId)
        {
            EnsureChildControls();

            try
            {
                // load hosting addon svc
                HostingAddonSvc addonSvc = StorehouseHelper.GetHostingAddonService(serviceId);
                if (addonSvc == null)
                {
                    RedirectToBrowsePage();
                }
                //
                ecUtils.ToggleControls(addonSvc.Recurring, pnlRecurringAddon);
                ecUtils.ToggleControls(!addonSvc.Recurring, pnlOneTimeAddon);
                ecUtils.ToggleControls(PanelSecurity.LoggedUser.Role != UserRole.User, pnlUsername);

                ltrServiceName.Text     = addonSvc.ServiceName;
                ltrUsername.Text        = addonSvc.Username;
                ltrServiceTypeName.Text = ecPanelFormatter.GetSvcItemTypeName(addonSvc.TypeId);
                ltrSvcSetupFee.Text     = String.Concat(addonSvc.Currency, " ", addonSvc.SetupFee.ToString("C"));
                ltrSvcCreated.Text      = addonSvc.Created.ToString();
                ltrServiceStatus.Text   = ecPanelFormatter.GetServiceStatusName(addonSvc.Status);

                if (addonSvc.Recurring)
                {
                    ltrSvcCycleName.Text    = addonSvc.CycleName;
                    ltrSvcCyclePeriod.Text  = String.Concat(addonSvc.PeriodLength, " ", addonSvc.BillingPeriod, "(s)");
                    ltrSvcRecurringFee.Text = String.Concat(addonSvc.Currency, " ", addonSvc.CyclePrice.ToString("C"));
                }
                else
                {
                    ltrAddonSvcPrice.Text = String.Concat(addonSvc.Currency, " ", addonSvc.CyclePrice.ToString("C"));
                }
            }
            catch (Exception ex)
            {
                HostModule.ShowErrorMessage("LOAD_DOMAIN_NAME_SVC", ex);
                return(false);
            }

            return(true);
        }
        private void DeleteHostingAddon()
        {
            try
            {
                int result = StorehouseHelper.DeleteProduct(ecPanelRequest.ProductId);

                if (result < 0)
                {
                    ShowResultMessage(result);
                    return;
                }
            }
            catch (Exception ex)
            {
                ShowErrorMessage("HOSTING_ADDON_DELETE", ex);
                return;
            }

            RedirectToBrowsePage();
        }
        public bool LoadServiceInfo(int serviceId)
        {
            EnsureChildControls();

            try
            {
                // load domain name svc
                DomainNameSvc domainSvc = StorehouseHelper.GetDomainNameService(serviceId);
                if (domainSvc == null)
                {
                    RedirectToBrowsePage();
                }
                //
                ecUtils.ToggleControls(PanelSecurity.LoggedUser.Role != UserRole.User, pnlDomainOrder, pnlUsername);
                //
                ltrServiceName.Text     = domainSvc.ServiceName;
                ltrUsername.Text        = domainSvc.Username;
                ltrServiceTypeName.Text = ecPanelFormatter.GetSvcItemTypeName(domainSvc.TypeId);
                ltrSvcCycleName.Text    = domainSvc.CycleName;
                ltrSvcCyclePeriod.Text  = String.Concat(domainSvc.PeriodLength, " ", domainSvc.BillingPeriod, "(s)");
                ltrSvcSetupFee.Text     = String.Concat(domainSvc.Currency, " ", domainSvc.SetupFee.ToString("C"));
                ltrSvcRecurringFee.Text = String.Concat(domainSvc.Currency, " ", domainSvc.RecurringFee.ToString("C"));
                ltrSvcCreated.Text      = domainSvc.Created.ToString();
                ltrServiceStatus.Text   = ecPanelFormatter.GetServiceStatusName(domainSvc.Status);
                //
                if (pnlDomainOrder.Visible)
                {
                    //ltrSvcRegOrderId.Text = domainSvc.RegOrderId;
                    ltrSvcProviderName.Text = domainSvc.ProviderName;
                }
            }
            catch (Exception ex)
            {
                HostModule.ShowErrorMessage("LOAD_DOMAIN_NAME_SVC", ex);
                return(false);
            }

            return(true);
        }
Ejemplo n.º 10
0
        private void LoadBillingCyclesDDL()
        {
            int cyclesCount = PlanBillingCycles.Count;

            // load taken cycles
            int[] cyclesTaken = new int[cyclesCount];
            // build array
            for (int i = 0; i < cyclesCount; i++)
            {
                cyclesTaken[i] = PlanBillingCycles[i].CycleId;
            }

            // bind loaded cycles
            BillingCycle[] cyclesToBind = StorehouseHelper.GetBillingCyclesFree(cyclesTaken);
            // show button while at least one cycle available
            phBillingCycles.Visible = (cyclesToBind.Length > 0);
            // bind cycles
            if (cyclesToBind.Length > 0)
            {
                ddlBillingCycles.DataSource = cyclesToBind;
                ddlBillingCycles.DataBind();
            }
        }
Ejemplo n.º 11
0
        private void AddBillingCycleToHostingPlan()
        {
            // sync entered data prior
            SyncGridViewDataEntered();

            // load selected billing cycle
            BillingCycle chosenCycle = StorehouseHelper.GetBillingCycle(Convert.ToInt32(ddlBillingCycles.SelectedValue));
            // convert billing to hosting plan
            HostingPlanCycle cycle = new HostingPlanCycle();

            // fill fields
            cycle.CycleId       = chosenCycle.CycleId;
            cycle.CycleName     = chosenCycle.CycleName;
            cycle.BillingPeriod = chosenCycle.BillingPeriod;
            cycle.PeriodLength  = chosenCycle.PeriodLength;
            // put into viewstate
            PlanBillingCycles.Add(cycle);

            // bind new plan cycles
            BindHostingPlanCycles();

            // re-load billing cycles
            LoadBillingCyclesDDL();
        }
        private void SaveHostingAddon()
        {
            if (!Page.IsValid)
            {
                return;
            }

            try
            {
                string addonName    = (ddlHostingPlans.Visible) ? ddlHostingPlans.SelectedItem.Text : txtAddonName.Text.Trim();
                string productSku   = txtProductSku.Text.Trim();
                string description  = txtHostingAddonDesc.Text.Trim();
                bool   taxInclusive = chkTaxInclusive.Checked;

                bool enabled      = Convert.ToBoolean(rblAddonStatus.SelectedValue);
                bool recurring    = Convert.ToBoolean(rblRecurringAddon.SelectedValue);
                bool dummyAddon   = Convert.ToBoolean(rblDummyAddon.SelectedValue);
                bool showQuantity = Convert.ToBoolean(rblShowQuantity.SelectedValue);
                //
                int planId = 0;
                // only non-dummy addons can have WebsitePanel addon assigned
                if (!dummyAddon)
                {
                    planId = Convert.ToInt32(ddlHostingPlans.SelectedValue);
                }

                HostingPlanCycle[] addonCycles = null;
                if (recurring)
                {
                    addonCycles = ctlPlanCycles.GetHostingPlanCycles();
                }
                else
                {
                    addonCycles = new HostingPlanCycle[] { ctlOneTimeFee.OneTimeFee }
                };

                int[] addonProducts = ctlAssignedProds.AssignedProducts;

                // create hosting plan
                int result = StorehouseHelper.AddHostingAddon(
                    addonName,
                    productSku,
                    taxInclusive,
                    planId,
                    recurring,
                    dummyAddon,
                    showQuantity,
                    enabled,
                    description,
                    addonCycles,
                    addonProducts
                    );

                if (result <= 0)
                {
                    ShowResultMessage(result);
                    return;
                }
            }
            catch (Exception ex)
            {
                ShowErrorMessage("HOSTING_ADDON_SAVE", ex);
                return;
            }

            RedirectToBrowsePage();
        }
 private object GetHostingAddon()
 {
     return(StorehouseHelper.GetHostingAddon(ecPanelRequest.ProductId));
 }
 public void BindServiceHistory(int serviceId)
 {
     gvServiceHistory.DataSource = StorehouseHelper.GetServiceHistory(serviceId);
     gvServiceHistory.DataBind();
 }