protected void login_Click(object sender, EventArgs e)
        {
            AuthPROPS ap = new AuthPROPS();

            ap.Email    = email.Text;
            ap.Passowrd = new HashSami().GetHash(password.Text.Trim());
            DataTable dt = new AuthBAL().login(ap);

            if (dt.Rows.Count > 0)
            {
                int AccessLevel = (int)dt.Rows[0]["AccessLevel"];
                Session["Email"]       = email;
                Session["PD_ID"]       = dt.Rows[0]["U_ID"];
                Session["Name"]        = dt.Rows[0]["Name"];
                Session["AccessLevel"] = AccessLevel;
                Session["deptid"]      = dt.Rows[0]["Department_ID"];
                Session["dean"]        = dt.Rows[0]["Dean"];
                Session["Campus"]      = dt.Rows[0]["Campus"];
                if (AccessLevel == 1)
                {
                    Response.Redirect("Coordinator/dashboard.aspx");
                }
                else if (AccessLevel == 2)
                {
                    Response.Redirect("HOD/dashboard.aspx");
                }
                else if (AccessLevel == 3)
                {
                    Response.Redirect("DEAN/dashboard.aspx");
                }
                else if (AccessLevel == 4)
                {
                    Response.Redirect("Dir_Acad/dashboard.aspx");
                }
                else if (AccessLevel == 5)
                {
                    Response.Redirect("DG/dashboard.aspx");
                }
                else if (AccessLevel == 6)
                {
                    Response.Redirect("Rector/dashboard.aspx");
                }
            }
            else
            {
                alert.Text    = "Incorrect Email or Password";
                alert.Visible = true;
            }
        }
Beispiel #2
0
        public DataTable login(AuthPROPS ap)
        {
            DataTable dt = new DataTable();

            conn.Open();
            SqlCommand cmd = new SqlCommand("LOGIN", conn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add(new SqlParameter("@Email", ap.Email));
            cmd.Parameters.Add(new SqlParameter("@Password", ap.Passowrd));
            sdr = cmd.ExecuteReader();
            if (sdr.HasRows)
            {
                dt.Load(sdr);
            }
            return(dt);
        }
Beispiel #3
0
 public DataTable login(AuthPROPS ap)
 {
     return(new AuthDAL().login(ap));
 }