Ejemplo n.º 1
0
 protected void Btnlogin_Click(object sender, EventArgs e)
 {
     dt = obj.CheckAdminLogin(txtusername.Text, txtpwd.Text);
     if (dt.Rows.Count > 0)
     {
         value = dt.Rows[0]["Createdby"].ToString();
         if (value == "Administrator")
         {
             Response.Redirect("AdminDashboard.aspx");
             txtusername.Text = "";
             txtpwd.Text      = "";
         }
         if (value == "User")
         {
             Response.Redirect("UserDashboard.aspx");
             txtusername.Text = "";
             txtpwd.Text      = "";
         }
         if (value == "Cashier")
         {
             Response.Redirect("UserDashboard.aspx");
             txtusername.Text = "";
             txtpwd.Text      = "";
         }
     }
     if (dt.Rows.Count <= 0)
     {
         lblmsg.Text      = "InValid Credentials";
         txtusername.Text = "";
         txtpwd.Text      = "";
     }
 }
 protected void Btnlogin_Click(object sender, EventArgs e)
 {
     dtlogin = obj.CheckAdminLogin(txtusername.Text, txtpwd.Text);
     if (dtlogin.Rows.Count > 0)
     {
         Session["UId"] = dtlogin.Rows[0]["UserId"].ToString();
         Session["SN"]  = dtlogin.Rows[0]["SchoolName"].ToString();
         //lblmsg.Text = "Valid Credentials";
         Response.Redirect("Dashboard.aspx");
     }
     if (dtlogin.Rows.Count <= 0)
     {
         dtstafflogin = obj.CheckStaffLogin(txtusername.Text, txtpwd.Text);
         if (dtstafflogin.Rows.Count > 0)
         {
             Session["UId"] = dtstafflogin.Rows[0]["staffid"].ToString();
             Session["SN"]  = dtstafflogin.Rows[0]["Staff Name"].ToString();
             str            = dtstafflogin.Rows[0]["StaffType"].ToString();
             if (str == "Accounts")
             {
                 //lblmsg.Text = "Valid Credentials";
                 Response.Redirect("~/AAcountant/Dashboard.aspx");
             }
         }
         if (dtstafflogin.Rows.Count <= 0)
         {
             dtteacherlogin = obj.CheckTeacherLogin(txtusername.Text, txtpwd.Text);
             if (dtteacherlogin.Rows.Count > 0)
             {
                 Session["UId"] = dtteacherlogin.Rows[0]["teacherid"].ToString();
                 Session["SN"]  = dtteacherlogin.Rows[0]["Teacher Name"].ToString();
                 //lblmsg.Text = "Valid Credentials";
                 Response.Redirect("~/TTeacher/Dashboard.aspx");
             }
             if (dtteacherlogin.Rows.Count <= 0)
             {
                 lblmsg.Text = "Invalid Credentials";
             }
             if (dtlogin.Rows.Count <= 0 || dtstafflogin.Rows.Count <= 0 || dtteacherlogin.Rows.Count <= 0)
             {
                 lblmsg.Text = "Invalid Credentials";
             }
             //lblmsg.Text="Invalid Credentials";
         }
     }
 }