public ActionResult Login(string account, string pwd) { bool success = false; string msg = ""; EmployeeBll employeeBll = new EmployeeBll(); DtoEmployee employee = employeeBll.Login(account, pwd); CookieUserModel user = null; if (employee != null) { success = true; msg = "登录成功"; user = new CookieUserModel(); user.UserId = employee.Bem_Id; user.UserName = employee.Bem_Name; user.RoleId = employee.Bro_Id; user.RoleName = employee.Bro_Name; user.Grades = employee.Bem_Grades; user.GradesList = CustomEnumHelper.ParseBinaryAnd(typeof(GradeEnum), employee.Bem_Grades).Keys.ToList(); } else { msg = "登录失败"; } LoginCookieHelper.SetCurrentUser(user); return(Json(new JsonSimpleResponse() { State = success, ErrorMsg = msg })); }
public ActionResult Login(string account, string pwd) { bool success = false; string msg = ""; SchoolBll schoolBll = new SchoolBll(); SchoolTeacherBll schoolTeacherBll = new SchoolTeacherBll(); DtoSchoolTeacher schoolTeacher = schoolTeacherBll.Login(account, pwd); DtoSchool school = null; if (schoolTeacher != null && schoolTeacher.Yoh_Status == (int)StatusEnum.效) { school = schoolBll.GetSchoolDto(schoolTeacher.Yoh_SchoolId); if (schoolTeacher != null && school != null && school.Bsl_Status != (int)SchoolStatusEnum.合同到期 && school.Bsl_IsValid) { CookieUserModel user = new CookieUserModel(); user.Teacher = schoolTeacher.ConvertTo <CookieTeacher>();; user.School = school.ConvertTo <CookieSchool>(); LoginCookieHelper.SetCurrentUser(user); success = true; msg = "登录成功"; } else { msg = "当前校区不允许登录"; } } else { msg = "登录失败"; } if (!success) { LoginCookieHelper.SetCurrentUser(null); } return(Json(new JsonSimpleResponse() { State = success, ErrorMsg = msg })); }
public ActionResult SignOut() { LoginCookieHelper.SetCurrentUser(null); return(RedirectToAction("/Index")); }