public EasyUiGrid<Sample> GetSamples(SimpleFilter filter,int uid,int pageSize,int pageIndex,ref int recordCount) { List<Sample> samples = _SampleRepository.GetSamples(filter,uid,pageSize,pageIndex,ref recordCount); EasyUiGrid<Sample> list = new EasyUiGrid<Sample>(); list.total = samples.Count; list.rows = samples; return list; }
private void QuerySamples() { try{ SimpleFilter filter = new SimpleFilter { ProjId = GetRequest("projid"), SimpleType = GetRequest("sampletype").ToInt32(), SerialNum = GetRequest("serialnum"), WTDW = GetRequest("wtdw"), SGDW = GetRequest("sgdw"), JZDW = GetRequest("jzdw"), JZR = GetRequest("jzr"), Status = GetRequest("status").ToInt32(-1) }; int recordCount = 0; EasyUiGrid<Sample> samples = _SampleService.GetSamples(filter,PageSize,PageIndex,ref recordCount); samples.total = recordCount; Json(samples); } catch(Exception ex){ Json(new {errorMsg = ex.Message}); } }
private void GetSamples() { try{ int recordCount = 0; SimpleFilter filter = new SimpleFilter(); EasyUiGrid<Sample> samples = _SampleService.GetSamples(filter,UserContext.Instance.CurrentUser.Uid,PageSize,PageIndex,ref recordCount); samples.total = recordCount; Json(samples); } catch(Exception ex){ Json(new {errorMsg = ex.Message}); } }
private string GetSearchCondition(SimpleFilter filter) { StringBuilder condition = new StringBuilder("1=1"); if(!filter.ProjId.IsNullOrEmpty()){ condition.Append(string.Format(" and ProjId like '%{0}%'",filter.ProjId.Trim().ToSafeSql())); } if(!filter.ProjName.IsNullOrEmpty()){ condition.Append(string.Format(" and ProjName like '%{0}%'",filter.ProjName.Trim().ToSafeSql())); } if(!filter.Name.IsNullOrEmpty()){ condition.Append(string.Format(" and name like '%{0}%'",filter.Name.Trim().ToSafeSql())); } if(!filter.WTDW.IsNullOrEmpty()){ condition.Append(string.Format(" and wtdw like '%{0}%'",filter.WTDW.Trim().ToSafeSql())); } if(!filter.SGDW.IsNullOrEmpty()){ condition.Append(string.Format(" and sgdw like '%{0}%'",filter.SGDW.Trim().ToSafeSql())); } if(!filter.JZDW.IsNullOrEmpty()){ condition.Append(string.Format(" and jzdw like '%{0}%'",filter.JZDW.Trim().ToSafeSql())); } if(!filter.JZR.IsNullOrEmpty()){ condition.Append(string.Format(" and jzr like '%{0}%'",filter.JZR.Trim().ToSafeSql())); } if(!filter.SerialNum.IsNullOrEmpty()){ condition.Append(string.Format(" and SerialNum like '%{0}%'",filter.SerialNum.Trim().ToSafeSql())); } if(filter.Status != -1){ condition.Append(string.Format(" and status={0}",filter.Status)); } if(!filter.OtherFilterStr.IsNullOrEmpty()){ condition.Append(string.Format(" and {0}",filter.OtherFilterStr.Trim().ToSafeSql())); } if(filter.SimpleType > 0){ condition.AppendFormat(" and sampletype={0}",filter.SimpleType); } return condition.ToString(); }
public List<Sample> GetSamples(SimpleFilter filter,int uid,int pageSize,int pageIndex,ref int recordCount) { filter.OtherFilterStr = @" ProjId in ( select ProjId from RolesProjRight where RolesId in ( select RolesId from UserRoles where Uid=" + uid + "))"; List<Sample> list = new List<Sample>(); list = GetSamples(filter,pageSize,pageIndex,ref recordCount); return list; }
public List<Sample> GetSamples(SimpleFilter filter,int pageSize,int pageIndex,ref int recordCount) { SqlParameter[] parameters = { SqlParamHelper.MakeParam("@RecordNum",SqlDbType.Int,4,ParameterDirection.InputOutput,recordCount), SqlParamHelper.MakeInParam("@SelectList",SqlDbType.VarChar,2000,VIEW_SAMPLE_FIELDS), SqlParamHelper.MakeInParam("@TableSource",SqlDbType.VarChar,100,"[View_Sample]"), SqlParamHelper.MakeInParam("@SearchCondition",SqlDbType.VarChar,2000,GetSearchCondition(filter)), SqlParamHelper.MakeInParam("@OrderExpression",SqlDbType.VarChar,1000,"[Sid]"), SqlParamHelper.MakeInParam("@PageSize",SqlDbType.Int,4,pageSize), SqlParamHelper.MakeInParam("@PageIndex",SqlDbType.Int,4,pageIndex) }; List<Sample> list = new List<Sample>(); using (IDataReader dr = SqlHelper.ExecuteReader(ReadConnectionString,CommandType.StoredProcedure,"PR_GetDataByPageIndex",parameters)){ while(dr.Read()){ list.Add(BindSample(dr)); } } recordCount = Convert.ToInt32(parameters[0].Value); return list; }
public List<Sample> GetSampleList(SimpleFilter filter,int pageSize,int pageIndex,ref int recordCount) { return _SampleRepository.GetSamples(filter,pageSize,pageIndex,ref recordCount); }
private void GetProjectList(string num) { int recordCount = 0; string keyword = Server.UrlDecode(GetRequestString("q")); List<ProjAPI> list = new List<ProjAPI>(); SimpleFilter filter = new SimpleFilter(); filter.ProjName = keyword; filter.Status = -1; List<Sample> projList = _SampleService.GetSampleList(filter,PageSize,PageIndex,ref recordCount); IEnumerable<IGrouping<string,Sample>> groupList = projList.GroupBy(t => t.ProjId); foreach(IGrouping<string,Sample> group in groupList){ List<SampleAPI> sampleApiList = new List<SampleAPI>(); foreach(var sample in group){ string cid = string.IsNullOrEmpty(sample.EPC) ? "未绑定" : sample.EPC; sampleApiList.Add(new SampleAPI {Sid = sample.Sid,Name = sample.Name,SampleType = sample.SampleType,Cid = cid,SerialNum = sample.SerialNum}); } list.Add(new ProjAPI {ProjId = group.FirstOrDefault().ProjId,ProjName = group.FirstOrDefault().ProjName,SampleAPI = sampleApiList}); } Json(list); }