protected void btnContinue_Click(object sender, EventArgs e) { string message = string.Empty; if (txtForgetEmail.Text != null) { string email = txtForgetEmail.Text; customer customerObj = new customer(); if (customerObj.existCustomerByEmail(email)) { Salt generatedCode = new Salt(); Session["email"] = email; Session["role"] = "customer"; customerObj.insertGeneratedCode(generatedCode.ToString(), email); string emailFrom = "*****@*****.**"; string emailTo = email; string subject = "Reset password"; message = "You have requested to change your password. Click <a href='Client_ResetPassword.aspx?code='"+generatedCode+"''> here</a> to reset you password."; Email objEmail = new Email(); objEmail.SendMail(emailTo, emailFrom, subject, message); lblMsg1.Text = "The email was sent."; } else lblMsg1.Text = "This email is not connected to any account!"; } else { lblMsg1.Text = "Please fill the form with the new password"; } }
protected void Page_Load(object sender, EventArgs e) { // Session["email"] = "*****@*****.**"; if (Session["email"] != null) { string email = Session["email"].ToString(); customer customerObj = new customer(email); string cardNo = customerObj.getCardCreditNumber(); if (cardNo == "0") { noCard_div.Visible = true; Card_div.Visible = false; lblMsg.Text = "There is no credit card connected to this account. You can create one by clicking add button!"; } else { noCard_div.Visible = false; Card_div.Visible = true; card cardObj = new card(cardNo); lblName.Text = cardObj.FNAME + " " + cardObj.LNAME; lblCard.Text = cardNo; lblCvv2.Text = Convert.ToString(cardObj.CVV); lblExp.Text = cardObj.EXPDATE; } } }
protected void btnSaveChanges_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(txtCurrentEmail.Text) || String.IsNullOrEmpty(txtCurrentPassword.Text) || String.IsNullOrEmpty(txtNewPassword.Text)) Page.ClientScript.RegisterStartupScript(this.GetType(), "Script", "<script> alert('All fields are required.Thank you!'); </script>"); SqlCommand pass = new SqlCommand(); DBConnect objDB = new DBConnect(); //string currentPassword = (string)pass.ExecuteScalar(); //if (currentPassword == txtCurrentPassword.Text) // { } //else // lblMsg.Text = "Please enter your current password again!"; Salt salt = new Salt(); string currentEmail = txtCurrentEmail.Text; string currentPassword = txtCurrentPassword.Text; string newPassword1 = txtNewPassword.Text; customer customerObj=new customer(); int result = customerObj.ResetPassword(currentEmail, currentPassword, newPassword1, salt.ToString(),role); if (result == 0) lblMsg.Text = "The password you entered is incorrect!"; else if (result == 1) lblMsg.Text = "The password was changed successfully."; // Response.Redirect("LoginPage.aspx"); }
public DataSet transactionHistory(int transactionID) { int loginId = Convert.ToInt32(Session["loginId"].ToString()); customer customerObj = new customer(); DataSet dsHistory= customerObj.transactionHistory(loginId, transactionID); return dsHistory; }
protected void btnReset_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(txtNewPassword1.Text) || String.IsNullOrEmpty(txtNewPassword2.Text)) Page.ClientScript.RegisterStartupScript(this.GetType(), "Script", "<script> alert('All fields are required.Thank you!'); </script>"); if (canChangePass) { Salt salt = new Salt(); string password1 = txtNewPassword1.Text; string password2 = txtNewPassword2.Text; if (txtNewPassword1.Text == txtNewPassword2.Text) { customer customerObj = new customer(); string role = "customer"; int result = customerObj.ResetPassword(email, null, password1, salt.ToString(),role); if (result == 0) lblMsg.Text = "The password you entered is incorrect!"; else if (result == 1) lblMsg.Text = "The password was changed successfully."; } } else lblMsg.Text = "You do not have authorization to access this email address."; }
protected void btnLogin_Click2(object sender, EventArgs e) { if (!IsPostBack && Request.Cookies["CIS3342"] != null) { HttpCookie cookie = Request.Cookies["CIS3342"]; txtUserName.Text = cookie.Values["LoginId"].ToString(); lblMsg.Text = "You last visited " + cookie.Values["LastVisited"].ToString(); } string name = txtUserName.Text; string password = txtPassword.Text; customer c = new customer(); int loginId = c.checkCustomer(name, password); if (loginId == -1) lblMsg.Text = "The email you entered does not exist. Please try again!"; else if (loginId == 0) lblMsg.Text = "Your password is incorrect. Please try again!"; else { Session["loginId"] = loginId; Session["email"] = name; Response.Redirect("storeHome.aspx"); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string newName = context.Request.QueryString["name"].ToString(); string email = "*****@*****.**"; int result; customer customerObj = new customer(); result = customerObj.changeName(newName, email); context.Response.Write(result); }
protected void Page_Load(object sender, EventArgs e) { if (Session["email"] != null) { string email = Session["email"].ToString(); customer customerObj = new customer(email); lblName.Text = customerObj.FName + " " + customerObj.LName; lblEmail.Text = customerObj.Email; lblPassword.Text = "Not shown for security reason"; lblPhone.Text = customerObj.PhoneNumber; } else Response.Redirect("ErrorPage.aspx"); }
protected void Page_Load(object sender, EventArgs e) { if (Session["email"] != null) { email = Session["email"].ToString(); string generatedCode = Request.QueryString["code"].ToString(); customer customerObj = new customer(email); if (generatedCode == customerObj.GenerateCode) { canChangePass = true; } else canChangePass = false; } else canChangePass = false; }
protected void Page_Load(object sender, EventArgs e) { int loginId = 1; if (!IsPostBack) { if (Session["email"] != null) { string email = Session["email"].ToString(); customer customer = new customer(email); loginId = customer.LoginId; DataSet customerTransaction = customer.customerTransaction(loginId); gvPurchases.DataSource = customerTransaction; gvPurchases.DataBind(); } else Response.Redirect("LoginPage.aspx"); } }
protected void btnRegister_Click(object sender, EventArgs e) { double numbers; string value; string value1; int value2; string value3; int value4; int value5; if (Regex.IsMatch(txtFirstName.Text, @"^[\p{L}]+$")) { value = Convert.ToString(txtFirstName.Text); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Script", "<script> alert('Please enter your name correctly! This is a letter field only'); </script>"); return; } if (Regex.IsMatch(txtLastName.Text, @"^[\p{L}]+$")) { value1 = Convert.ToString(txtLastName.Text); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Script", "<script> alert('Please enter your lastname correctly! This is a letter field only'); </script>"); return; } if (double.TryParse(txtPhone.Text, out numbers)) { value5 = int.Parse(txtPhone.Text); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Script", "<script> alert('Please enter your phone number again. No letters are allowed!'); </script>"); return; } if (double.TryParse(txtZip.Text, out numbers)) { value2 = int.Parse(txtZip.Text); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Script", "<script> alert('Please enter a 5 digit number for you zip code!'); </script>"); return; } if (Regex.IsMatch(txtBillingCity.Text, @"^[\p{L}]+$")) { value3 = Convert.ToString(txtBillingCity.Text); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Script", "<script> alert('Please enter the city correctly. Only letters are accepted.'); </script>"); return; } if (double.TryParse(txtBillingZip.Text, out numbers)) { value4 =int.Parse(txtBillingZip.Text); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Script", "<script> alert('Please enter the zip code correctly. Only numbers are accepted.'); </script>"); return; } if (String.IsNullOrEmpty(txtFirstName.Text) || String.IsNullOrEmpty(txtLastName.Text) || String.IsNullOrEmpty(txtEmail.Text) || String.IsNullOrEmpty(txtBillingAdr.Text) || String.IsNullOrEmpty(txtBillingCity.Text) || String.IsNullOrEmpty(txtPassword.Text) || String.IsNullOrEmpty(txtAddress.Text) || String.IsNullOrEmpty(txtCity.Text) || String.IsNullOrEmpty(txtCity.Text) || String.IsNullOrEmpty(txtBillingZip.Text) || String.IsNullOrEmpty(txtZip.Text)) Page.ClientScript.RegisterStartupScript(this.GetType(), "Script", "<script> alert('Please fill all the required fields. Thank you!'); </script>"); string fName = txtFirstName.Text; string lName = txtLastName.Text; string email = txtEmail.Text; string password = txtPassword.Text; string shipAddress = txtAddress.Text; string cityShipping = txtCity.Text; string stateShipping = ddlState1.SelectedValue; int zipShipping = Convert.ToInt32(txtZip.Text); string phoneNo = txtPhone.Text; string billAddress = txtBillingAdr.Text; string cityBilling = txtBillingCity.Text; string stateBilling = ddlState2.SelectedValue; int zipBilling = Convert.ToInt32(txtBillingZip.Text); customer c = new customer(); int customerId = c.registerCustomer(email, password, fName, lName, shipAddress, billAddress, phoneNo, cityBilling, cityShipping, stateShipping, stateBilling, Convert.ToString(zipShipping), Convert.ToString(zipBilling)); if (customerId < 1) lblMsg.Text = "Registration is not succesful, try again!"; else { lblMsg.Text = "--Registration is succesful"; Session["loginId"] = customerId; Button1.Visible = true; } }
protected void Page_Load(object sender, EventArgs e) { Session["email"] = "*****@*****.**"; if (Session["email"] != null) { double numbers; int value1; string value2; string value3; int value4; string value5; if (double.TryParse(txtCardNumber.Text, out numbers)) { value1 = int.Parse(txtCardNumber.Text); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Script", "<script> alert('Please enter your phone number again. No letters are allowed!'); </script>"); return; } if (Regex.IsMatch(txtLname.Text, @"^[\p{L}]+$")) { value2 = Convert.ToString(txtLname.Text); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Script", "<script> alert('Please enter your last name correctly! This is a letter field only'); </script>"); return; } if (Regex.IsMatch(txtFirstname.Text, @"^[\p{L}]+$")) { value3 = Convert.ToString(txtFirstname.Text); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Script", "<script> alert('Please enter your first name correctly! This is a letter field only'); </script>"); return; } if (double.TryParse(txtCvv.Text, out numbers)) { value4 = int.Parse(txtCvv.Text); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Script", "<script> alert('Please enter a 5 digit number for you zip code!'); </script>"); return; } if (Regex.IsMatch(txtExpDate.Text, @"^[\p{L}]+$")) { value5 = Convert.ToString(txtExpDate.Text); } else { Page.ClientScript.RegisterStartupScript(this.GetType(), "Script", "<script> alert('Please enter the city correctly. Only letters are accepted.'); </script>"); return; } if (String.IsNullOrEmpty(txtCardNumber.Text) || String.IsNullOrEmpty(txtLname.Text) || String.IsNullOrEmpty(txtFirstname.Text) || String.IsNullOrEmpty(txtCvv.Text) || String.IsNullOrEmpty(txtExpDate.Text)) Page.ClientScript.RegisterStartupScript(this.GetType(), "Script", "<script> alert('Please fill all the required fields. Thank you!'); </script>"); string email = Session["email"].ToString(); customer customerObj = new customer(email); string cardNo = customerObj.getCardCreditNumber(); card cardObj = new card(cardNo); txtCardNumber.Text = cardNo; txtCardNumber.Enabled = false; txtLname.Text=cardObj.LNAME; txtLname.Enabled=true; txtFirstname.Text = cardObj.FNAME; txtFirstname.Enabled = true; txtCvv.Text = Convert.ToString(cardObj.CVV); txtCvv.Enabled = true; txtExpDate.Text=cardObj.EXPDATE; txtExpDate.Enabled=true; } }