public PartialViewResult OrderList(int pageIndex = 1, string viewName = "_OrderList") { Maticsoft.BLL.Shop.Order.Orders orders = new Maticsoft.BLL.Shop.Order.Orders(); Maticsoft.BLL.Shop.Order.OrderItems items = new Maticsoft.BLL.Shop.Order.OrderItems(); int pageSize = 8; int startIndex = (pageIndex > 1) ? (((pageIndex - 1) * pageSize) + 1) : 0; int endIndex = pageIndex * pageSize; int totalItemCount = 0; totalItemCount = orders.GetRecordCount(" BuyerID=" + base.CurrentUser.UserID); if (totalItemCount < 1) { return base.PartialView(viewName); } List<OrderInfo> list = orders.GetListByPageEX("BuyerID=" + base.CurrentUser.UserID, "", startIndex, endIndex); if ((list != null) && (list.Count > 0)) { foreach (OrderInfo info in list) { info.OrderItems = items.GetModelList(" OrderId=" + info.OrderId); } } PagedList<OrderInfo> model = new PagedList<OrderInfo>(list, pageIndex, pageSize, totalItemCount); if (base.Request.IsAjaxRequest()) { return this.PartialView(viewName, model); } return this.PartialView(viewName, model); }
public PartialViewResult OrderList(int pageIndex = 1, string viewName = "_OrderList") { Action<Maticsoft.Model.Shop.Order.OrderInfo> action = null; Maticsoft.BLL.Shop.Order.Orders orders = new Maticsoft.BLL.Shop.Order.Orders(); Maticsoft.BLL.Shop.Order.OrderItems itemBll = new Maticsoft.BLL.Shop.Order.OrderItems(); int pageSize = 10; int startIndex = (pageIndex > 1) ? (((pageIndex - 1) * pageSize) + 1) : 0; int endIndex = pageIndex * pageSize; int totalItemCount = 0; string strWhere = " BuyerID=" + base.CurrentUser.UserID + " AND OrderType=1"; totalItemCount = orders.GetRecordCount(strWhere); if (totalItemCount < 1) { return base.PartialView(viewName); } List<Maticsoft.Model.Shop.Order.OrderInfo> items = orders.GetListByPageEX(strWhere, "", startIndex, endIndex); if ((items != null) && (items.Count > 0)) { foreach (Maticsoft.Model.Shop.Order.OrderInfo info in items) { if (info.HasChildren && (info.PaymentStatus > 1)) { info.SubOrders = orders.GetModelList(" ParentOrderId=" + info.OrderId); if (action == null) { action = delegate (Maticsoft.Model.Shop.Order.OrderInfo info) { info.OrderItems = itemBll.GetModelList(" OrderId=" + info.OrderId); }; } info.SubOrders.ForEach(action); continue; } info.OrderItems = itemBll.GetModelList(" OrderId=" + info.OrderId); } } PagedList<Maticsoft.Model.Shop.Order.OrderInfo> model = new PagedList<Maticsoft.Model.Shop.Order.OrderInfo>(items, pageIndex, pageSize, totalItemCount); if (base.Request.IsAjaxRequest()) { return this.PartialView(viewName, model); } return this.PartialView(viewName, model); }