//public easyuiGridDto<BusinessProgress> GetMsgByDate(string page, string rows,DateTime beginDate,DateTime endDate, BusinessSearchDto searchDto) public easyuiFootGridDto <BusinessProgress, ProgressFootDto> GetMsgByDate(string page, string rows, DateTime beginDate, DateTime endDate, BusinessSearchDto searchDto) { int _page = int.Parse(page); int _rows = int.Parse(rows); IQueryable <BusinessProgress> list = this.db.BusinessProgresses.Where(b => (!string.IsNullOrEmpty(searchDto.OrderNo) ? b.PS == searchDto.OrderNo : true) && (!string.IsNullOrEmpty(searchDto.StyleNo) ? b.DT == searchDto.StyleNo : true) && (!string.IsNullOrEmpty(searchDto.ModelNo) ? b.Model == searchDto.ModelNo : true) && (!string.IsNullOrEmpty(searchDto.BrandNo) ? b.Brand.Contains(searchDto.BrandNo) : true) && (!string.IsNullOrEmpty(searchDto.OrderTypeNo) ? b.OrderType == searchDto.OrderTypeNo : true) && b.packShipState == 0 //&& (new int?[] { 0,-1}).Contains(System.Data.Objects.SqlClient.SqlFunctions.DateDiff("ww", (DateTime)b.PeopleDelivery, Today)) && b.PeopleDelivery >= beginDate && b.PeopleDelivery <= endDate && b.PS != null && b.Quantity > 0 ).OrderBy(b => b.Id); int?_total = list.Count(); var foot = new ProgressFootDto { PS = "数量合计:", DT = list.Sum(b => b.Quantity).ToString() }; var data = list.Skip((_page - 1) * _rows).Take(_rows).ToList(); return(new easyuiFootGridDto <BusinessProgress, ProgressFootDto> { total = _total, rows = data, footer = new List <ProgressFootDto> { foot } }); }
public easyuiFootGridDto <BusinessProgress, ProgressFootDto> GetListBySearch(string rows, string page, string doSearch, BusinessSearchDto searchDto) { if (doSearch == "do") { int _page = int.Parse(page); int _rows = int.Parse(rows); DateTime beginDate = DateTime.Parse(DateTime.Now.ToShortDateString().ToString()); DateTime?endDate = null; if (!string.IsNullOrEmpty(searchDto.AfterDates)) { endDate = Convert.ToDateTime(DateTime.Now.AddDays(double.Parse(searchDto.AfterDates)).ToShortDateString().ToString()); } IQueryable <BusinessProgress> list = this.db.BusinessProgresses.Where(b => (!string.IsNullOrEmpty(searchDto.OrderNo) ? b.PS == searchDto.OrderNo : true) && (!string.IsNullOrEmpty(searchDto.StyleNo) ? b.DT == searchDto.StyleNo : true) && (!string.IsNullOrEmpty(searchDto.ModelNo) ? b.Model == searchDto.ModelNo : true) && (!string.IsNullOrEmpty(searchDto.BrandNo) ? b.Brand.Contains(searchDto.BrandNo) : true) && (!string.IsNullOrEmpty(searchDto.OrderTypeNo) ? b.OrderType == searchDto.OrderTypeNo : true) && (!string.IsNullOrEmpty(searchDto.AfterDates) ? b.PeopleDelivery >= beginDate : true) && (!string.IsNullOrEmpty(searchDto.AfterDates) ? b.PeopleDelivery <= endDate : true) //加入System.Data.Entity //&& (System.Data.Objects.SqlClient.SqlFunctions.DateDiff()) && (searchDto.Finished == "yes" ? true : b.packShipState == 0) && b.PS != null && b.Quantity > 0 ).OrderBy(g => g.Id); int?_total = list.Count(); var foot = new ProgressFootDto { PS = "数量合计:", DT = list.Sum(b => b.Quantity).ToString() }; var data = list .Skip((_page - 1) * _rows) .Take(_rows) .ToList(); //footer与formater之间的格式会冲突,即js中formater,不但格式化单元格内容,还会把footer中的数据格式化 return(new easyuiFootGridDto <BusinessProgress, ProgressFootDto> { total = _total, rows = data, footer = new List <ProgressFootDto> { foot } }); } else { return(new easyuiFootGridDto <BusinessProgress, ProgressFootDto> { total = 0, rows = this.GetAll().Where(b => b.Id == -1).OrderBy(b => b.PS).ToList(), footer = null }); } }
//public easyuiGridDto<BusinessProgress> GetLaterMsg(string page,string rows, BusinessSearchDto searchDto) public easyuiFootGridDto <BusinessProgress, ProgressFootDto> GetLaterMsg(string page, string rows, BusinessSearchDto searchDto) { int _page = int.Parse(page); int _rows = int.Parse(rows); DateTime Today = DateTime.Parse(DateTime.Now.ToShortDateString().ToString()); IQueryable <BusinessProgress> list = this.db.BusinessProgresses.Where(b => (!string.IsNullOrEmpty(searchDto.OrderNo) ? b.PS == searchDto.OrderNo : true) && (!string.IsNullOrEmpty(searchDto.StyleNo) ? b.DT == searchDto.StyleNo : true) && (!string.IsNullOrEmpty(searchDto.ModelNo) ? b.Model == searchDto.ModelNo : true) && (!string.IsNullOrEmpty(searchDto.BrandNo) ? b.Brand.Contains(searchDto.BrandNo) : true) && (!string.IsNullOrEmpty(searchDto.OrderTypeNo) ? b.OrderType == searchDto.OrderTypeNo : true) && b.packShipState == 0 && b.PeopleDelivery < Today && b.PS != null && b.Quantity > 0).OrderBy(b => b.Id); int?_total = list.Count(); var foot = new ProgressFootDto { PS = "数量合计:", DT = list.Sum(b => b.Quantity).ToString() }; var data = list.Skip((_page - 1) * _rows).Take(_rows).ToList(); return(new easyuiFootGridDto <BusinessProgress, ProgressFootDto> { total = _total, rows = data, footer = new List <ProgressFootDto> { foot } }); }