Example #1
0
        private void LoadSessionData()
        {
            if (Session["Login"] != null)
            {
                string custUserName = Session["Login"].ToString();
                lblLoginUserName.Text = custUserName;
                Customer cust = CustomersDB.GetCustomerByUserName(custUserName);
                PopulateAccountDetails(cust);

                Session["UserName"] = cust.CustUserName;
                Session["Password"] = cust.CustPassword;
            }

            else
            {
                Response.Redirect("Login.aspx");
            }
        }
Example #2
0
        protected void btnSaveUpd_Click(object sender, EventArgs e)
        {
            //SqlConnection conn = TravelExperts1DB.GetConnection();

            Customer currCust = CustomersDB.GetCustomerByUserName(Session["UserName"].ToString());

            if (Page.IsValid)
            {
                Customer updCust = new Customer();

                updCust.CustFirstName = txtCustFirstName.Text.ToString();
                updCust.CustLastName  = txtCustLastName.Text.ToString();
                updCust.CustAddress   = txtCustAddress.Text.ToString();
                updCust.CustCity      = txtCustCity.Text.ToString();
                updCust.CustProv      = ddlCustProv.Text.ToString();
                updCust.CustPostal    = txtCustPostal.Text.ToString();
                updCust.CustCountry   = ddlCustCountry.Text.ToString();
                updCust.CustHomePhone = txtCustHomePhone.Text.ToString();
                updCust.CustBusPhone  = txtCustBusPhone.Text.ToString();
                updCust.CustEmail     = txtCustEmail.Text.ToString();
                updCust.CustUserName  = Session["UserName"].ToString();
                updCust.CustPassword  = Session["Password"].ToString();



                try
                {
                    bool updSuccessful = CustomersDB.UpdateCustomer(currCust, updCust);
                    if (updSuccessful)
                    {
                        Response.Write("Account Details update successful");
                    }
                    else
                    {
                        Response.Write("Account Details update failed, please try again");
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
        }