// Modified from original viziapps code with the Additional Branded check so only valid ones are added to the ComboBox. private bool InitAppsList(Hashtable State, RadComboBox AppsList) { Util util = new Util(); BillingUtil billingutil = new BillingUtil(); try { if (AppsList == null) return false; //string sql = "SELECT DISTINCT application_name FROM applications WHERE customer_id='" + State["CustomerID"].ToString() + "' ORDER BY application_name"; string sql = "SELECT DISTINCT application_name,application_type FROM applications WHERE customer_id='" + State["CustomerID"].ToString() + "' ORDER BY application_name"; DB db = new DB(); DataRow[] rows = db.ViziAppsExecuteSql(State, sql); AppsList.Items.Clear(); foreach (DataRow row in rows) { string app_name = row["application_name"].ToString(); string app_type = row["application_type"].ToString(); //For native-hybrid apps do the branded check here inserting only Apps that have paid for branding. if (app_type.Contains("native") || app_type.Contains("hybrid")) { //Inserting only Apps which meet all these criteria. if ((billingutil.IsAppStoreSubmissionPaid(State, app_name) == true) && // + Submitted for App preparation. (billingutil.IsAppPaid(State, app_name) == false)) // + not yet paid for any service { AppsList.Items.Add(new RadComboBoxItem(app_name, app_name)); } } else { //Inserting only Apps which meet all these criteria. if (billingutil.IsAppPaid(State, app_name) == false) // not yet paid for any service AppsList.Items.Add(new RadComboBoxItem(app_name, app_name)); } } if (AppsList.IsEmpty) return false; AppsList.Items.Insert(0, new RadComboBoxItem("Select App ->", "Select App ->")); AppsList.Items[0].Selected = true; return true; } catch (Exception ex) { util.ProcessMainExceptions(State, Response, ex); } return false; }
// Modified from original viziapps code with the additional checks so only valid ones are added to the ComboBox. private bool InitAppsList(Hashtable State, RadComboBox AppsList) { Util util = new Util(); try { if (AppsList == null) return false; // string sql = "SELECT DISTINCT application_name FROM applications WHERE customer_id='" + State["CustomerID"].ToString() + "' ORDER BY application_name"; //Get only native Apps to load onto this ComboBox. string sql = "SELECT DISTINCT application_name,application_id FROM applications WHERE customer_id='" + State["CustomerID"].ToString() + "' AND application_type <> 'web'" + " ORDER BY application_name"; DB db = new DB(); DataRow[] rows = db.ViziAppsExecuteSql(State, sql); AppsList.Items.Clear(); foreach (DataRow row in rows) { string app_name = row["application_name"].ToString(); string application_id = row["application_id"].ToString(); BillingUtil billingutil = new BillingUtil(); //Inserting only Apps which meet all these criteria. if ((billingutil.IsAppStoreSubmissionPaid(State, app_name) == false) && // + never submitted for App preparation as yet. (billingutil.IsAppPaid(State, app_name) == false) && // + not yet paid for anything (util.IsFreeProductionValid(State, application_id) == true) && // + completed the Production Form Submission (billingutil.IsAppCancelled(State, app_name) == false)) // + never cancelled any service. { AppsList.Items.Add(new RadComboBoxItem(app_name, app_name)); } } if (AppsList.IsEmpty) return false; AppsList.Items.Insert(0, new RadComboBoxItem("Select App ->", "Select App ->")); AppsList.Items[0].Selected = true; return true; } catch (Exception ex) { util.ProcessMainExceptions(State, Response, ex); } return false; }
private void CG_CreateCustomer() { try { //Create a new customer CustomerPost newCustomer = new CustomerPost(); newCustomer.Company = CompanyTextBox.Text; newCustomer.FirstName = FirstNameTextBox.Text; newCustomer.LastName = LastNameTextBox.Text; newCustomer.Email = EmailTextBox.Text; //Extra fields required for nonFREE plans newCustomer.CCFirstName = CCFirstNameTextbox.Text; newCustomer.CCLastName = CCLastNameTextBox.Text; newCustomer.CCNumber = CCNumberTextBox.Text; newCustomer.CCExpiration = CCExpirationTextBox.Text; newCustomer.CCZip = CCZipTextBox.Text; newCustomer.CCCardCode = CCCardCodeTextBox.Text; if (SelectedPlanCode != 0) { newCustomer.PlanCode = SelectedPlanCode; newCustomer.Code = AppID; //Send it to the server CGError servererror = new CGError(); Customer returnCustomer = CheddarGetter.CreateCustomer(newCustomer, servererror); //FAILURE if (String.IsNullOrEmpty(servererror.Code) == false) { //CG.InnerHtml += "<li>ERROR:" + servererror.Message; RadNotification1.Title = "WARNING"; RadNotification1.Text = servererror.Message; RadNotification1.Visible = true; RadNotification1.Show(); string clickHandler = "this.disabled = false; this.value=\'Submit\'; "; SubmitButton.Attributes.Add("onclick", clickHandler); return; } //SUCCESS if (String.IsNullOrEmpty(returnCustomer.Code) == false) { AppCGCustomerCode = returnCustomer.Code; CGResponseFlag.Text = AppCGCustomerCode; Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID]; //If the App was submitted to a store [native & hybrid] then just update the paid_services table entry with status to paid. //If not [web apps] create a new entry in paid_services and update status to paid. String app_name = State["SelectedApp"].ToString(); BillingUtil billingutil = new BillingUtil(); if (billingutil.IsAppStoreSubmissionPaid(State, app_name)) { string confirm = returnCustomer.Subscriptions[0].Invoices[1].PaidTransactionId.ToString(); string sku = returnCustomer.Subscriptions[0].SubscriptionsPlans[0].Code.ToString(); billingutil.UpdatePaidServicesDB(confirm,sku, State); } else { string confirm = returnCustomer.Subscriptions[0].Invoices[1].PaidTransactionId.ToString(); string sku = returnCustomer.Subscriptions[0].SubscriptionsPlans[0].Code.ToString(); billingutil.StorePaidServicesDB(confirm, sku, State, true); } } } }//end try catch (Exception ex) { System.Diagnostics.Debug.WriteLine(ex.Message.ToString()); throw; } }