private HostingPlanCycle SyncDataEntered() { HostingPlanCycle cycle = new HostingPlanCycle(); cycle.SetupFee = ecUtils.ParseDecimal(txtSetupFee.Text, 0); cycle.RecurringFee = ecUtils.ParseDecimal(txtOneTimeFee.Text, 0); return(cycle); }
private void SyncGridViewDataEntered() { // preserve chose cycles details: setup fee, recurring fee and 2CO id if (PlanBillingCycles.Count > 0) { for (int i = 0; i < gvPlanCycles.Rows.Count; i++) { GridViewRow gv_row = gvPlanCycles.Rows[i]; HostingPlanCycle gv_cycle = PlanBillingCycles[i]; TextBox txtSetupFee = ecUtils.FindControl <TextBox>(gv_row, "txtSetupFee"); TextBox txtRecurringFee = ecUtils.FindControl <TextBox>(gv_row, "txtRecurringFee"); gv_cycle.SetupFee = ecUtils.ParseDecimal(txtSetupFee.Text, 0); gv_cycle.RecurringFee = ecUtils.ParseDecimal(txtRecurringFee.Text, 0); } } }
private void FlipHostingPlanCycles(int indexFrom, bool moveDown) { // last item can't move down if (moveDown && indexFrom == PlanBillingCycles.Count - 1) { return; } // first item can't move up if (!moveDown && indexFrom == 0) { return; } // single item can't move in both directions if (PlanBillingCycles.Count == 1) { return; } // sync data prior SyncGridViewDataEntered(); HostingPlanCycle cycleToMove = PlanBillingCycles[indexFrom]; // remove PlanBillingCycles.RemoveAt(indexFrom); // insert if (moveDown) { PlanBillingCycles.Insert(indexFrom + 1, cycleToMove); } else { PlanBillingCycles.Insert(indexFrom - 1, cycleToMove); } // re-bind data BindHostingPlanCycles(); }
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(); }