| | |
| | | catch { } |
| | | } |
| | | |
| | | Expression<Func<DtStockInfo, bool>> locationStatus = null; |
| | | Expression<Func<DtStockInfo, bool>> floor = null; |
| | | Expression<Func<DtStockInfo, bool>> areaId = null; |
| | | Expression<Func<DtStockInfo, bool>> materielCode = null; |
| | | Expression<Func<DtStockInfo, bool>> materielName = null; |
| | | Expression<Func<DtStockInfo, bool>> demandClassification = null; |
| | | foreach (var item in searchParametersList) |
| | | { |
| | | if (item.Name.Contains("locationStatus")) |
| | | { |
| | | locationStatus = x => x.LocationInfo.LocationStatus == Convert.ToInt32(item.Value); |
| | | } |
| | | else if (item.Name.Contains("areaId")) |
| | | { |
| | | areaId = x => x.LocationInfo.AreaId == Convert.ToInt32(item.Value); |
| | | } |
| | | else if (item.Name.Contains("materielCode")) |
| | | { |
| | | materielCode = x => x.StockInfoDetails.Any(d => d.MaterielCode.Contains(item.Value)); |
| | | } |
| | | else if (item.Name.Contains("materielName")) |
| | | { |
| | | materielName = x => x.StockInfoDetails.Any(d => d.MaterielName.Contains(item.Value)); |
| | | } |
| | | else if (item.Name.Contains("demandClassification")) |
| | | { |
| | | demandClassification = x => x.StockInfoDetails.Any(d => d.DemandClassification.Contains(item.Value)); |
| | | } |
| | | } |
| | | //Expression<Func<DtStockInfo, bool>> locationStatus = null; |
| | | //Expression<Func<DtStockInfo, bool>> floor = null; |
| | | //Expression<Func<DtStockInfo, bool>> areaId = null; |
| | | //Expression<Func<DtStockInfo, bool>> materielCode = null; |
| | | //Expression<Func<DtStockInfo, bool>> materielName = null; |
| | | //Expression<Func<DtStockInfo, bool>> demandClassification = null; |
| | | //foreach (var item in searchParametersList) |
| | | //{ |
| | | // if (item.Name.Contains("locationStatus")) |
| | | // { |
| | | // locationStatus = x => x.LocationInfo.LocationStatus == Convert.ToInt32(item.Value); |
| | | // } |
| | | // else if (item.Name.Contains("areaId")) |
| | | // { |
| | | // areaId = x => x.LocationInfo.AreaId == Convert.ToInt32(item.Value); |
| | | // } |
| | | // else if (item.Name.Contains("materielCode")) |
| | | // { |
| | | // materielCode = x => x.StockInfoDetails.Any(d => d.MaterielCode.Contains(item.Value)); |
| | | // } |
| | | // else if (item.Name.Contains("materielName")) |
| | | // { |
| | | // materielName = x => x.StockInfoDetails.Any(d => d.MaterielName.Contains(item.Value)); |
| | | // } |
| | | // else if (item.Name.Contains("demandClassification")) |
| | | // { |
| | | // demandClassification = x => x.StockInfoDetails.Any(d => d.DemandClassification.Contains(item.Value)); |
| | | // } |
| | | //} |
| | | //.IncludesAllFirstLayer() |
| | | var data = BaseDal.Db.Queryable<DtStockInfo>() |
| | | .Includes(x => x.StockInfoDetails) |
| | | .Includes(x => x.LocationInfo) |
| | | //.Includes(x => x.StockInfoDetails) |
| | | //.Includes(x => x.LocationInfo) |
| | | .WhereIF(!wheres.IsNullOrEmpty(), wheres) |
| | | .WhereIF(locationStatus != null, locationStatus) |
| | | .WhereIF(floor != null, floor) |
| | | .WhereIF(areaId != null, areaId) |
| | | .WhereIF(materielCode != null, materielCode) |
| | | .WhereIF(materielName != null, materielName) |
| | | .WhereIF(demandClassification != null, demandClassification) |
| | | //.WhereIF(locationStatus != null, locationStatus) |
| | | //.WhereIF(floor != null, floor) |
| | | //.WhereIF(areaId != null, areaId) |
| | | //.WhereIF(materielCode != null, materielCode) |
| | | //.WhereIF(materielName != null, materielName) |
| | | //.WhereIF(demandClassification != null, demandClassification) |
| | | .OrderBy(orderByModels) |
| | | .ToPageList(options.Page, options.Rows, ref totalCount); |
| | | new PageGridData<DtStockInfo>(totalCount, data); |