protected void Button1_Click(object sender, EventArgs e) { DataTable data = LoginAdmin.SelectById(1); if (txtUser.Text == data.Rows[0]["User_Name"].ToString() && txtPassword.Text == data.Rows[0]["Password"].ToString()) { Response.Redirect("ShowAdmin.aspx"); } else { lblError.Text = "Error user name or password"; } }
protected void Button1_Click(object sender, EventArgs e) { DataTable data = LoginAdmin.SelectById(1); if (txtQuation.Text == data.Rows[0]["Quation"].ToString() && txtAnswer.Text == data.Rows[0]["Answer"].ToString()) { txtUser.Visible = true; txtPass.Visible = true; txtAnswer.Visible = false; txtQuation.Visible = false; Button1.Visible = false; Button2.Visible = true; Label1.Text = "Enter new user name"; Label2.Text = "Enter new password"; } else { lblError.Text = "Error quation or answer plz, enter them valid"; } }
protected void Button1_Click(object sender, EventArgs e) { DataTable data = LoginAdmin.SelectById(1); LoginAdmin_attripute login = new LoginAdmin_attripute { Answer = txtAnswer.Text, Password = txtNewPass.Text, Quation = txtQuation.Text, UserName = txtUser.Text }; if (txtOldPass.Text == data.Rows[0]["Password"].ToString()) { int x = LoginAdmin.Update(login, 1); if (x == 1) { Response.Redirect("ShowAdmin.aspx"); } } else { lblError.Text = "Error old password"; } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { DataTable data = Users.SelectByAccipt(true); GridView1.DataSource = data; GridView1.DataBind(); GridView2.DataSource = Users.SelectByAccipt(false); GridView2.DataBind(); GridView3.DataSource = Admins.Select(); GridView3.DataBind(); GvwMakeAdmin.DataSource = Users.SelectByAccipt(true); GvwMakeAdmin.DataBind(); HttpCookie cookie = Request.Cookies["MyCookie"]; if (cookie != null) { int x = int.Parse(cookie["userId"].ToString()); DataTable d = LoginAdmin.SelectById(x); if (d.Rows.Count > 0) { ShowAdmin.Visible = true; } else { ShowAdmin.Visible = false; } } else { Response.Redirect("LogIn.aspx"); } } }