protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { tblUser.Fill(ds1.UserInfo); cardNumber = Session["cardNumber"].ToString(); DataRow[] dr = ds1.UserInfo.Select("Card_Number = '" + cardNumber + "'"); TextBox1.Text = dr[0]["Email"].ToString(); TextBox2.Text = dr[0]["Phone_Number"].ToString(); TextBox3.Text = dr[0]["Address"].ToString(); } }
protected void btnYes_Click(object sender, EventArgs e) { //delete user info from table. string cardNumber = Session["cardNumber"].ToString(); tblUser.Fill(ds1.UserInfo); DataRow[] dr = ds1.UserInfo.Select("Card_Number = '" + cardNumber + "'"); dr[0].Delete(); tblUser.Update(dr); string script = "<script>alert('Your account has been deleted.' );</script>"; Page.ClientScript.RegisterStartupScript(this.GetType(), "Scripts", script); Response.Redirect("Login.aspx"); }
protected void btnOkay_Click(object sender, EventArgs e) { tblUser.Fill(ds1.UserInfo); DataRow[] dr = ds1.UserInfo.Select("Card_Number = '" + txtCardNumber.Text + "'" + " AND Pin = '" + txtPin.Text + "'"); //Label1.Text = dr.Length.ToString(); if (dr.Length == 0) { Label1.Text = "INVALID CARD INFO, PLEASE TRY AGAIN"; } else { Session["cardNumber"] = txtCardNumber.Text; Response.Redirect("PasswordChange.aspx"); } }
protected void btnOkay_Click(object sender, EventArgs e) { //change password: update user table with new password tblUser.Fill(ds1.UserInfo); string cardNumber = Session["cardNumber"].ToString(); DataRow[] dr = ds1.UserInfo.Select("Card_Number = '" + cardNumber + "'"); dr[0]["Password"] = txtConfirmPassword.Text; tblUser.Update(ds1); string script = "<script>alert('Your password has been changed');</script>"; Page.ClientScript.RegisterStartupScript(this.GetType(), "Scripts", script); Response.Redirect("Main.aspx"); }
protected void btnCreateAcc_Click(object sender, EventArgs e) { tblUser.Fill(ds1.UserInfo); DataSet1.UserInfoRow row = ds1.UserInfo.NewUserInfoRow(); row.Name = txtName.Text; row.Email = txtEmail.Text; row.Phone_Number = txtPhone.Text; row.Address = txtAddress.Text; row.Card_Number = txtCardNum.Text; row.Pin = txtPin.Text; row.password = txtPass.Text; ds1.UserInfo.Rows.Add(row); tblUser.Update(ds1.UserInfo); Label1.Text = "Account created Successfully... Redirecting to login page............"; Response.Redirect("Login.aspx"); }
protected void btnLogin_Click(object sender, EventArgs e) { tblUser.Fill(ds1.UserInfo); DataRow[] dr = ds1.UserInfo.Select("Card_Number = '" + txtCardnum.Text + "'" + " AND Password = '******'"); //Label1.Text = dr.Length.ToString(); if (dr.Length == 0) { Label1.Text = "INVALID LOGIN INFO, PLEASE TRY AGAIN"; } else { Label1.Text = "LOGIN SUCCESSFUL"; Session["cardNumber"] = txtCardnum.Text; Response.Redirect("Main.aspx"); } }