protected void btnSubmit_Click(object sender, EventArgs e) { //change the user password if password match if (lblPassword.Text == CommonShared.EnryptString(txtOldPassword.Text.Trim())) { if (BAL_Registration.ChangeCustomerPassword(CommonShared.EnryptString(txtOldPassword.Text.Trim()), CommonShared.EnryptString(txtNewPassword.Text.Trim()), Convert.ToInt32(lblCustomerId.Text)) == true) { DataTable table = BAL_Registration.GetRecordsForUser(Convert.ToInt32(lblCustomerId.Text)); if (table != null) { if (table.Rows.Count > 0) { CustomerSessions cs = new CustomerSessions(); cs.CustomerId = Convert.ToInt32(table.Rows[0]["CustomerId"]); cs.FirstName = Convert.ToString(table.Rows[0]["FirstName"]); cs.LastName = Convert.ToString(table.Rows[0]["LastName"]); cs.Sex = char.Parse(Convert.ToString(table.Rows[0]["Sex"])); cs.Email = Convert.ToString(table.Rows[0]["EmailId"]); cs.Password = Convert.ToString(table.Rows[0]["Password"]); cs.Address1 = Convert.ToString(table.Rows[0]["BAddress1"]); cs.Address2 = Convert.ToString(table.Rows[0]["BAddress2"]); cs.City = Convert.ToString(table.Rows[0]["BCityName"]); cs.State = Convert.ToString(table.Rows[0]["BStateName"]); cs.Country = Convert.ToString(table.Rows[0]["BCountryName"]); cs.ZipCode = Convert.ToString(table.Rows[0]["BZip"]); cs.PhoneNo = Convert.ToString(table.Rows[0]["BPhone"]); cs.BusinessName = Convert.ToString(table.Rows[0]["BusinessName"]); cs.ZipCode = Convert.ToString(table.Rows[0]["BZip"]); cs.BFax = Convert.ToString(table.Rows[0]["BFax"]); cs.BContactPerson = Convert.ToString(table.Rows[0]["BContactPerson"]); //store object into session Session["CustomerSessions"] = cs; //store object into session Session["CustomerSessions"] = cs; Response.Redirect("~/User/Members.aspx"); } } } else { Label5.Visible = true; Label5.Text = "Error in password changed.Please try again"; } } else { Label5.Visible = true; } }
protected void btnLogin_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(txtUsername.Text) && !string.IsNullOrEmpty(txtPassword.Text)) { DataTable table = BAL_UserLogin.Login_Verify(Convert.ToString(txtUsername.Text), CommonShared.EnryptString(Convert.ToString(txtPassword.Text))); if (table != null) { if (table.Rows.Count > 0) { CustomerSessions cs = new CustomerSessions(); cs.CustomerId = Convert.ToInt32(table.Rows[0]["CustomerId"]); cs.FirstName = Convert.ToString(table.Rows[0]["FirstName"]); cs.LastName = Convert.ToString(table.Rows[0]["LastName"]); cs.Sex = char.Parse(Convert.ToString(table.Rows[0]["Sex"])); cs.Email = Convert.ToString(table.Rows[0]["EmailId"]); cs.Password = Convert.ToString(table.Rows[0]["Password"]); cs.Address1 = Convert.ToString(table.Rows[0]["Address1"]); cs.Address2 = Convert.ToString(table.Rows[0]["Address2"]); cs.CityId = Convert.ToInt32(table.Rows[0]["CityId"]); cs.City = Convert.ToString(table.Rows[0]["City"]); cs.StateId = Convert.ToInt32(table.Rows[0]["StateId"]); cs.State = Convert.ToString(table.Rows[0]["State"]); cs.CountryId = Convert.ToInt32(table.Rows[0]["CountryId"]); cs.Country = Convert.ToString(table.Rows[0]["Country"]); cs.ZipCode = Convert.ToString(table.Rows[0]["ZipCode"]); cs.PhoneNo = Convert.ToString(table.Rows[0]["PhoneNo"]); //store object into session Session["CustomerSessions"] = cs; if (string.IsNullOrEmpty(ProductDetails)) { if (string.IsNullOrEmpty(lblCheckOut.Text)) { Response.Redirect("~/User/Members.aspx"); } else { Response.Redirect("~/User/Checkout.aspx"); } } else { if (btnHandler != null) { btnHandler("ProductDetails"); } } } else { lblLoginError.Text = "Invalid UserName or Password"; txtPassword.Text = ""; txtUsername.Text = ""; } } } }