private HostingPlanCycle SyncDataEntered()
		{
			HostingPlanCycle cycle = new HostingPlanCycle();
			cycle.SetupFee = ecUtils.ParseDecimal(txtSetupFee.Text, 0);
			cycle.RecurringFee = ecUtils.ParseDecimal(txtOneTimeFee.Text, 0);

			return cycle;
		}
        public static int UpdateHostingPlan(int userId, int productId, string planName, string productSku, bool taxInclusive, int planId,
            int userRole, int initialStatus, int domainOption, bool enabled, string planDescription, HostingPlanCycle[] planCycles,
            string[] planHighlights, int[] planCategories)
        {
            SecurityResult result = CheckAccountNotDemoAndActive();
            if (!result.Success)
                return result.ResultCode;

            XmlDocument xmldoc = new XmlDocument();
            // build plan cycles
            XmlElement pc_root = xmldoc.CreateElement("PlanCycles");
            for (int i = 0; i < planCycles.Length; i++)
            {
                XmlElement elem = xmldoc.CreateElement("Cycle");
                elem.SetAttribute("ID", planCycles[i].CycleId.ToString());
                elem.SetAttribute("SetupFee", planCycles[i].SetupFee.ToString());
                elem.SetAttribute("RecurringFee", planCycles[i].RecurringFee.ToString());
                elem.SetAttribute("SortOrder", i.ToString());
                pc_root.AppendChild(elem);
            }
            // build plan highlights
            XmlElement hl_root = xmldoc.CreateElement("PlanHighlights");
            for (int i = 0; i < planHighlights.Length; i++)
            {
                XmlElement elem = xmldoc.CreateElement("Item");
                elem.SetAttribute("Text", planHighlights[i]);
                elem.SetAttribute("SortOrder", i.ToString());
                hl_root.AppendChild(elem);
            }
            // build plan categories
            XmlElement ct_root = xmldoc.CreateElement("PlanCategories");
            foreach (int categoryId in planCategories)
            {
                XmlElement elem = xmldoc.CreateElement("Category");
                elem.SetAttribute("ID", categoryId.ToString());
                ct_root.AppendChild(elem);
            }
            // add hosting plan
            return EcommerceProvider.UpdateHostingPlan(
                SecurityContext.User.UserId,
                userId,
                productId,
                planName,
                productSku,
                taxInclusive,
                planId,
                userRole,
                initialStatus,
                domainOption,
                enabled,
                planDescription,
                pc_root.OuterXml,
                hl_root.OuterXml,
                ct_root.OuterXml
            );
        }
        public static int UpdateHostingAddon(int userId, int addonId, string addonName, string productSku, bool taxInclusive, int planId,
            bool recurring, bool dummyAddon, bool countable, bool enabled, string description, HostingPlanCycle[] addonCycles,
            int[] addonProducts)
        {
            SecurityResult result = CheckAccountNotDemoAndActive();
            if (!result.Success)
                return result.ResultCode;

            XmlDocument xmldoc = new XmlDocument();
            // build addon cycles
            XmlElement pc_root = xmldoc.CreateElement("PlanCycles");
            for (int i = 0; i < addonCycles.Length; i++)
            {
                XmlElement elem = xmldoc.CreateElement("Cycle");
                elem.SetAttribute("ID", addonCycles[i].CycleId.ToString());
                elem.SetAttribute("SetupFee", addonCycles[i].SetupFee.ToString());
                elem.SetAttribute("RecurringFee", addonCycles[i].RecurringFee.ToString());
                elem.SetAttribute("SortOrder", i.ToString());
                pc_root.AppendChild(elem);
            }
            // build plan categories
            XmlElement ap_root = xmldoc.CreateElement("AssignedProducts");
            foreach (int productId in addonProducts)
            {
                XmlElement elem = xmldoc.CreateElement("Product");
                elem.SetAttribute("ID", productId.ToString());
                ap_root.AppendChild(elem);
            }
            // add hosting addon
            return EcommerceProvider.UpdateHostingAddon(
                SecurityContext.User.UserId,
                userId,
                addonId,
                addonName,
                productSku,
                taxInclusive,
                enabled,
                planId,
                recurring,
                dummyAddon,
                countable,
                description,
                pc_root.OuterXml,
                ap_root.OuterXml
            );
        }
 public int AddHostingPlan(int userId, string planName, string productSku, bool taxInclusive, int planId, int userRole, int initialStatus, int domainOption, bool enabled, string planDescription, HostingPlanCycle[] planCycles, string[] planHighlights, int[] planCategories) {
     object[] results = this.Invoke("AddHostingPlan", new object[] {
                 userId,
                 planName,
                 productSku,
                 taxInclusive,
                 planId,
                 userRole,
                 initialStatus,
                 domainOption,
                 enabled,
                 planDescription,
                 planCycles,
                 planHighlights,
                 planCategories});
     return ((int)(results[0]));
 }
		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;
				//
				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.UpdateHostingAddon(
					ecPanelRequest.ProductId,
					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();
		}
		public int UpdateHostingAddon(int userId, int productId, string addonName, string productSku, bool taxInclusive, int planId,
			bool recurring, bool dummyAddon, bool countable, bool enabled, string description, HostingPlanCycle[] addonCycles, int[] addonProducts)
		{
			return StorehouseController.UpdateHostingAddon(userId, productId, addonName, productSku, taxInclusive, planId,
				recurring, dummyAddon, countable, enabled, description, addonCycles, addonProducts);
		}
 /// <remarks/>
 public void UpdateHostingAddonAsync(int userId, int productId, string addonName, string productSku, bool taxInclusive, int planId, bool recurring, bool dummyAddon, bool countable, bool enabled, string description, HostingPlanCycle[] addonCycles, int[] addonProducts, object userState) {
     if ((this.UpdateHostingAddonOperationCompleted == null)) {
         this.UpdateHostingAddonOperationCompleted = new System.Threading.SendOrPostCallback(this.OnUpdateHostingAddonOperationCompleted);
     }
     this.InvokeAsync("UpdateHostingAddon", new object[] {
                 userId,
                 productId,
                 addonName,
                 productSku,
                 taxInclusive,
                 planId,
                 recurring,
                 dummyAddon,
                 countable,
                 enabled,
                 description,
                 addonCycles,
                 addonProducts}, this.UpdateHostingAddonOperationCompleted, userState);
 }
 public int UpdateHostingAddon(int userId, int productId, string addonName, string productSku, bool taxInclusive, int planId, bool recurring, bool dummyAddon, bool countable, bool enabled, string description, HostingPlanCycle[] addonCycles, int[] addonProducts) {
     object[] results = this.Invoke("UpdateHostingAddon", new object[] {
                 userId,
                 productId,
                 addonName,
                 productSku,
                 taxInclusive,
                 planId,
                 recurring,
                 dummyAddon,
                 countable,
                 enabled,
                 description,
                 addonCycles,
                 addonProducts});
     return ((int)(results[0]));
 }
 /// <remarks/>
 public System.IAsyncResult BeginUpdateHostingAddon(int userId, int productId, string addonName, string productSku, bool taxInclusive, int planId, bool recurring, bool dummyAddon, bool countable, bool enabled, string description, HostingPlanCycle[] addonCycles, int[] addonProducts, System.AsyncCallback callback, object asyncState) {
     return this.BeginInvoke("UpdateHostingAddon", new object[] {
                 userId,
                 productId,
                 addonName,
                 productSku,
                 taxInclusive,
                 planId,
                 recurring,
                 dummyAddon,
                 countable,
                 enabled,
                 description,
                 addonCycles,
                 addonProducts}, callback, asyncState);
 }
 /// <remarks/>
 public void UpdateHostingPlanAsync(int userId, int productId, string planName, string productSku, bool taxInclusive, int planId, int userRole, int initialStatus, int domainOption, bool enabled, string planDescription, HostingPlanCycle[] planCycles, string[] planHighlights, int[] planCategories) {
     this.UpdateHostingPlanAsync(userId, productId, planName, productSku, taxInclusive, planId, userRole, initialStatus, domainOption, enabled, planDescription, planCycles, planHighlights, planCategories, null);
 }
 /// <remarks/>
 public void UpdateHostingPlanAsync(int userId, int productId, string planName, string productSku, bool taxInclusive, int planId, int userRole, int initialStatus, int domainOption, bool enabled, string planDescription, HostingPlanCycle[] planCycles, string[] planHighlights, int[] planCategories, object userState) {
     if ((this.UpdateHostingPlanOperationCompleted == null)) {
         this.UpdateHostingPlanOperationCompleted = new System.Threading.SendOrPostCallback(this.OnUpdateHostingPlanOperationCompleted);
     }
     this.InvokeAsync("UpdateHostingPlan", new object[] {
                 userId,
                 productId,
                 planName,
                 productSku,
                 taxInclusive,
                 planId,
                 userRole,
                 initialStatus,
                 domainOption,
                 enabled,
                 planDescription,
                 planCycles,
                 planHighlights,
                 planCategories}, this.UpdateHostingPlanOperationCompleted, userState);
 }
 /// <remarks/>
 public System.IAsyncResult BeginUpdateHostingPlan(
             int userId, 
             int productId, 
             string planName, 
             string productSku, 
             bool taxInclusive, 
             int planId, 
             int userRole, 
             int initialStatus, 
             int domainOption, 
             bool enabled, 
             string planDescription, 
             HostingPlanCycle[] planCycles, 
             string[] planHighlights, 
             int[] planCategories, 
             System.AsyncCallback callback, 
             object asyncState) {
     return this.BeginInvoke("UpdateHostingPlan", new object[] {
                 userId,
                 productId,
                 planName,
                 productSku,
                 taxInclusive,
                 planId,
                 userRole,
                 initialStatus,
                 domainOption,
                 enabled,
                 planDescription,
                 planCycles,
                 planHighlights,
                 planCategories}, callback, asyncState);
 }
Example #13
0
        public static int UpdateHostingAddon(int productId, string addonName, string productSku, bool taxInclusive, int planId, bool recurring,
			bool dummyAddon, bool countable, bool enabled, string description, HostingPlanCycle[] addonCycles, int[] addonProducts)
		{
			return EC.Services.Storehouse.UpdateHostingAddon(PanelSecurity.SelectedUserId, productId, addonName, productSku,
				taxInclusive, planId, recurring, dummyAddon, countable, enabled, description, addonCycles, addonProducts);
		}
Example #14
0
        public static int UpdateHostingPlan(int productId, string planName, string productSku, bool taxInclusive,
			int planId, int userRole, int initialStatus, int domainOption, bool enabled, string planDescription, 
			HostingPlanCycle[] planCycles, string[] planHighlights, int[] planCategories)
		{
			return EC.Services.Storehouse.UpdateHostingPlan(
				PanelSecurity.SelectedUserId,
				productId,
				planName,
				productSku,
                taxInclusive,
				planId,
				userRole,
				initialStatus,
				domainOption,
				enabled,
				planDescription,
				planCycles,
				planHighlights,
				planCategories
			);
		}
		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();
		}
 /// <remarks/>
 public void UpdateHostingAddonAsync(int userId, int productId, string addonName, string productSku, bool taxInclusive, int planId, bool recurring, bool dummyAddon, bool countable, bool enabled, string description, HostingPlanCycle[] addonCycles, int[] addonProducts) {
     this.UpdateHostingAddonAsync(userId, productId, addonName, productSku, taxInclusive, planId, recurring, dummyAddon, countable, enabled, description, addonCycles, addonProducts, null);
 }
		public void LoadHostingPlanCycles(HostingPlanCycle[] cycles)
		{
			// convert
			List<HostingPlanCycle> data = new List<HostingPlanCycle>();
			for (int i = 0; i < cycles.Length; i++)
				data.Add(cycles[i]);
			// save
			ViewState[VIEWSTATE_KEY] = data;
			// bind cycles
			BindHostingPlanCycles();
		}
		public int UpdateHostingPlan(int userId, int productId, string planName, string productSku, bool taxInclusive, int planId,
			int userRole, int initialStatus, int domainOption, bool enabled, string planDescription, HostingPlanCycle[] planCycles,
			string[] planHighlights, int[] planCategories)
		{
			return StorehouseController.UpdateHostingPlan(userId, productId, planName, productSku, taxInclusive, planId,
				userRole, initialStatus, domainOption, enabled, planDescription, planCycles, 
				planHighlights, planCategories);
		}