protected void login_Click(object sender, EventArgs e) { if (txt_emailid.Text.Length > 0 && txt_password.Text.Length > 0) { st = "select * from admin where Email='" + txt_emailid.Text + "' and Password='******'"; dt = get_datatable(st); if (dt.Rows.Count > 0) { int session_admin = dt.Rows[0]["id"].GetHashCode(); Session["session_admin"] = session_admin; Session["admin"] = dt.Rows[0][0].ToString(); Adminlogin_details objAdminlogin_details = new Adminlogin_details(); objAdminlogin_details.fullname = dt.Rows[0]["Name"].ToString(); Session["Adminlogin_details"] = objAdminlogin_details; Response.Redirect("dashboard.aspx"); } else { Label1.Text = "Login Failed"; Label1.ForeColor = Color.Red; } } else { Label1.Text = "Enter Login Credentials"; Label1.ForeColor = Color.Red; } }
/// <summary> /// /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lnk_login_Click(object sender, EventArgs e) { DataTable dt = new DataTable(); st = "select admin_id,profile_pic,is_superadmin,offers_combos,inform_before_activate,item_details,admin_name from tbl_admin where emailid='" + txt_emailid.Text + "' and admin_password='******'"; dt = db.get_datatable(st); if (dt.Rows.Count > 0) { Session["admin_id"] = dt.Rows[0][0].ToString(); Adminlogin_details objAdminlogin_details = new Adminlogin_details(); objAdminlogin_details.inform_before_activate = Boolean.Parse(dt.Rows[0]["inform_before_activate"].ToString()); objAdminlogin_details.is_superadmin = Boolean.Parse(dt.Rows[0]["is_superadmin"].ToString()); objAdminlogin_details.item_details = Boolean.Parse(dt.Rows[0]["item_details"].ToString()); objAdminlogin_details.offers_combos = Boolean.Parse(dt.Rows[0]["offers_combos"].ToString()); objAdminlogin_details.profile_pic = dt.Rows[0]["profile_pic"].ToString(); objAdminlogin_details.fullname = dt.Rows[0]["admin_name"].ToString(); Session["Adminlogin_details"] = objAdminlogin_details; if (chk_remember.Checked) { Response.Cookies["OTA_emailid"].Value = txt_emailid.Text; Response.Cookies["QTA_password"].Value = txt_pwd.Text; Response.Cookies["OTA_emailid"].Expires = DateTime.Now.AddDays(30); Response.Cookies["QTA_password"].Expires = DateTime.Now.AddDays(30); } else { Response.Cookies["OTA_emailid"].Expires = DateTime.Now.AddDays(-1); Response.Cookies["QTA_password"].Expires = DateTime.Now.AddDays(-1); } Response.Redirect("dashboard.aspx"); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showalert('error','Login failed');", true); } }
protected void login_Click(object sender, EventArgs e) { if (txt_emailid.Text.Length > 0 && txt_password.Text.Length > 0) { if (dd_login.Text == "Faculty") { st = "select * from Faculty where email='" + txt_emailid.Text + "' and Password='******'"; dt = get_datatable(st); if (dt.Rows.Count > 0) { int session_faculty = dt.Rows[0]["faculty_id"].GetHashCode(); Session["session_faculty"] = session_faculty; Session["faculty"] = dt.Rows[0][0].ToString(); Faculty_details obj = new Faculty_details(); obj.EmailID = dt.Rows[0]["email"].ToString(); obj.name = dt.Rows[0]["name"].ToString(); Session["faculty_details"] = obj; Response.Redirect("Faculty/dashboard.aspx"); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showalert('error','Login failed');", true); } } else if (dd_login.Text == "Student") { st = "select * from student where email='" + txt_emailid.Text + "' and Password='******'"; dt = get_datatable(st); Session["std"] = txt_emailid.Text; Session["std1"] = txt_password.Text; if (dt.Rows.Count > 0) { int session_std = dt.Rows[0]["Reg_number"].GetHashCode(); int sem = dt.Rows[0]["sem"].GetHashCode(); Session["sem"] = sem; Session["dept"] = dt.Rows[0]["dept"].ToString(); Session["session_std"] = session_std; Session["student"] = dt.Rows[0][0].ToString(); student_details obj = new student_details(); obj.EmailID = dt.Rows[0]["email"].ToString(); obj.name = dt.Rows[0]["fullname"].ToString(); Session["student_details"] = obj; Response.Redirect("student/dashboard.aspx"); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showalert('error','Login failed');", true); } } else if (dd_login.Text == "Admin") { st = "select * from admin where email='" + txt_emailid.Text + "' and Password='******'"; dt = get_datatable(st); if (dt.Rows.Count > 0) { int session_admin = dt.Rows[0]["admin_id"].GetHashCode(); Session["session_admin"] = session_admin; Session["admin"] = dt.Rows[0][0].ToString(); Adminlogin_details objAdminlogin_details = new Adminlogin_details(); objAdminlogin_details.fullname = dt.Rows[0]["Name"].ToString(); Session["Adminlogin_details"] = objAdminlogin_details; Response.Redirect("Admin/dashboard.aspx"); } else { ScriptManager.RegisterStartupScript(this, this.GetType(), "", "showalert('error','Login failed');", true); } } } }
protected void login_Click(object sender, EventArgs e) { if (txt_emailid.Text.Length > 0 && txt_password.Text.Length > 0) { if (dd_login.Text == "Doctor") { st = "select * from doctor where Email='" + txt_emailid.Text + "' and Password='******'"; dt = get_datatable(st); Session["doctor"] = txt_emailid.Text; if (dt.Rows.Count > 0) { int session_princi = dt.Rows[0]["id"].GetHashCode(); Session["session_doct"] = session_princi; Session["doctor"] = dt.Rows[0][0].ToString(); Doctor_details obj = new Doctor_details(); obj.name = dt.Rows[0]["Name"].ToString(); Session["doctor_details"] = obj; Response.Redirect("doctor/dashboard.aspx"); } else { Label1.Text = "Login Failed"; Label1.ForeColor = Color.Red; } } else if (dd_login.Text == "Patient") { st = "select * from Patient where email='" + txt_emailid.Text + "' and password='******'"; dt = get_datatable(st); if (dt.Rows.Count > 0) { int session_faculty = dt.Rows[0]["id"].GetHashCode(); Session["session_Patient"] = session_faculty; Session["Patient"] = dt.Rows[0][0].ToString(); Patient_details obj = new Patient_details(); obj.EmailID = dt.Rows[0]["email"].ToString(); obj.name = dt.Rows[0]["name"].ToString(); Session["Patient_details"] = obj; Response.Redirect("Patient/Default.aspx"); } else { Label1.Text = "Login Failed"; Label1.ForeColor = Color.Red; } } else if (dd_login.Text == "Admin") { st = "select * from admin where email='" + txt_emailid.Text + "' and Password='******'"; dt = get_datatable(st); if (dt.Rows.Count > 0) { int session_admin = dt.Rows[0]["id"].GetHashCode(); Session["session_admin"] = session_admin; Session["admin"] = dt.Rows[0][0].ToString(); Adminlogin_details objAdminlogin_details = new Adminlogin_details(); objAdminlogin_details.fullname = dt.Rows[0]["Name"].ToString(); Session["Adminlogin_details"] = objAdminlogin_details; Response.Redirect("Admin/dashboard.aspx"); } else { Label1.Text = "Login Failed"; Label1.ForeColor = Color.Red; } } } }