public JsonResult CheckLogin(string name, string pwd, bool remember) { IBaseBll <UserInfo> userBll = new BaseBll <UserInfo>(); var userInfo = userBll.QueryByIf(m => m.LoginName == name && m.Password == pwd).FirstOrDefault(); #region 逻辑判断 if (userInfo == null || userInfo.Flag != 1) { //用户为空 或者 用户禁用 --不许登录 return(Json(false)); } Session.Add("userInfo", userInfo); if (!remember) { //不需要记住密码 登录跳转 CookieHelper.ClearCookie("name"); CookieHelper.ClearCookie("pwd"); return(Json(true)); } #endregion #region cookie存储 //将用户名密码存入cookies CookieHelper.SetCookie("name", name, DateTime.Now.AddDays(7.0)); CookieHelper.SetCookie("pwd", pwd, DateTime.Now.AddDays(7.0)); #endregion //需要记住密码 登录跳转 return(Json(true)); }
/// <summary> /// dataTable /// </summary> /// <param name="parameters"></param> /// <returns></returns> public JsonResult GetTableData(DataTablesParameters parameters) { IBaseBll <FieldInfo> fieldBll = new BaseBll <FieldInfo>(); var list = fieldBll.QueryByIf(m => m.TableId == Convert.ToInt32(parameters.TableId)).ToList(); var count = list.Count(); return(DataTablesJson(parameters.Draw, count, count, list)); }