public static string SearchData(string CurrentPageIndex, string PageSize, string filter) { //分页查询 SearchArgs args = new SearchArgs(); args.CurrentIndex = int.Parse(CurrentPageIndex); args.PageSize = int.Parse(PageSize); int begin = args.StartIndex + 1; int end = args.StartIndex + args.PageSize; string res = string.Empty; try { string sql = "select [FirstName],[LastName],[PlexID],[Department] from " + "(SELECT ROW_NUMBER()OVER(ORDER BY FCI.FirstName) Indexs,FCI.* FROM [FGA_PlexUser_T] FCI WHERE 1=1"; //查询条件 if (!String.IsNullOrEmpty(filter)) { sql = sql + " and FCI.FirstName like '%" + filter + "%'"; } sql = sql + ") AA where AA.indexs between " + begin + " and " + end + " "; DataSet ds = new DataSet(); ds = FGA_DAL.Base.SQLServerHelper_WMS.Query(sql); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { List <PlexUserModel> luw = new List <PlexUserModel>(); foreach (DataRow row in ds.Tables[0].Rows) { PlexUserModel ERM = new PlexUserModel(row); luw.Add(ERM); } JavaScriptSerializer jssl = new JavaScriptSerializer(); res = jssl.Serialize(luw); res = res.Replace("\\/Date(", "").Replace(")\\/", ""); } } catch (Exception e) { } return(res); }
public static string getDepartment() { string res = string.Empty; string sql = "SELECT distinct [Department_Code] as Department FROM FGA_PlexDepartment_T order by [Department_Code]"; DataSet ds = new DataSet(); ds = FGA_DAL.Base.SQLServerHelper_WMS.Query(sql); if (ds != null && ds.Tables.Count > 0 && ds.Tables[0].Rows.Count > 0) { List <PlexUserModel> luw = new List <PlexUserModel>(); foreach (DataRow row in ds.Tables[0].Rows) { PlexUserModel ERM = new PlexUserModel(row); luw.Add(ERM); } JavaScriptSerializer jssl = new JavaScriptSerializer(); res = jssl.Serialize(luw); } return(res); }