public JsonResult List(int page, int rows, string orderNum, int orderStatus) { OrderPurchasingQuery opQuery = new OrderPurchasingQuery(); opQuery = new OrderPurchasingQuery() { PageSize = rows, PageNo = page, status = orderStatus, orderNum = orderNum, ShopId = base.CurrentSellerManager.ShopId.ToString() }; PageModel <OrderPurchasing> opModel = ServiceHelper.Create <IOrderPurchasingService>().GetOrderPurchasingList(opQuery); var array = from item in opModel.Models.ToArray() select new { Id = item.Id, ProductName = item.ProductName, OrderNum = item.OrderNum, //ProductPrice = item.Price, ProductPrice = (decimal.Parse(item.ProductPrice) * decimal.Parse(item.ProductCount.ToString())).ToString("0.00"), Status = item.Status, ProductCount = item.ProductCount, Email = item.Email, CompanyName = item.CompanyName }; return(Json(new { rows = array, total = opModel.Total })); }
public JsonResult List(int page, int rows, string orderNum, int orderStatus, string startTime, string endTime) { OrderPurchasingQuery opQuery = new OrderPurchasingQuery(); DateTime dt; if (DateTime.TryParse(startTime, out dt) && DateTime.TryParse(endTime, out dt)) { opQuery = new OrderPurchasingQuery() { PageSize = rows, PageNo = page, beginTime = DateTime.Parse(startTime), endTime = DateTime.Parse(endTime), status = orderStatus, orderNum = orderNum }; } else { opQuery = new OrderPurchasingQuery() { PageSize = rows, PageNo = page, status = orderStatus, orderNum = orderNum }; } PageModel <OrderPurchasing> opModel = ServiceHelper.Create <IOrderPurchasingService>().GetOrderPurchasingList(opQuery); var array = from item in opModel.Models.ToArray() select new { Id = item.Id, ProductName = item.ProductName, OrderNum = item.OrderNum, ProductPrice = item.ProductPrice, Status = item.Status, ProductCount = item.ProductCount, Email = item.Email, CompanyName = item.CompanyName }; return(Json(new { rows = array, total = opModel.Total })); }
/// <summary> /// 采购订单列表查询 /// </summary> /// <param name="opQuery"></param> /// <returns></returns> public Model.PageModel <OrderPurchasing> GetOrderPurchasingList(OrderPurchasingQuery opQuery) { int num = 0; IQueryable <OrderPurchasing> orderP = context.OrderPurchasing.AsQueryable <OrderPurchasing>(); if (!string.IsNullOrWhiteSpace(opQuery.orderNum)) { orderP = from d in orderP where d.OrderNum.Contains(opQuery.orderNum) orderby d.OrderTime descending select d; } if (!string.IsNullOrWhiteSpace(opQuery.status.ToString()) && opQuery.status != -1) { orderP = from d in orderP where d.Status == opQuery.status orderby d.OrderTime descending select d; } if (!string.IsNullOrWhiteSpace(opQuery.beginTime.ToString()) && !opQuery.beginTime.ToString().Contains("0001/1/1 0:00:00")) { orderP = from d in orderP where d.BeginTime >= opQuery.beginTime orderby d.OrderTime descending select d; } if (!string.IsNullOrWhiteSpace(opQuery.endTime.ToString()) && !opQuery.endTime.ToString().Contains("0001/1/1 0:00:00")) { orderP = from d in orderP where d.EndTime < opQuery.endTime orderby d.OrderTime descending select d; } if (!string.IsNullOrWhiteSpace(opQuery.userId.ToString()) && opQuery.userId != 0) { orderP = from d in orderP where d.UserId == opQuery.userId orderby d.OrderTime descending select d; } orderP = orderP.GetPage(out num, opQuery.PageNo, opQuery.PageSize, (IQueryable <OrderPurchasing> d) => from o in d orderby o.OrderTime descending select o); return(new PageModel <OrderPurchasing>() { Models = orderP, Total = num }); }
/// <summary> /// 我的订单管理列表 /// </summary> /// <param name="orderDate"></param> /// <param name="orderStatus"></param> /// <param name="pageSize"></param> /// <param name="pageNo"></param> /// <param name="productName"></param> /// <returns></returns> public ActionResult ManageMent(string starttime, string endtime, int orderStatus = -1, int pageSize = 10, int pageNo = 1, string orderNum = "") { OrderPurchasingQuery opQuery = new OrderPurchasingQuery(); DateTime dt; if (DateTime.TryParse(starttime, out dt) && DateTime.TryParse(endtime, out dt)) { opQuery = new OrderPurchasingQuery() { userId = base.CurrentUser.Id, PageSize = pageSize, PageNo = pageNo, beginTime = DateTime.Parse(starttime), endTime = DateTime.Parse(endtime), status = orderStatus, orderNum = orderNum }; } else { opQuery = new OrderPurchasingQuery() { userId = base.CurrentUser.Id, PageSize = pageSize, PageNo = pageNo, status = orderStatus, orderNum = orderNum }; } PageModel <OrderPurchasing> opModel = ServiceHelper.Create <IOrderPurchasingService>().GetOrderPurchasingList(opQuery); PagingInfo pagingInfo = new PagingInfo() { CurrentPage = pageNo, ItemsPerPage = pageSize, TotalItems = opModel.Total }; ViewBag.pageInfo = pagingInfo; return(View(opModel.Models)); }