protected void Button1_Click(object sender, EventArgs e) { if (rdoadmin.Checked == true) { ADT = AAdapter.Select_For_Login(txtuname.Text, txtpass.Text); if (ADT.Rows.Count > 0) { Session["admin"] = ADT.Rows[0]["username"].ToString(); Session["apass"] = ADT.Rows[0]["password"].ToString(); Session["aid"] = ADT.Rows[0]["aid"].ToString(); Response.Redirect("Main.aspx"); } else { lbl.Text = "Invalid Detail"; } } else { EDT = EAdapter.Select_Login(txtuname.Text, txtpass.Text); if (EDT.Rows.Count > 0) { Session["ename"] = EDT.Rows[0]["ename"].ToString(); Session["eid"] = EDT.Rows[0]["eid"].ToString(); Session["epass"] = EDT.Rows[0]["password"].ToString(); Session["acno"] = EDT.Rows[0]["bankacno"].ToString(); Response.Redirect("Emp/MyAccount.aspx"); } else { lbl.Text = "Invalid Detail"; } } }
protected void btnaddadmin_Click(object sender, EventArgs e) { AAdapter.Insert(txtuname.Text, txtpass.Text); lbl.Text = "Record Added"; ADT = AAdapter.Select_For_Dispaly(Session["admin"].ToString()); GridView1.DataSource = ADT; GridView1.DataBind(); }
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e) { int idd = Convert.ToInt32(GridView1.DataKeys[e.RowIndex].Value); AAdapter.Delete(idd); ADT = AAdapter.Select_For_Dispaly(Session["admin"].ToString()); GridView1.DataSource = ADT; GridView1.DataBind(); lbl.Text = "Record Deleted"; }
protected void Page_Load(object sender, EventArgs e) { if (Session["admin"] == null) { Response.Redirect("Default.aspx"); } else { if (Page.IsPostBack == false) { ADT = AAdapter.Select_For_Dispaly(Session["admin"].ToString()); GridView1.DataSource = ADT; GridView1.DataBind(); } } }