protected void RemoveCustomer_Click(object sender, EventArgs e) { Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID]; string customer_id = State["ServerAdminCustomerID"].ToString(); if (customer_id == "0") { AdminMessage.Text = "Select a customer and try again."; return; } string sql = "SELECT status,username FROM customers WHERE customer_id='" + customer_id + "'"; DB db = new DB(); DataRow[] rows = db.ViziAppsExecuteSql(State, sql); DataRow row = rows[0]; string status = row["status"].ToString(); string username = row["username"].ToString(); if (status != "inactive") { AdminMessage.Text = "Customer can only be removed after it has been deactivated."; } else { DoRemoveCustomer(username, customer_id); AdminMessage.Text = "Customer has been removed."; HideForCustomers(); Init init = new Init(); init.InitApplicationCustomers(State); CustomerStatus.Text = ""; } db.CloseViziAppsDatabase(State); CustomersByAccount.Items[0].Selected = true; CustomersByEmail.Items[0].Selected = true; HideForApplications(); }
protected void Page_Load(object sender, EventArgs e) { Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID]; Util util = new Util(); if (util.CheckSessionTimeout(State, Response, "Default.aspx")) return; State["CustomersByAccount"] = CustomersByAccount; State["CustomersByEmail"] = CustomersByEmail; if (!IsPostBack) { if (State["Password"] == null) { Response.Redirect("Default.aspx", false); return; } string status = util.LoginToViziApps(State, State["Username"].ToString(), State["Password"].ToString()); if (status != "admin") { Response.Redirect("Default.aspx", false); return; } ClearMessages(); try { if ( State["ServerAdminCustomerID"] == null || State["ServerAdminCustomerID"].ToString() == "0") { State["ServerAdminCustomerID"] = "0"; Init init = new Init(); init.InitApplicationCustomers(State); } if (!Page.IsPostBack) { ViewUserProfile.Attributes.Add("onclick", PopupHelper.GeneratePopupScript( "Dialogs/Admin/ViewUserProfile.aspx", 750, 750, true, true, true, true)); // ViewAllCustomers.Attributes.Add("onclick", PopupHelper.GeneratePopupScript( // "Dialogs/Admin/ViewAllCustomers.aspx", 10, 10, true, true, true, true)); ViewActiveCustomers.Attributes.Add("onclick", PopupHelper.GeneratePopupScript( "Dialogs/Admin/ViewActiveCustomers.aspx", 120, 550, true, true, true, true)); ViewCurrentUsers.Attributes.Add("onclick", PopupHelper.GeneratePopupScript( "Dialogs/Admin/ViewCurrentUsers.aspx", 480, 500, true, true, true, true)); this.EmailCustomers.Attributes.Add("onclick", PopupHelper.GeneratePopupScript( "Dialogs/Admin/AdminEmail.aspx", 900, 800, true, true, true, true)); ShowXmlDesign.Attributes.Add("onclick", PopupHelper.GeneratePopupScript( "Dialogs/Admin/ShowXmlDesign.aspx", 750, 750, true, true, true, true)); HideForCustomers(); } } catch (Exception ex) { util.ProcessMainExceptions(State, Response, ex); } } }