public XmlDocument GetAppXmlForAdmin(Hashtable State)
 {
     XmlDocument doc = new XmlDocument();
     DB db = new DB();
     StringBuilder b_sql = new StringBuilder();
     b_sql.Append("SELECT  staging_app_xml FROM applications ");
     b_sql.Append("WHERE application_name='" + State["SelectedAdminApp"].ToString() + "'");
     b_sql.Append(" AND customer_id='" + State["ServerAdminCustomerID"].ToString() + "'");
     DataRow[] rows = db.ViziAppsExecuteSql(State, b_sql.ToString());
     DataRow row = rows[0];
     if (row["staging_app_xml"] == DBNull.Value || row["staging_app_xml"] == null)
     {
         State["AppXmlDoc"] = null;
         return null;
     }
     string xml = row["staging_app_xml"].ToString();
     Util util = new Util();
     doc.LoadXml(util.DecodeMySql(xml));
     db.CloseViziAppsDatabase(State);
     return doc;
 }
    protected void Page_Load(object sender, EventArgs e)
    {
        Util util = new Util();
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        if (util.CheckSessionTimeout(State,Response,"Default.aspx")) return;
        try
        {
            if (!IsPostBack)
            {
                CopyRight.InnerText = HttpRuntime.Cache["CopyRight"].ToString();
                UserLabel.Text = State["Username"].ToString();
            }

            if ( HttpRuntime.Cache["TechSupportEmail"] != null)
            {
                util.AddEmailToButton(SupportButton,  HttpRuntime.Cache["TechSupportEmail"].ToString(), "Email To Tech Support");
            }

            util.UpdateSessionLog(State, "post", "TabMyProfile");

            if (State["ServerAdminCustomerUsername"] != null)
                UsernameLabel.Text = State["ServerAdminCustomerUsername"].ToString();
            else
                UsernameLabel.Text = State["Username"].ToString();

            Message.Text = "";

            string sql = null;
            if (State["Username"].ToString() != "admin")
            {
                sql = "SELECT * FROM customers WHERE customer_id='" + State["CustomerID"].ToString() + "'";
            }
            else
            {
                sql = "SELECT * FROM customers WHERE customer_id='" + State["ServerAdminCustomerID"].ToString() + "'";
            }
            DB db = new DB();
            DataRow[] rows = db.ViziAppsExecuteSql(State, sql);
            DataRow row = rows[0];

            PasswordTextBox.Text = "";
            ConfirmPasswordBox.Text = "";
            CompanyTextBox.Text = util.DecodeMySql(row["company"].ToString());
            RoleTextBox.Text = util.DecodeMySql(row["role"].ToString());
            FirstNameTextBox.Text = util.DecodeMySql(row["first_name"].ToString());
            LastNameTextBox.Text = util.DecodeMySql(row["last_name"].ToString());
            StreetTextBox.Text = util.DecodeMySql(row["street_address"].ToString());
            CityTextBox.Text = util.DecodeMySql(row["city"].ToString());

            if (row["state"] != null && row["state"].ToString().Length > 0)
                StateList.Text = row["state"].ToString();

            PostalCodeTextBox.Text = row["postal_code"].ToString();
            CountryTextBox.Text = util.DecodeMySql(row["country"].ToString());

            PhoneTextbox.Text = row["phone"].ToString();
            EmailTextBox.Text = row["email"].ToString();
            string status = row["status"].ToString();

            //Additions for the CC fields
            if (!IsPostBack)
            {
                CCFirstNameTextbox.Text = util.DecodeMySql(row["first_name"].ToString());
                CCLastNameTextBox.Text = util.DecodeMySql(row["last_name"].ToString());
                CCZipTextBox.Text = row["postal_code"].ToString();
            }

            db.CloseViziAppsDatabase(State);

            TimeZones zone_util = new TimeZones();
            string default_time_zone_delta_hours = row["default_time_zone_delta_hours"].ToString();
            zone_util.InitTimeZones(State, DateTime.Now.ToUniversalTime(), TimeZoneList, default_time_zone_delta_hours);

            string force_1_user_sessions = row["force_1_user_sessions"].ToString();
            Force1UserSessions.Checked = force_1_user_sessions == "1" || force_1_user_sessions.ToLower() == "true";

        }
        catch (Exception ex)
        {
            util.ProcessMainExceptions(State, Response, ex);
        }
    }
    private void PreFillBillingFormDetails()
    {
        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        Util util = new Util();
        if (State["ServerAdminCustomerUsername"] != null)
            UserLabel.Text = State["ServerAdminCustomerUsername"].ToString();
        else
            UserLabel.Text = State["Username"].ToString();

        string sql = null;
        if (State["Username"].ToString() != "admin")
        {
            sql = "SELECT * FROM customers WHERE customer_id='" + State["CustomerID"].ToString() + "'";
        }
        else
        {
            sql = "SELECT * FROM customers WHERE customer_id='" + State["ServerAdminCustomerID"].ToString() + "'";
        }
        DB db = new DB();
        DataRow[] rows = db.ViziAppsExecuteSql(State, sql);
        db.CloseViziAppsDatabase(State);

        DataRow row = rows[0];

        CompanyTextBox.Text = util.DecodeMySql(row["company"].ToString());
        EmailTextBox.Text = row["email"].ToString();
        FirstNameTextBox.Text = util.DecodeMySql(row["first_name"].ToString());
        LastNameTextBox.Text = util.DecodeMySql(row["last_name"].ToString());
        StreetTextBox.Text = util.DecodeMySql(row["street_address"].ToString());
        CityTextBox.Text = util.DecodeMySql(row["city"].ToString());

        if (row["state"] != null && row["state"].ToString().Length > 0)
            StateList.SelectedValue = row["state"].ToString();

        //StateList.Text = row["state"].ToString();

        PostalCodeTextBox.Text = row["postal_code"].ToString();
        CountryTextBox.Text = util.DecodeMySql(row["country"].ToString());
        PhoneTextbox.Text = row["phone"].ToString();

        //+++++++++++++++++++++++++++++++++++++++++++++++++++++++
        CCFirstNameTextbox.Text = util.DecodeMySql(row["first_name"].ToString());
        CCLastNameTextBox.Text = util.DecodeMySql(row["last_name"].ToString());
        CCZipTextBox.Text = row["postal_code"].ToString();

        //++++++++++++++ To be Removed at the end ++++++++++++++++++++++++++
        //CCNumberTextBox.Text = "4111111111111111";
        //CCExpirationTextBox.Text = "12/2012";
        //CCCardCodeTextBox.Text = "222";
    }
Example #4
0
    protected void CustomersByAccount_SelectedIndexChanged(object sender, RadComboBoxSelectedIndexChangedEventArgs e)
    {
        ClearMessages();
        HideForCustomers();

        Hashtable State = (Hashtable)HttpRuntime.Cache[Session.SessionID];
        if (e.Text.IndexOf("->") > 0)
        {
            CustomersByEmail.Items[0].Selected = true;
             AdminMessage.Text = "Select a customer and try again.";
            return;
        }

        State["ServerAdminCustomerUsername"] = e.Text;
        string sql = "SELECT * FROM customers WHERE username='******'";
        DB db = new DB();
        DataRow[] rows = db.ViziAppsExecuteSql(State, sql);
        DataRow row = rows[0];
        string customer_id = row["customer_id"].ToString();
        string email = row["email"].ToString();
        CustomersByAccount.FindItemByText(row["username"].ToString()).Selected = true;
        CustomersByEmail.FindItemByText(email).Selected = true;
        State["ServerAdminCustomerID"] = customer_id;
        Util util = new Util();
        RegisteredDateTime.Text = "Signed Up: " + row["registration_date_time"].ToString();
        LastUsedDateTime.Text = "Last used: " + row["last_use_date_time"].ToString();

        Password.Text = util.DecodeMySql(row["password"].ToString());
        AccountTypes.Text = util.DecodeMySql(row["account_type"].ToString().Replace("type=","").Replace(";",""));
        CustomerStatus.Text = row["status"].ToString();
        if (row["email"] != null && row["email"].ToString().Length > 0)
        {
            util.AddEmailToButton(EmailCustomer, row["email"].ToString(), "Customer Email");
        }

        sql = "SELECT application_name FROM applications WHERE customer_id='" + customer_id + "' ORDER BY application_name";
        rows = db.ViziAppsExecuteSql(State, sql);
        Applications.Items.Clear();
        foreach (DataRow row1 in rows)
        {

            Applications.Items.Add(new RadComboBoxItem(row1["application_name"].ToString()));
        }
        Applications.Items.Insert(0, new RadComboBoxItem("Select ViziApps App ->"));

        db.CloseViziAppsDatabase(State);

        ShowForCustomers();
    }