/// <summary> /// PC端系统用户集合分页查询 /// 请勿删除 /// </summary> /// <param name="pageIndex"></param> /// <param name="pageSize"></param> /// <param name="recordCount"></param> /// <returns></returns> public List <SysUserModel> GetSysUserList(int?pageIndex, int?pageSize, string UserName, ref int recordCount) { SysUserDal dal = new SysUserDal(); recordCount = dal.GetCount(UserName); return(dal.GetSysUserList(pageIndex, pageSize, UserName)); }
public ActionResult GetListJson(DataTablesParameters query) { string UserName = Request.GetSqlParamer("UserName"); string LoginName = Request.GetSqlParamer("LoginName"); string sWhere = " 1=1 "; if (!string.IsNullOrWhiteSpace(UserName)) { sWhere += $" and UserName like '{UserName}%'"; } if (!string.IsNullOrWhiteSpace(LoginName)) { sWhere += $" and LoginName like '{LoginName}%'"; } SysUserDal sysUserDal = flexibleContext.GetService <SysUserDal>(); var list = sysUserDal.GetModels( where : sWhere, orderBy: query.OrderBy, currentPage: query.Start / 10 + 1, itemsPerPage: query.Length ); int recordsCount = sysUserDal.GetCount(sWhere); var resultJson = new DataTablesResult <SysUser>(query.Draw, recordsCount, recordsCount, list); return(Json(resultJson)); }
/// <summary> /// 得到当前登录用户信息 /// </summary> /// <returns></returns> public SysUser GetCurrentUser() { SysUserDal sysUserDal = lessContext.GetService <SysUserDal>(); string loginName = lessContext.Jwt.Result[BasicConst.JWT_USER].loginName.ToString(); SysUser sysUser = sysUserDal.GetUser(loginName); return(sysUser); }
/// <summary> /// 查询用户所属的菜单信息 /// </summary> /// <param name="userno">用户编码</param> /// <returns></returns> public List <sysmenu> QueryUserMenus(string userno) { SysUserDal dal = new SysUserDal(); List <sysmenu> menus = dal.QueryMenus(userno); var topmenus = menus.Where(p => p.parentno == "0"); foreach (sysmenu menu in menus) { BuildMenusTree(menus, menu); } return(topmenus.ToList()); }
public int DelData(int rowid) { SysUserDal dal = new SysUserDal(); return(dal.DelData(rowid)); }
/// <summary> /// 修改记录 /// 请勿删除 /// </summary> /// <returns></returns> public bool UpData(SysUserModel newModel, string roleids) { SysUserDal dal = new SysUserDal(); return(dal.UpData(newModel, roleids)); }
/// <summary> /// 验证用户是否合法 /// </summary> /// <param name="userno">用户编码</param> /// <param name="password">用户密码</param> /// <returns></returns> public OperateResultModel ValidUser(string userno, string password) { SysUserDal dal = new SysUserDal(); return(dal.ValidUser(userno, password)); }
/// <summary> /// 删除用户信息 /// </summary> /// <param name="userno">用户编号</param> /// <returns></returns> public OperateResultModel DeleteUser(string userno) { SysUserDal dal = new SysUserDal(); return(dal.Delete(userno)); }
/// <summary> /// 更新用户信息 /// </summary> /// <param name="user">用户实体</param> /// <returns></returns> public OperateResultModel UpdateUser(sysuser user) { SysUserDal dal = new SysUserDal(); return(dal.Update(user)); }
/// <summary> /// 插入用户信息 /// </summary> /// <param name="user">用户实体</param> /// <returns></returns> public OperateResultModel InsertUser(sysuser user) { SysUserDal dal = new SysUserDal(); return(dal.Insert(user)); }
/// <summary> /// 查询用户信息 /// </summary> /// <param name="username">用户姓名</param> /// <param name="userno">用户编号</param> /// <param name="pm">分页信息</param> /// <returns></returns> public OperateResultModel QueryUsers(string userno, string username, PaginModel pm) { SysUserDal dal = new SysUserDal(); return(dal.Query(userno, username, pm)); }
/// <summary> /// 查询用户信息 /// </summary> /// <param name="userno"></param> /// <returns></returns> public sysuser QueryUser(string userno) { SysUserDal dal = new SysUserDal(); return(dal.Query(userno)); }
/// <summary> /// 获得用户对应菜单的权限 /// </summary> /// <param name="userno">用户编号</param> /// <param name="menuno">菜单编号</param> /// <returns></returns> public List <syspower> QueryUserPower(string userno, string menuno) { SysUserDal dal = new SysUserDal(); return(dal.QueryUserPower(userno, menuno)); }
protected void btnLogin_Click(object sender, EventArgs e) { if (txtUserName.Text.Trim() != "") { try { string key = txtUserName.Text.ToLower(); string UserCache = Convert.ToString(Cache[key]); if (UserCache == null || UserCache == string.Empty || Cache[key].ToString() == Page.Request.UserHostAddress) { DataTable dtUser = new SysUserDal().GetUser(txtUserName.Text.Trim()); if (dtUser.Rows.Count > 0) { if (dtUser.Rows[0]["UserPassword"].ToString().Trim() == THOK.Util.Coding.Encoding(txtPassWord.Text.Trim())) { Session["UserID"] = dtUser.Rows[0]["UserID"].ToString(); Session["GroupID"] = dtUser.Rows[0]["GroupID"].ToString(); Session["G_user"] = txtUserName.Text.ToLower(); Session["Client_IP"] = Page.Request.UserHostAddress; Session["IsFirstLogin"] = "******"; //个人显示设置,WUQH添加 Session["sys_PageCount"] = dtUser.Rows[0]["sys_PageCount"].ToString(); Session["grid_ColumnTitleFont"] = dtUser.Rows[0]["grid_ColumnTitleFont"].ToString(); Session["grid_ContentFont"] = dtUser.Rows[0]["grid_ContentFont"].ToString(); Session["grid_ColumnTextAlign"] = dtUser.Rows[0]["grid_ColumnTextAlign"].ToString(); Session["grid_ContentTextAlign"] = dtUser.Rows[0]["grid_ContentTextAlign"].ToString(); Session["grid_NumberColumnAlign"] = dtUser.Rows[0]["grid_NumberColumnAlign"].ToString(); Session["grid_MoneyColumnAlign"] = dtUser.Rows[0]["grid_MoneyColumnAlign"].ToString(); Session["grid_SelectMode"] = dtUser.Rows[0]["grid_SelectMode"].ToString(); Session["grid_OddRowColor"] = dtUser.Rows[0]["grid_OddRowColor"].ToString(); Session["grid_EvenRowColor"] = dtUser.Rows[0]["grid_EvenRowColor"].ToString(); Session["grid_IsRefreshBeforeAdd"] = dtUser.Rows[0]["grid_IsRefreshBeforeAdd"].ToString(); Session["grid_IsRefreshBeforeUpdate"] = dtUser.Rows[0]["grid_IsRefreshBeforeUpdate"].ToString(); Session["grid_IsRefreshBeforeDelete"] = dtUser.Rows[0]["grid_IsRefreshBeforeDelete"].ToString(); Session["sys_PrintForm"] = dtUser.Rows[0]["sys_PrintForm"].ToString(); Session["pager_ShowPageIndex"] = dtUser.Rows[0]["pager_ShowPageIndex"].ToString(); Session.Timeout = int.Parse(dtUser.Rows[0]["SessionTimeOut"].ToString()); TimeSpan stLogin = new TimeSpan(0, 0, System.Web.HttpContext.Current.Session.Timeout, 0, 0); HttpContext.Current.Cache.Insert(key, Page.Request.UserHostAddress, null, DateTime.MaxValue, stLogin, System.Web.Caching.CacheItemPriority.NotRemovable, null); //setLog.InsertOperationLog(System.DateTime.Now, this.txtUserName.Text.Trim(), "登录页面", "登录(成功)"); string strScript = @"<SCRIPT LANGUAGE='javascript'> " + "window.opener=null;window.open ('MDIPage.aspx','newwindow','top=0,left=0,depended=no,toolbar=no,menubar=no,scrollbars=no,resizable=yes,location=no,status=yes');window.opener=null;window.close();" + "</SCRIPT>"; Page.ClientScript.RegisterStartupScript(GetType(), "a1", strScript); } else { //setLog.InsertOperationLog(System.DateTime.Now, this.txtUserName.Text.Trim(), "登录页面", "登录(用户密码有误)"); labMessage.Text = "对不起,您输入的密码有误!"; } } else { labMessage.Text = "对不起,您输入的用户名不存在!"; } } else { labMessage.Text = "对不起,该帐号已经有人登录!请与管理员联系!"; } } catch (Exception exp) { Session["ModuleName"] = "登录界面"; Session["FunctionName"] = "btnLogin_Click"; Session["ExceptionalType"] = exp.GetType().FullName; Session["ExceptionalDescription"] = exp.Message; Response.Redirect("Common/MistakesPage.aspx"); } } else { labMessage.Text = "请输入用户名!"; } }