/// <summary> /// Update a customer's subscription plan /// </summary> /// <param name="customerCode">The customer's code of the customer to be updated</param> /// <param name="newPlan">The plan to set the customer to</param> /// <returns>A Customer object with the updated changes applied</returns> public static Customer UpdateSubscriptionPlanOnly(string customerCode, PlanCodeEnum newPlan) { Customers customers = new Customers(); Customer updatedCustomer = new Customer(); try { // Create the web request string urlBase = "https://cheddargetter.com/xml"; string urlPath = string.Format("/customers/edit-subscription/productCode/{0}/code/{1}", _ProductCode, customerCode); //note: expiration date must be in MM/YYYY format string postParams = string.Format("planCode={0}", HttpUtility.UrlEncode(newPlan.ToString().ToUpper())); string result = postRequest(urlBase, urlPath, postParams); XDocument newCustomerXML = XDocument.Parse(result); customers = getCustomerList(newCustomerXML); if (customers.CustomerList.Count > 0) { updatedCustomer = customers.CustomerList[0]; } } catch (Exception ex) { throw ex; } return(updatedCustomer); }
protected void MonthlyPremiumButton_Click(object sender, EventArgs e) { try { Boolean tmp = Tick3.Visible; HideAllNativeTicks(); Tick3.Visible = !tmp; if (Tick3.Visible) SelectedPlanCode = PlanCodeEnum.NATIVE_MONTHLY_PREMIUM; System.Diagnostics.Debug.WriteLine("{0}", SelectedPlanCode); } catch (Exception) { throw; } }
/// <summary> /// Update a customer's subscription plan /// </summary> /// <param name="customerCode">The customer's code of the customer to be updated</param> /// <param name="newPlan">The plan to set the customer to</param> /// <returns>A Customer object with the updated changes applied</returns> public static Customer UpdateSubscriptionPlanOnly(string customerCode, PlanCodeEnum newPlan) { Customers customers = new Customers(); Customer updatedCustomer = new Customer(); try { // Create the web request string urlBase = "https://cheddargetter.com/xml"; string urlPath = string.Format("/customers/edit-subscription/productCode/{0}/code/{1}", _ProductCode, customerCode); //note: expiration date must be in MM/YYYY format string postParams = string.Format("planCode={0}", HttpUtility.UrlEncode(newPlan.ToString().ToUpper())); string result = postRequest(urlBase, urlPath, postParams); XDocument newCustomerXML = XDocument.Parse(result); customers = getCustomerList(newCustomerXML); if (customers.CustomerList.Count > 0) { updatedCustomer = customers.CustomerList[0]; } } catch (Exception ex) { throw ex; } return updatedCustomer; }
private void page_refresh() { try { Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID]; Util util = new Util(); USERINFO.Visible = true; HideAllNativeTicks(); HideAllWebTicks(); SelectedPlanCode = 0; RadTabStripNative.SelectedIndex = 0; RadTabStrip1.SelectedIndex = 0; if (State["SelectedAppType"].ToString() == Constants.WEB_APP_TYPE) { RadMultiPageMaster.Visible = true; RadMultiPageMaster.SelectedIndex = 1; RadPageNativeSection.Visible = false; RadPageWebSection.Visible = true; WebPricingMultiPage.SelectedIndex = 0; RadTabStrip1.SelectedIndex = 0; } else { RadMultiPageMaster.Visible = true; RadMultiPageMaster.SelectedIndex = 0; RadPageNativeSection.Visible = true; RadPageWebSection.Visible = false; NativePricingMultiPage.SelectedIndex = 0; RadTabStripNative.SelectedIndex = 0; } if (String.IsNullOrEmpty(AppID) == false) { CGError servererror = new CGError(); Customer customer_details = CheddarGetter.GetCustomer(AppID, servererror); // IF BRANDING WAS DONE THIS SHOULD RETURN FINE if ((String.IsNullOrEmpty(servererror.Code) == true) && (customer_details.Subscriptions[0].SubscriptionsPlans[0].Code.Contains("BRANDING") == false)) { //There is already a NON FREE PLAN for this App USERINFO.Visible = false; RadMultiPageMaster.Visible = false; RadNotification1.Title = "WARNING"; RadNotification1.Text = "This application has already been subscribed to a publishing service"; RadNotification1.Visible = true; RadNotification1.Show(); return; } if (String.Compare(customer_details.Code, AppID, false) == 0) { CompanyTextBox.Text = customer_details.Company; EmailTextBox.Text = customer_details.Email; FirstNameTextBox.Text = customer_details.FirstName; LastNameTextBox.Text = customer_details.LastName; foreach (Subscription s in customer_details.Subscriptions) { CCFirstNameTextbox.Text = s.CCFirstName; CCLastNameTextBox.Text = s.CCLastName; CCZipTextBox.Text = s.CCZip; } } } PreFillBillingFormDetails(); } catch (Exception) { throw; } }
private void HideAllWebTicks() { try { SelectedPlanCode = 0; WTick1.Visible = false; WTick2.Visible = false; WTick3.Visible = false; WTick4.Visible = false; WTick5.Visible = false; WTick6.Visible = false; WTick7.Visible = false; WTick8.Visible = false; WTick9.Visible = false; } catch (Exception) { throw; } }
protected void YearlyProButton_Click(object sender, EventArgs e) { try { Boolean tmp = Tick5.Visible; HideAllNativeTicks(); Tick5.Visible = !tmp; if (Tick5.Visible) SelectedPlanCode = PlanCodeEnum.NATIVE_YEARLY_PRO; System.Diagnostics.Debug.WriteLine("{0}", SelectedPlanCode); } catch (Exception) { throw; } }
protected void WebYearlyPremiumButton_Click(object sender, EventArgs e) { try { Boolean tmp = WTick6.Visible; HideAllWebTicks(); WTick6.Visible = !tmp; if (WTick6.Visible) SelectedPlanCode = PlanCodeEnum.WEB_YEARLY_PREMIUM; System.Diagnostics.Debug.WriteLine("{0}", SelectedPlanCode); } catch (Exception) { throw; } }
protected void WebProMonthlyButton_Click(object sender, EventArgs e) { try { Boolean tmp = WTick2.Visible; HideAllWebTicks(); WTick2.Visible = !tmp; if (WTick2.Visible) SelectedPlanCode = PlanCodeEnum.WEB_MONTHLY_PRO; System.Diagnostics.Debug.WriteLine("{0}", SelectedPlanCode); } catch (Exception) { throw; } }
protected void WebNonProfitBasicButton_Click(object sender, EventArgs e) { try { Boolean tmp = WTick7.Visible; HideAllWebTicks(); WTick7.Visible = !tmp; if (WTick7.Visible) SelectedPlanCode = PlanCodeEnum.WEB_NONPROFIT_BASIC; System.Diagnostics.Debug.WriteLine("{0}", SelectedPlanCode); } catch (Exception) { throw; } }
private void TickAndSelect_CurrentPlan() { try { if ((AppType.Contains("native") || AppType.Contains("hybrid")) && (String.IsNullOrEmpty(AppID) == false)) { CGError servererror = new CGError(); //Get the Native and Web Plan Code for the Customer from CG first. Customer customer_details = CheddarGetter.GetCustomer(AppID, servererror); if (customer_details != null) { //Split the code which is number_NATIVE_MONTHLY_BASIC string[] words = customer_details.Subscriptions[0].SubscriptionsPlans[0].Code.Split(new char[] { '_' }, 3); if (words.Length < 2) return; HideAllNativeTicks(); if (String.Compare("MONTHLY", words[1], true) == 0) { NativePricingMultiPage.SelectedIndex = 0; RadTabStripNative.SelectedIndex = 0; if (String.Compare("BASIC", words[2], true) == 0) { Tick1.Visible = true; SelectedPlanCode = PlanCodeEnum.NATIVE_MONTHLY_BASIC; System.Diagnostics.Debug.WriteLine("NATIVE_MONTHLY_BASIC"); } if (String.Compare("PRO", words[2], true) == 0) { Tick2.Visible = true; SelectedPlanCode = PlanCodeEnum.NATIVE_MONTHLY_PRO; System.Diagnostics.Debug.WriteLine("NATIVE_MONTHLY_PRO"); } if (String.Compare("PREMIUM", words[2], true) == 0) { Tick3.Visible = true; SelectedPlanCode = PlanCodeEnum.NATIVE_MONTHLY_PREMIUM; System.Diagnostics.Debug.WriteLine("NATIVE_MONTHLY_PREMIUM"); } } if (String.Compare("YEARLY", words[1], true) == 0) { NativePricingMultiPage.SelectedIndex = 1; RadTabStripNative.SelectedIndex = 1; if (String.Compare("BASIC", words[2], true) == 0) { Tick4.Visible = true; SelectedPlanCode = PlanCodeEnum.NATIVE_YEARLY_BASIC; System.Diagnostics.Debug.WriteLine("NATIVE_YEARLY_BASIC"); } if (String.Compare("PRO", words[2], true) == 0) { Tick5.Visible = true; SelectedPlanCode = PlanCodeEnum.NATIVE_YEARLY_PRO; System.Diagnostics.Debug.WriteLine("NATIVE_YEARLY_PRO"); } if (String.Compare("PREMIUM", words[2], true) == 0) { Tick6.Visible = true; SelectedPlanCode = PlanCodeEnum.NATIVE_YEARLY_PREMIUM; System.Diagnostics.Debug.WriteLine("NATIVE_YEARLY_PREMIUM"); } } if (String.Compare("NONPROFIT", words[1], true) == 0) { NativePricingMultiPage.SelectedIndex = 2; RadTabStripNative.SelectedIndex = 2; if (String.Compare("BASIC", words[2], true) == 0) { Tick7.Visible = true; SelectedPlanCode = PlanCodeEnum.NATIVE_NONPROFIT_BASIC; System.Diagnostics.Debug.WriteLine("NATIVE_NONPROFIT_BASIC"); } if (String.Compare("PRO", words[2], true) == 0) { Tick8.Visible = true; SelectedPlanCode = PlanCodeEnum.NATIVE_NONPROFIT_PRO; System.Diagnostics.Debug.WriteLine("NATIVE_NONPROFIT_PRO"); } if (String.Compare("PREMIUM", words[2], true) == 0) { Tick9.Visible = true; SelectedPlanCode = PlanCodeEnum.NATIVE_NONPROFIT_PREMIUM; System.Diagnostics.Debug.WriteLine("NATIVE_NONPROFIT_PREMIUM"); } } } //(customer_details != null) } if (AppType.Contains("web") && (String.IsNullOrEmpty(AppID) == false)) { CGError servererror = new CGError(); Customer web_customer_details = CheddarGetter.GetCustomer(AppID, servererror); if (web_customer_details != null) { string[] words = web_customer_details.Subscriptions[0].SubscriptionsPlans[0].Code.Split(new char[] { '_' }, 3); if (words.Length < 2) return; HideAllWebTicks(); if (String.Compare("MONTHLY", words[1], true) == 0) { WebPricingMultiPage.SelectedIndex = 0; RadTabStrip1.SelectedIndex = 0; if (String.Compare("BASIC", words[2], true) == 0) { WTick1.Visible = true; SelectedPlanCode = PlanCodeEnum.WEB_MONTHLY_BASIC; System.Diagnostics.Debug.WriteLine("WEB_MONTHLY_BASIC"); } if (String.Compare("PRO", words[2], true) == 0) { WTick2.Visible = true; SelectedPlanCode = PlanCodeEnum.WEB_MONTHLY_PRO; System.Diagnostics.Debug.WriteLine("WEB_MONTHLY_PRO"); } if (String.Compare("PREMIUM", words[2], true) == 0) { WTick3.Visible = true; SelectedPlanCode = PlanCodeEnum.WEB_MONTHLY_PREMIUM; System.Diagnostics.Debug.WriteLine("WEB_MONTHLY_PREMIUM"); } } if (String.Compare("YEARLY", words[1], true) == 0) { WebPricingMultiPage.SelectedIndex = 1; RadTabStrip1.SelectedIndex = 1; if (String.Compare("BASIC", words[2], true) == 0) { WTick4.Visible = true; SelectedPlanCode = PlanCodeEnum.WEB_YEARLY_BASIC; System.Diagnostics.Debug.WriteLine("WEB_YEARLY_BASIC"); } if (String.Compare("PRO", words[2], true) == 0) { WTick5.Visible = true; SelectedPlanCode = PlanCodeEnum.WEB_YEARLY_PRO; System.Diagnostics.Debug.WriteLine("WEB_YEARLY_PRO"); } if (String.Compare("PREMIUM", words[2], true) == 0) { WTick6.Visible = true; SelectedPlanCode = PlanCodeEnum.WEB_YEARLY_PREMIUM; System.Diagnostics.Debug.WriteLine("WEB_YEARLY_PREMIUM"); } } if (String.Compare("NONPROFIT", words[1], true) == 0) { WebPricingMultiPage.SelectedIndex = 2; RadTabStrip1.SelectedIndex = 2; if (String.Compare("BASIC", words[2], true) == 0) { WTick7.Visible = true; SelectedPlanCode = PlanCodeEnum.WEB_NONPROFIT_BASIC; System.Diagnostics.Debug.WriteLine("WEB_NONPROFIT_BASIC"); } if (String.Compare("PRO", words[2], true) == 0) { WTick8.Visible = true; SelectedPlanCode = PlanCodeEnum.WEB_NONPROFIT_PRO; System.Diagnostics.Debug.WriteLine("WEB_NONPROFIT_PRO"); } if (String.Compare("PREMIUM", words[2], true) == 0) { WTick9.Visible = true; SelectedPlanCode = PlanCodeEnum.WEB_NONPROFIT_PREMIUM; System.Diagnostics.Debug.WriteLine("WEB_NONPROFIT_PREM"); } } } } } catch (Exception) { throw; } }