Ejemplo n.º 1
0
        public ActionResult Login(string userName, string password)
        {
            var    userInfo    = SystemBLL.System_Login(userName, password);
            string facultyName = SystemBLL.System_GetFaculty(userInfo.facultyid);

            if (userInfo == null)
            {
                ModelState.AddModelError("", "Login Failed!");
                return(View());
            }
            Session["uid"]         = userInfo.userid;
            Session["uname"]       = userInfo.username;
            Session["ufacultyid"]  = userInfo.facultyid;
            Session["uroleid"]     = userInfo.roleid;
            Session["opentime"]    = userInfo.opentime.ToString();
            Session["facultyname"] = facultyName;
            FormsAuthentication.SetAuthCookie("isLogin", false);
            return(RedirectToAction("Index", "Home"));
        }