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(); }