public static string DoUsersSearch(string strLoginId, string strName, string status, string CurrentPageIndex, string PageSize) { if (HttpContext.Current.Session[SysConst.S_LOGIN_USER] == null) { return(""); } string json = string.Empty; try { Hashtable where = new Hashtable(); if (!string.IsNullOrEmpty(strLoginId)) { where.Add(UsersArgs.USERNAME, strLoginId); } if (!string.IsNullOrEmpty(status)) { where.Add(UsersArgs.STATUS, Convert.ToInt32(status)); } where.Add(UsersArgs.OrderBy, "createdate desc"); SearchArgs args = new SearchArgs(); args.CurrentIndex = int.Parse(CurrentPageIndex); args.PageSize = int.Parse(PageSize); var list = FGA_BLL.UsersBLL.GetUsersListByPage(where, args); DataReWrite datausers = new DataReWrite(); List <UserReWrite> userRelist = new List <UserReWrite>(); if (list != null && list.Count > 0) { datausers.totalRecord = args.TotalRecords; foreach (UsersModel um in list) { UserReWrite ur = new UserReWrite(); ur.USERID = um.USERID; ur.USERNAME = um.USERNAME; ur.rolename = ConvertToRoleName(um.USERID); ur.CREATEDATE = FGA_NUtility.Convertor.ToDateString(um.CREATEDATE, false); ur.STATUS = FGA_NUtility.Convertor.GetEnumName(typeof(FGA_NUtility.Enums.CommonState), um.STATUS); userRelist.Add(ur); } datausers.userlist = userRelist; JavaScriptSerializer jssl = new JavaScriptSerializer(); json = jssl.Serialize(datausers); } } catch (Exception ex) { //Utility.SysLog.WriteException(GetType().Name, ex); } return(json); }
public static string DoUsersSearch(string name, string status, string CurrentPageIndex, string PageSize) { if (HttpContext.Current.Session[SysConst.S_LOGIN_USER] == null) { return(""); } string json = string.Empty; try { Hashtable where = new Hashtable(); if (!string.IsNullOrEmpty(name)) { where.Add(RolesArgs.rname, name); } if (!string.IsNullOrEmpty(status)) { where.Add(RolesArgs.state, Convert.ToInt32(status)); } SearchArgs args = new SearchArgs(); args.CurrentIndex = int.Parse(CurrentPageIndex); args.PageSize = int.Parse(PageSize); var list = FGA_BLL.RolesBLL.GetRolesListByPage(where, args); DataReWrite dataroles = new DataReWrite(); List <RoleReWrite> roleRelist = new List <RoleReWrite>(); if (list != null && list.Count > 0) { dataroles.totalRecord = args.TotalRecords; foreach (RolesModel rm in list) { RoleReWrite ur = new RoleReWrite(); ur.rid = rm.rid; ur.rgroup = rm.rgroup; ur.rname = rm.rname; ur.state = FGA_NUtility.Convertor.GetEnumName(typeof(FGA_NUtility.Enums.CommonState), rm.state); roleRelist.Add(ur); } dataroles.rolelist = roleRelist; JavaScriptSerializer jssl = new JavaScriptSerializer(); json = jssl.Serialize(dataroles); } } catch (Exception ex) { //Utility.SysLog.WriteException(GetType().Name, ex); } return(json); }