Example #1
0
        public ActionResult TestNk()
        {
            string userID = "o0J0Jt4FeIf0Rbrwgv1aKG4ULRS4";

            IEnumerable<dynamic> list = new WeShopService().Query_OrderList(userID);

            //准备数据
            var vGroup = list.GroupBy(x => x.ID);

            return Content(JsonConvert.SerializeObject(vGroup));
        }
Example #2
0
        public ActionResult TestNm()
        {
            string beOrderID = "4bbe8ed6bf34482a9a8a2e469e43fe80,";

            //获取订单数据
            IEnumerable<dynamic> vResult = new WeShopService().Query_BeOrderInfo(beOrderID);

            //拼凑
            string strPar = string.Empty;
            string strOrderNum = string.Empty;
            string strCommTitle = string.Empty;
            foreach (var item in vResult.GroupBy(x => x.BeOrderID))
            {
                var vItem = item.ElementAt(0);
                strPar += string.Format("订单号:{0};商品名称:{1};总价:{2}", vItem.OrderNum, vItem.Title, vItem.RealPrice);
                strOrderNum += vItem.OrderNum + ",";
                strCommTitle += vItem.Title + ",";
            }

            float totalPrice = 0f;
            foreach (var vItem in vResult)
            {
                totalPrice += vItem.Count * vItem.RealUnitPrice;
            }

            ViewBag.BeOrderLine = vResult;
            ViewBag.TotalPrice = totalPrice;
            ViewBag.StoreName = vResult.ElementAtOrDefault(0) != null ? vResult.ElementAtOrDefault(0).StoreName : string.Empty;
            ViewBag.OrderNum = string.IsNullOrEmpty(strOrderNum) ? string.Empty : strOrderNum.TrimEnd(',');
            ViewBag.CommTitle = string.IsNullOrEmpty(strCommTitle) ? string.Empty : strCommTitle.TrimEnd(',');
            ViewBag.Param = strPar;

            return Content(string.Empty);
        }
Example #3
0
        public ActionResult TestNh()
        {
            string userid = "o0J0Jt4FeIf0Rbrwgv1aKG4ULRS4";

            //1.首次加载:购物车数据
            List<dynamic> list = new WeShopService().Query_ShopOrderList(userid).ToList();

            //准备数据
            float sumPrice = 0;
            foreach (var item in list)
            {
                sumPrice += item.RealPrice;
            }
            ViewBag.SumPrice = sumPrice;
            var vGroup = list.GroupBy(x => x.StoreName);

            return Content(string.Empty);
        }