Exemple #1
0
        public ActionResult order_success(AccountModels accountModels)
        {
            Session.Remove("has_pay");
            ShopBusinessLogic.MemberPurchase memberPurchase = new ShopBusinessLogic.MemberPurchase();
            ShopBusinessLogic.SellerSell     sellerSell     = new ShopBusinessLogic.SellerSell();
            var      account_list = accountModels.accountModeList;
            string   mem_phone    = Session["mem_phone"].ToString();
            DateTime now_time     = DateTime.Now;

            for (int i = 0; i < account_list.Count; ++i)
            {
                if (account_list[i].goods_num == 0)
                {
                    continue;
                }
                var now_plist_id = now_time.ToString("yyyyMMddHHmmssfff") + mem_phone;
                //string now_seller_phone = memberPurchase.getGoods(account_list[i].goods_id).seller_phone;
                memberPurchase.addPurchaseLists(now_plist_id, mem_phone, account_list[i].goods_id, account_list[i].goods_num, now_time, account_list[i].seller_phone);
                memberPurchase.deletePurchaseCar(mem_phone, account_list[i].goods_id);
                sellerSell.reduceStock(account_list[i].goods_id, account_list[i].goods_num);
                sellerSell.addVolume(account_list[i].goods_id, account_list[i].goods_num);
            }
            return(View(accountModels));
            //return Redirect("/PurchaseCar");//支付失败
        }
        public JsonResult SelectGoodsToBuy(PurchaseHomeTotalInfo purchaseHomeTotalInfo)
        {
            Session.Remove("ReturnToPurchaseCar");
            string mem_phone   = Session["mem_phone"].ToString();
            var    goods_items = purchaseHomeTotalInfo.selected_goods_list;

            ShopBusinessLogic.MemberPurchase memberPurchase = new ShopBusinessLogic.MemberPurchase();
            DateTime now_time = DateTime.Now;

            foreach (var goods in goods_items)
            {
                var plist_id = now_time.ToString("yyyyMMddHHmmssfff") + mem_phone;
                memberPurchase.addPurchaseLists(plist_id, mem_phone, goods.goods_id, goods.goods_num, now_time, goods.seller_phone);
                memberPurchase.deletePurchaseCar(mem_phone, goods.goods_id);
            }
            return(Json("购买商品成功"));
        }
Exemple #3
0
 public ActionResult order_success(AccountModels accountModels)
 {
     if (accountModels.score >= accountModels.all_price)
     {
         Session.Remove("has_pay");
         ShopBusinessLogic.MemberPurchase memberPurchase = new ShopBusinessLogic.MemberPurchase();
         var      account_list = accountModels.accountModeList;
         string   mem_phone    = Session["mem_phone"].ToString();
         DateTime now_time     = DateTime.Now;
         for (int i = 0; i < account_list.Count; ++i)
         {
             var now_plist_id = now_time.ToString("yyyyMMddHHmmssfff") + mem_phone;
             memberPurchase.addPurchaseLists(now_plist_id, mem_phone, account_list[i].goods_id, account_list[i].goods_num, now_time);
             memberPurchase.deletePurchaseCar(mem_phone, account_list[i].goods_id);
         }
         return(View(accountModels));
     }
     else
     {
         return(Redirect("/PurchaseCar"));
     }
 }
        public ActionResult  Index(string DeletePcarId)
        {
            Session.Remove("ReturnToPurchaseCar");
            string mem_phone = Session["mem_phone"].ToString();

            ShopBusinessLogic.MemberPurchase memberPurchase = new ShopBusinessLogic.MemberPurchase();
            memberPurchase.deletePurchaseCar(mem_phone, DeletePcarId);
            var pcar_list = memberPurchase.getPurchaseCarList(Session["mem_phone"].ToString()).Select(pcar_info => new MemberPurchaseCarViewModel()
            {
                goods_id       = pcar_info.goods_id,
                goods_num      = pcar_info.goods_num,
                goods_name     = memberPurchase.getGoods(pcar_info.goods_id).goods_name,
                goods_img_path = memberPurchase.getGoods(pcar_info.goods_id).goods_img_path,
                unit_price     = memberPurchase.getGoods(pcar_info.goods_id).goods_price,
                total_price    = memberPurchase.getGoods(pcar_info.goods_id).goods_price *pcar_info.goods_num,
            }).ToList();
            var resView = new MemberPurchaseCarViewModel()
            {
                mem_phone = Session["mem_phone"].ToString(),
                pcar_list = pcar_list,
            };

            return(View(resView));
        }