Example #1
0
        public JsonResult GetOrderList(string skey = "", Himall.Entities.GiftOrderInfo.GiftOrderStatus?status = null, int page = 1, int pagesize = 10)
        {
            if (CurrentUser == null)
            {
                throw new HimallException("错误的用户信息");
            }
            int             rows  = pagesize;
            GiftsOrderQuery query = new GiftsOrderQuery();

            query.Skey = skey;
            if (status != null)
            {
                if ((int)status != 0)
                {
                    query.Status = status;
                }
            }
            query.UserId   = CurrentUser.Id;
            query.PageSize = rows;
            query.PageNo   = page;
            var orderdata = _iGiftsOrderService.GetOrders(query);
            List <Himall.Entities.GiftOrderInfo> orderlist = orderdata.Models.ToList();
            //_iGiftsOrderService.OrderAddUserInfo(orderlist);
            var result = orderlist.ToList();

            Mapper.CreateMap <GiftOrderInfo, GiftsOrderDtoModel>();
            Mapper.CreateMap <GiftOrderItemInfo, GiftsOrderItemDtoModel>();
            List <GiftsOrderDtoModel> pagedata = new List <GiftsOrderDtoModel>();

            foreach (var order in result)
            {
                order.Address     = ClearHtmlString(order.Address);
                order.CloseReason = ClearHtmlString(order.CloseReason);
                order.UserRemark  = ClearHtmlString(order.UserRemark);

                var tmpordobj = Mapper.Map <GiftsOrderDtoModel>(order);
                tmpordobj.Items = new List <GiftsOrderItemDtoModel>();
                var orderitems = _iGiftsOrderService.GetOrderItemByOrder(order.Id);
                foreach (var subitem in orderitems)
                {
                    var tmporditemobj = Mapper.Map <GiftsOrderItemDtoModel>(subitem);
                    tmporditemobj.DefaultImage = HimallIO.GetRomoteProductSizeImage(tmporditemobj.ImagePath, 1, ImageSize.Size_150.GetHashCode());
                    tmpordobj.Items.Add(tmporditemobj);
                }
                pagedata.Add(tmpordobj);
            }

            var pageresult = SuccessResult(data: new
            {
                total = orderdata.Total,
                rows  = pagedata
            });

            return(pageresult);
        }
        public JsonResult OrderList(string skey, GiftOrderInfo.GiftOrderStatus?status, int rows, int page)
        {
            GiftsOrderQuery query = new GiftsOrderQuery();

            query.skey     = skey;
            query.status   = status;
            query.PageSize = rows;
            query.PageNo   = page;
            var orderdata = _iGiftsOrderService.GetOrders(query);
            List <GiftOrderInfo> orderlist = orderdata.Models.ToList();

            _iGiftsOrderService.OrderAddUserInfo(orderlist);
            var datalist = orderlist.Select(d =>
            {
                var orditem = d.Himall_GiftOrderItem.FirstOrDefault();
                return(new GiftOrderPageModel
                {
                    Id = d.Id,
                    OrderStatus = d.OrderStatus,
                    UserId = d.UserId,
                    UserRemark = ClearHtmlString(d.UserRemark),
                    ShipTo = d.ShipTo,
                    CellPhone = d.CellPhone,
                    TopRegionId = d.TopRegionId,
                    RegionId = d.RegionId,
                    RegionFullName = d.RegionFullName,
                    Address = ClearHtmlString(d.Address),
                    ExpressCompanyName = d.ExpressCompanyName,
                    ShipOrderNumber = d.ShipOrderNumber,
                    ShippingDate = d.ShippingDate,
                    OrderDate = d.OrderDate,
                    FinishDate = d.FinishDate,
                    TotalIntegral = d.TotalIntegral,
                    CloseReason = ClearHtmlString(d.CloseReason),
                    FirstGiftId = orditem.GiftId,
                    FirstGiftName = ClearHtmlString(orditem.GiftName),
                    FirstGiftBuyQuantity = orditem.Quantity,
                    UserName = d.UserName
                });
            });
            var result = new { rows = datalist.ToList(), total = orderdata.Total };

            return(Json(result));
        }
Example #3
0
        public JsonResult OrderList(string skey, GiftOrderInfo.GiftOrderStatus?status, int rows, int page)
        {
            GiftsOrderQuery giftsOrderQuery = new GiftsOrderQuery()
            {
                skey     = skey,
                status   = status,
                PageSize = rows,
                PageNo   = page
            };
            PageModel <GiftOrderInfo> orders = orderser.GetOrders(giftsOrderQuery);
            List <GiftOrderInfo>      list   = orders.Models.ToList();

            orderser.OrderAddUserInfo(list);
            IEnumerable <GiftOrderPageModel> giftOrderPageModels = list.Select <GiftOrderInfo, GiftOrderPageModel>((GiftOrderInfo d) => {
                GiftOrderItemInfo giftOrderItemInfo = d.ChemCloud_GiftOrderItem.FirstOrDefault();
                return(new GiftOrderPageModel()
                {
                    Id = d.Id,
                    OrderStatus = d.OrderStatus,
                    UserId = d.UserId,
                    UserRemark = ClearHtmlString(d.UserRemark),
                    ShipTo = d.ShipTo,
                    CellPhone = d.CellPhone,
                    TopRegionId = d.TopRegionId,
                    RegionId = d.RegionId,
                    RegionFullName = d.RegionFullName,
                    Address = ClearHtmlString(d.Address),
                    ExpressCompanyName = d.ExpressCompanyName,
                    ShipOrderNumber = d.ShipOrderNumber,
                    ShippingDate = d.ShippingDate,
                    OrderDate = d.OrderDate,
                    FinishDate = d.FinishDate,
                    TotalIntegral = d.TotalIntegral,
                    CloseReason = ClearHtmlString(d.CloseReason),
                    FirstGiftId = giftOrderItemInfo.GiftId,
                    FirstGiftName = ClearHtmlString(giftOrderItemInfo.GiftName),
                    FirstGiftBuyQuantity = giftOrderItemInfo.Quantity,
                    UserName = d.UserName
                });
            });
            var variable = new { rows = giftOrderPageModels.ToList(), total = orders.Total };

            return(Json(variable));
        }
        public ActionResult OrderList(string skey, GiftOrderInfo.GiftOrderStatus?status, int page = 1)
        {
            int             num             = 12;
            GiftsOrderQuery giftsOrderQuery = new GiftsOrderQuery()
            {
                skey = skey
            };

            if (status.HasValue && status.Value != 0)
            {
                giftsOrderQuery.status = status;
            }
            giftsOrderQuery.UserId   = new long?(base.CurrentUser.Id);
            giftsOrderQuery.PageSize = num;
            giftsOrderQuery.PageNo   = page;
            PageModel <GiftOrderInfo> orders = orderser.GetOrders(giftsOrderQuery);
            PagingInfo pagingInfo            = new PagingInfo()
            {
                CurrentPage  = page,
                ItemsPerPage = num,
                TotalItems   = orders.Total
            };
            PagingInfo           pagingInfo1 = pagingInfo;
            List <GiftOrderInfo> list        = orders.Models.ToList();

            if (list.Count > 0)
            {
                ViewBag.pageInfo = pagingInfo1;
                orderser.OrderAddUserInfo(list);
                List <GiftOrderInfo> giftOrderInfos = list.ToList();
                foreach (GiftOrderInfo giftOrderInfo in giftOrderInfos)
                {
                    giftOrderInfo.Address     = ClearHtmlString(giftOrderInfo.Address);
                    giftOrderInfo.CloseReason = ClearHtmlString(giftOrderInfo.CloseReason);
                    giftOrderInfo.UserRemark  = ClearHtmlString(giftOrderInfo.UserRemark);
                }
                return(View(giftOrderInfos));
            }
            else
            {
                return(RedirectToAction("Error", "UserIntegral"));
            }
        }
        public ActionResult OrderList(string skey, Mall.Entities.GiftOrderInfo.GiftOrderStatus?status, int page = 1)
        {
            int             rows  = 12;
            GiftsOrderQuery query = new GiftsOrderQuery();

            query.Skey = skey;
            if (status != null)
            {
                if ((int)status != 0)
                {
                    query.Status = status;
                }
            }
            query.UserId   = CurrentUser.Id;
            query.PageSize = rows;
            query.PageNo   = page;
            var orderdata = _iGiftsOrderService.GetOrders(query);
            var info      = new PagingInfo
            {
                CurrentPage  = page,
                ItemsPerPage = rows,
                TotalItems   = orderdata.Total
            };
            var orderlist = orderdata.Models;

            ViewBag.pageInfo = info;
            _iGiftsOrderService.OrderAddUserInfo(orderlist);
            var result = orderlist;

            foreach (var item in result)
            {
                item.Address     = ClearHtmlString(item.Address);
                item.CloseReason = ClearHtmlString(item.CloseReason);
                item.UserRemark  = ClearHtmlString(item.UserRemark);
            }
            ViewBag.OrderItems = _iGiftsOrderService.GetOrderItemByOrder(orderlist.Select(p => p.Id).ToList());
            return(View(result));
        }