示例#1
0
        public ActionResult Login(string userName, string password)
        {
            var userInfo = SystemBLL.System_Login(userName, password);

            if (userInfo == null)
            {
                ModelState.AddModelError("", "Login Failed!");
                return(View());
            }
            Session["uid"] = userInfo.userid;
            FormsAuthentication.SetAuthCookie("isLogin", false);
            return(RedirectToAction("Index", "Home"));
        }
示例#2
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"));
        }