protected void FunMakeAdmin(object sender, GridViewEditEventArgs e) { int x = e.NewEditIndex; bool check = false; DataTable table = Users.SelectByAccipt(true); DataTable tableAdmin = Admins.SelectAllAdmin(); for (int i = 0; i < tableAdmin.Rows.Count; i++) { if (table.Rows[x]["User_Id"].ToString() == tableAdmin.Rows[i]["User_Id"].ToString()) { check = true; } } if (check == false) { Admins.Insert(int.Parse(table.Rows[x]["User_Id"].ToString())); GvwMakeAdmin.DataSource = Users.SelectByAccipt(true); GvwMakeAdmin.DataBind(); } GridView3.DataSource = Admins.Select(); GridView3.DataBind(); }
protected void btnLogin_Click(object sender, EventArgs e) { HttpCookie cookie = new HttpCookie("MyCookie"); DataTable dataTable = Users.SelectByEmail(txtLoginEmail.Text, txtLoginPassword.Text); DataTable dataTable1 = Admins.SelectAllAdmin(); if (dataTable.Rows.Count > 0) { for (int i = 0; i < dataTable1.Rows.Count; i++) { if (dataTable.Rows[0]["User_Id"].ToString() == dataTable1.Rows[i]["User_Id"].ToString()) { cookie["userId"] = dataTable.Rows[0]["User_Id"].ToString(); cookie.Expires.AddDays(30); Response.Cookies.Add(cookie); Response.Redirect($"AdminHome.aspx?userId={dataTable.Rows[0]["User_Id"].ToString()}");//QueryString } } if (dataTable.Rows[0]["State"].ToString() == "True") { cookie["userId"] = dataTable.Rows[0]["User_Id"].ToString(); cookie.Expires.AddDays(30); Response.Cookies.Add(cookie); Response.Redirect($"Home.aspx?userId={dataTable.Rows[0]["User_Id"].ToString()}");//QueryString } else { Label1.Text = "Wait List"; } } else { Label1.Text = "Invalid Email Or Password"; } }