Example #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");//支付失败
        }
 // GET: PurchaseCar
 public ActionResult Index()
 {
     if (Session["has_login"] == null)
     {
         if (Session["ReturnToPurchaseCar"] == null)
         {
             Session["ReturnToPurchaseCar"] = "true";
         }
         else
         {
             Session["ReturnToPurchaseCar"] = null;
         }
         return(Redirect("/Login"));
     }
     else
     {
         Session.Remove("ReturnToPurchaseCar");
         ShopBusinessLogic.MemberPurchase memberPurchase = new ShopBusinessLogic.MemberPurchase();
         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));
     }
 }
Example #3
0
 // GET: BuyGoods
 public ActionResult Index()
 {
     if (ControllerContext.RouteData.GetRequiredString("id") == null)
     {
         return(Redirect("/Home"));
     }
     //if (ControllerContext.RouteData.GetRequiredString("id") == null) return HttpNotFound();
     else
     {
         string now_goods_id = ControllerContext.RouteData.GetRequiredString("id");
         ShopBusinessLogic.MemberPurchase memberPurchase = new ShopBusinessLogic.MemberPurchase();
         var goods_list = memberPurchase.getGoodsList().Select(goods_info => new MemberPurchaseCarViewModel()
         {
             goods_id       = goods_info.goods_id,
             goods_name     = goods_info.goods_name,
             goods_img_path = goods_info.goods_img_path,
             unit_price     = goods_info.goods_price,
         }).ToList();
         var now_img_list = memberPurchase.getGoodsImgs(now_goods_id).Select(img_info => new GoodsImgView()
         {
             img_path = img_info.img_path,
         }).ToList();
         var resView = new PurchaseHomeTotalInfo()
         {
             now_goods_id         = now_goods_id,
             now_goods_name       = memberPurchase.getGoods(now_goods_id).goods_name,
             now_goods_unit_price = memberPurchase.getGoods(now_goods_id).goods_price,
             now_goods_detail     = memberPurchase.getGoods(now_goods_id).goods_details,
             total_goods_list     = goods_list,
             now_img_lists        = now_img_list,
         };
         return(View(resView));
     }
 }
        public ActionResult Index(int?page)
        {
            ShopBusinessLogic.LoginMember    loginMember = new ShopBusinessLogic.LoginMember();
            ShopBusinessLogic.SellerSell     sellerSell  = new ShopBusinessLogic.SellerSell();
            ShopBusinessLogic.MemberPurchase purchase    = new ShopBusinessLogic.MemberPurchase();
            if (Session["mem_phone"] == null)
            {
                return(Redirect("/Login"));
            }
            if (Session["mem_phone"] != null && Convert.ToInt32(Session["mem_type"]) == 1)
            {
                return(Redirect("/SignUp/Seller"));
            }
            string now_goods_id     = this.Request.QueryString["goods_id"];
            int    now_goods_id_int = Convert.ToInt32(now_goods_id);

            if (now_goods_id == null || !sellerSell.isInGoodsList(now_goods_id_int))
            {
                return(Redirect("/Error"));
            }
            string phone        = Session["mem_phone"].ToString();
            var    now_goods    = sellerSell.getSellGoods(phone, now_goods_id_int);
            var    now_img_list = purchase.getGoodsImgs(now_goods_id_int).Select(img_info => new GoodsImgView()
            {
                img_path = img_info.img_path,
            }).ToList();
            var tag_list = purchase.getAllTags().Select(tag => new GoodsTag()
            {
                goods_tag = tag.tag,
            }).ToList();
            var sell_list = sellerSell.getPerGoodsSellList(phone, now_goods_id_int).Select(p_list => new MemberPurchaseListViewModel()
            {
                plist_id    = p_list.plist_id,
                goods_num   = p_list.goods_num,
                mem_phone   = p_list.mem_phone,
                mem_name    = loginMember.GetMemberByPhone(p_list.mem_phone).mem_name,
                unit_price  = p_list.unit_price,
                total_price = p_list.total_price,
                date        = p_list.date,
                goods_name  = p_list.goods_name,
            }).ToList();
            int pageNumber = page ?? 1;
            int pageSize   = 10;
            var resView    = new SellGoodsViewModel()
            {
                goods_id             = now_goods_id_int,
                goods_detail         = now_goods.goods_details,
                goods_name           = now_goods.goods_name,
                goods_price          = now_goods.goods_price,
                goods_img_path       = now_goods.goods_img_path,
                goods_tag            = now_goods.goods_tag,
                sell_stock           = now_goods.goods_stock,
                sell_volume          = now_goods.goods_volume,
                img_list             = now_img_list,
                total_goods_tags     = tag_list,
                goods_page_sell_list = (PagedList <MemberPurchaseListViewModel>)sell_list.ToPagedList(pageNumber, pageSize),
            };

            return(Request.IsAjaxRequest() ? (ActionResult)PartialView("SellGoodsPart1", resView) : View(resView));
        }
Example #5
0
        public ActionResult Search(int?page)
        {
            string search_content = this.Request.QueryString["search_content"];

            if (search_content == null)
            {
                return(Redirect("/Error"));
            }
            else if (search_content == "" || search_content.Trim() == "")
            {
                return(Redirect("/Home/SearchHome"));
            }
            ShopBusinessLogic.MemberPurchase memberPurchase = new ShopBusinessLogic.MemberPurchase();
            var goods_list = memberPurchase.getGoodsList(search_content).Select(goods_info => new MemberPurchaseCarViewModel()
            {
                goods_id       = goods_info.goods_id,
                goods_name     = goods_info.goods_name,
                goods_img_path = goods_info.goods_img_path,
                unit_price     = goods_info.goods_price,
                sell_stock     = goods_info.goods_stock,
                sell_volume    = goods_info.goods_volume,
                seller_phone   = goods_info.seller_phone,
            }).ToList();
            int pageNumber = page ?? 1;
            int pageSize   = 8;
            var resView    = new PurchaseHomeTotalInfo()
            {
                total_goods_list = goods_list,
                search_content   = search_content,
                page_goods_list  = (PagedList <MemberPurchaseCarViewModel>)goods_list.ToPagedList(pageNumber, pageSize),
            };

            return(Request.IsAjaxRequest()? (ActionResult)PartialView("HomePart2", resView):View(resView));
        }
Example #6
0
 // GET: WishList
 public ActionResult Index()
 {
     if (Session["has_login"] == null)
     {
         if (Session["ReturnToWishList"] == null)
         {
             Session["ReturnToWishList"] = "true";
         }
         else
         {
             Session["ReturnToWishList"] = null;
         }
         return(Redirect("/Login"));
     }
     else
     {
         Session.Remove("ReturnToWishList");
         ShopBusinessLogic.MemberPurchase memberPurchase = new ShopBusinessLogic.MemberPurchase();
         var wish_list = memberPurchase.getWishLists(Session["mem_phone"].ToString()).Select(wish_info => new MemberWishListViewModel()
         {
             goods_id         = wish_info.goods_id,
             goods_name       = memberPurchase.getGoods(wish_info.goods_id).goods_name,
             goods_unit_price = memberPurchase.getGoods(wish_info.goods_id).goods_price,
             goods_img_path   = memberPurchase.getGoods(wish_info.goods_id).goods_img_path,
         }).ToList();
         var resView = new MemberWishListViewModel()
         {
             mem_phone  = Session["mem_phone"].ToString(),
             wish_lists = wish_list,
         };
         return(View(resView));
     }
 }
        public ActionResult Search(MemberPurchaseListViewModel memberPurchaseListViewModel)
        {
            if (memberPurchaseListViewModel == null)
            {
                return(Redirect("/Error"));
            }
            string search_id = memberPurchaseListViewModel.search_id;
            string mem_phone = Session["mem_phone"].ToString();

            ShopBusinessLogic.MemberPurchase memberPurchase = new ShopBusinessLogic.MemberPurchase();
            if (search_id == null)
            {
                var p_list = memberPurchase.getPurchaseLists(mem_phone).Select(p_info => new MemberPurchaseListViewModel()
                {
                    plist_id       = p_info.plist_id,
                    goods_id       = p_info.goods_id,
                    goods_name     = p_info.goods_name,
                    goods_img_path = memberPurchase.getGoods(p_info.goods_id).goods_img_path,
                    goods_num      = p_info.goods_num,
                    date           = p_info.date,
                    unit_price     = p_info.unit_price,
                    total_price    = p_info.total_price,
                }).ToList();
                var resView = new MemberPurchaseListViewModel()
                {
                    mem_phone      = mem_phone,
                    purchase_lists = p_list,
                };
                return(PartialView("PlistPart1", resView));
            }
            else
            {
                var p_list = memberPurchase.getPurchaseListsBySearchId(mem_phone, search_id).Select(p_info => new MemberPurchaseListViewModel()
                {
                    plist_id       = p_info.plist_id,
                    goods_id       = p_info.goods_id,
                    goods_name     = p_info.goods_name,
                    goods_img_path = memberPurchase.getGoods(p_info.goods_id).goods_img_path,
                    goods_num      = p_info.goods_num,
                    date           = p_info.date,
                    unit_price     = p_info.unit_price,
                    total_price    = p_info.total_price,
                }).ToList();
                var resView = new MemberPurchaseListViewModel()
                {
                    mem_phone      = mem_phone,
                    purchase_lists = p_list,
                };
                return(PartialView("PlistPart1", resView));
            }
        }
        // GET: PurchaseList

        public ActionResult Index()
        {
            if (Session["has_login"] == null)
            {
                if (Session["ReturnToPurchaseList"] == null)
                {
                    Session["ReturnToPurchaseList"] = "true";
                }
                else
                {
                    Session["ReturnToPurchaseList"] = null;
                }
                return(Redirect("/Login"));
            }
            else
            {
                Session.Remove("ReturnToPurchaseList");
                string phone    = Session["mem_phone"].ToString();
                string nowdir   = savepath + phone + @"\";
                string nowpath1 = nowdir + @"alipay_coder.jpg";
                string nowpath2 = nowdir + @"weixin_coder.jpg";
                if (System.IO.File.Exists(nowpath1))
                {
                    System.IO.File.Delete(nowpath1);
                }
                if (System.IO.File.Exists(nowpath2))
                {
                    System.IO.File.Delete(nowpath2);
                }
                ShopBusinessLogic.MemberPurchase memberPurchase = new ShopBusinessLogic.MemberPurchase();
                var p_list = memberPurchase.getPurchaseLists(phone).Select(p_info => new MemberPurchaseListViewModel()
                {
                    plist_id       = p_info.plist_id,
                    goods_id       = p_info.goods_id,
                    goods_name     = p_info.goods_name,
                    goods_img_path = memberPurchase.getGoods(p_info.goods_id).goods_img_path,
                    goods_num      = p_info.goods_num,
                    date           = p_info.date,
                    unit_price     = p_info.unit_price,
                    total_price    = p_info.total_price,
                }).ToList();
                var resView = new MemberPurchaseListViewModel()
                {
                    mem_phone      = phone,
                    purchase_lists = p_list,
                };
                //return PartialView("PlistPart1", resView);
                return(View(resView));
            }
        }
Example #9
0
        public ActionResult Index()
        {
            string now_goods_id = Request.QueryString["goods_id"];

            ShopBusinessLogic.LoginMember loginMember = new ShopBusinessLogic.LoginMember();
            ShopBusinessLogic.SellerSell  sellerSell  = new ShopBusinessLogic.SellerSell();
            if (now_goods_id == null)
            {
                return(Redirect("/Error"));
            }
            if (!sellerSell.isInGoodsList(Convert.ToInt32(now_goods_id)))
            {
                return(Redirect("/Error"));
            }
            else
            {
                int now_goods_id_int = Convert.ToInt32(now_goods_id);
                ShopBusinessLogic.MemberPurchase memberPurchase = new ShopBusinessLogic.MemberPurchase();
                var goods_list = memberPurchase.getGoodsList().Select(goods_info => new MemberPurchaseCarViewModel()
                {
                    goods_id       = goods_info.goods_id,
                    goods_name     = goods_info.goods_name,
                    goods_img_path = goods_info.goods_img_path,
                    unit_price     = goods_info.goods_price,
                    sell_stock     = goods_info.goods_stock,
                    sell_volume    = goods_info.goods_volume,
                    seller_phone   = goods_info.seller_phone,
                }).ToList();
                var now_img_list = memberPurchase.getGoodsImgs(now_goods_id_int).Select(img_info => new GoodsImgView()
                {
                    img_path = img_info.img_path,
                }).ToList();
                var now_goods = memberPurchase.getGoods(now_goods_id_int);
                var resView   = new PurchaseHomeTotalInfo()
                {
                    now_goods_id         = now_goods_id_int,
                    now_goods_name       = now_goods.goods_name,
                    now_goods_unit_price = now_goods.goods_price,
                    now_goods_detail     = now_goods.goods_details,
                    now_stock            = now_goods.goods_stock,
                    now_volume           = now_goods.goods_volume,
                    now_seller_phone     = now_goods.seller_phone,
                    now_seller_name      = loginMember.GetMemberByPhone(now_goods.seller_phone).mem_name,
                    now_goods_tag        = now_goods.goods_tag,
                    total_goods_list     = goods_list,
                    now_img_lists        = now_img_list,
                };
                return(View(resView));
            }
        }
Example #10
0
        public ActionResult Index(MemberPurchaseCarViewModel memberPurchaseCarViewModels, string[] selected)
        {
            if (memberPurchaseCarViewModels == null)
            {
                return(Redirect("/Error"));
            }
            ShopBusinessLogic.MemberPurchase memberPurchase = new ShopBusinessLogic.MemberPurchase();
            ShopBusinessLogic.LoginMember    loginMember    = new ShopBusinessLogic.LoginMember();
            var submit_list  = memberPurchaseCarViewModels.select_list;
            var select_list  = new List <AccountModels>();
            var address_list = loginMember.ShowMemberAddress(Session["mem_phone"].ToString()).Select(address_info => new MemberAddress()
            {
                address     = address_info.address,
                address_tag = address_info.address_tag,
            }).ToList();
            decimal all_price = 0;

            for (int i = 0; i < submit_list.Count; ++i)
            {
                if (selected[i] != null && selected[i] == "on")
                {
                    var now_item = memberPurchase.getGoods(submit_list[i].goods_id);
                    var item     = new AccountModels()
                    {
                        goods_id     = submit_list[i].goods_id,
                        goods_name   = now_item.goods_name,
                        goods_num    = submit_list[i].goods_num,
                        unit_price   = now_item.goods_price,
                        total_price  = now_item.goods_price * submit_list[i].goods_num,
                        seller_phone = now_item.seller_phone,
                    };
                    if (item.goods_num > 0)
                    {
                        all_price += item.total_price;
                        select_list.Add(item);
                    }
                }
            }
            var resView = new AccountModels()
            {
                mem_phone       = Session["mem_phone"].ToString(),
                addresses       = address_list,
                accountModeList = select_list,
                all_price       = all_price,
            };

            Session["has_pay"] = "true";
            return(View(resView));
        }
 // GET: PurchaseCar
 public ActionResult Index()
 {
     if (Session["has_login"] == null)
     {
         if (Session["ReturnToPurchaseCar"] == null)
         {
             Session["ReturnToPurchaseCar"] = "true";
         }
         else
         {
             Session["ReturnToPurchaseCar"] = null;
         }
         return(Redirect("/Login"));
     }
     else
     {
         Session.Remove("ReturnToPurchaseCar");
         string phone    = Session["mem_phone"].ToString();
         string nowdir   = savepath + phone + @"\";
         string nowpath1 = nowdir + @"alipay_coder.jpg";
         string nowpath2 = nowdir + @"weixin_coder.jpg";
         if (System.IO.File.Exists(nowpath1))
         {
             System.IO.File.Delete(nowpath1);
         }
         if (System.IO.File.Exists(nowpath2))
         {
             System.IO.File.Delete(nowpath2);
         }
         ShopBusinessLogic.MemberPurchase memberPurchase = new ShopBusinessLogic.MemberPurchase();
         var pcar_list = memberPurchase.getPurchaseCarList(phone).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,
             sell_stock     = memberPurchase.getGoods(pcar_info.goods_id).goods_stock,
         }).ToList();
         var resView = new MemberPurchaseCarViewModel()
         {
             mem_phone = phone,
             pcar_list = pcar_list,
         };
         return(View(resView));
     }
 }
        public ActionResult Index(SellGoodsViewModel sellGoodsViewModel)
        {
            string  phone        = Session["mem_phone"].ToString();
            int     goods_id     = sellGoodsViewModel.goods_id;
            string  goods_name   = sellGoodsViewModel.goods_name;
            decimal goods_price  = sellGoodsViewModel.goods_price;
            string  goods_detail = sellGoodsViewModel.goods_detail;
            string  goods_tag    = sellGoodsViewModel.goods_tag;
            int     sell_stock   = sellGoodsViewModel.sell_stock;

            if (goods_detail == null)
            {
                goods_detail = "暂无";
            }

            ShopBusinessLogic.SellerSell     sellerSell = new ShopBusinessLogic.SellerSell();
            ShopBusinessLogic.MemberPurchase purchase   = new ShopBusinessLogic.MemberPurchase();
            if (sellerSell.modifyGoods(phone, goods_id, goods_name, goods_tag, goods_price, goods_detail, sell_stock))
            {
                var now_goods = sellerSell.getSellGoods(phone, goods_id);
                var tag_list  = purchase.getAllTags().Select(tag => new GoodsTag()
                {
                    goods_tag = tag.tag,
                }).ToList();
                var now_img_list = purchase.getGoodsImgs(goods_id).Select(img_info => new GoodsImgView()
                {
                    img_path = img_info.img_path,
                }).ToList();
                var resView = new SellGoodsViewModel()
                {
                    goods_id         = goods_id,
                    goods_detail     = now_goods.goods_details,
                    goods_name       = now_goods.goods_name,
                    goods_price      = now_goods.goods_price,
                    goods_img_path   = now_goods.goods_img_path,
                    goods_tag        = now_goods.goods_tag,
                    sell_stock       = now_goods.goods_stock,
                    sell_volume      = now_goods.goods_volume,
                    img_list         = now_img_list,
                    total_goods_tags = tag_list,
                };
                return(Redirect("/SellGoods/?goods_id=" + goods_id.ToString()));
            }
            else
            {
                return(Redirect("/SellGoods/?goods_id=" + goods_id.ToString()));
            }
        }
        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("购买商品成功"));
        }
Example #14
0
        public JsonResult AddWish(PurchaseHomeTotalInfo purchaseHomeTotalInfo)
        {
            Session.Remove("ReturnToWishList");
            string mem_phone = Session["mem_phone"].ToString();
            int    goods_id  = purchaseHomeTotalInfo.wish_goods_id;

            ShopBusinessLogic.MemberPurchase memberPurchase = new ShopBusinessLogic.MemberPurchase();
            if (memberPurchase.addWishList(mem_phone, goods_id))
            {
            }
            else
            {
                memberPurchase.deleteWishList(mem_phone, goods_id);
            }
            /*memberPurchase.addWishList(mem_phone, goods_id);*/
            return(Json("心愿单更新成功"));
        }
        public JsonResult AddCart(PurchaseHomeTotalInfo purchaseHomeTotalInfo)
        {
            Session.Remove("ReturnToPurchaseCar");
            string mem_phone = Session["mem_phone"].ToString();
            string goods_id  = Request.Params["goods_id_to_cart"];
            int    goods_num = purchaseHomeTotalInfo.pcar_goods_num;

            ShopBusinessLogic.MemberPurchase memberPurchase = new ShopBusinessLogic.MemberPurchase();
            if (memberPurchase.addPurchaseCar(mem_phone, goods_id, goods_num))
            {
            }
            else
            {
                var now_goods_num = memberPurchase.getPurchaseCarItem(mem_phone, goods_id).goods_num;
                memberPurchase.updatePurchaseCar(mem_phone, goods_id, now_goods_num + goods_num);
            }
            return(Json("添加该商品至购物车成功"));
        }
Example #16
0
        public ActionResult Index()
        {
            ShopBusinessLogic.MemberPurchase memberPurchase = new ShopBusinessLogic.MemberPurchase();
            var goods_list = memberPurchase.getGoodsList().Select(goods_info => new MemberPurchaseCarViewModel()
            {
                goods_id             = goods_info.goods_id,
                goods_name           = goods_info.goods_name,
                goods_img_path       = goods_info.goods_img_path,
                goods_small_img_path = goods_info.goods_small_img_path,
                unit_price           = goods_info.goods_price,
            }).ToList();
            var resView = new PurchaseHomeTotalInfo()
            {
                total_goods_list = goods_list,
            };

            return(View(resView));
        }
Example #17
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"));
     }
 }
Example #18
0
        public ActionResult DeleteGoods(int deleteGoodsId)
        {
            string phone = Session["mem_phone"].ToString();

            ShopBusinessLogic.SellerSell     sellerSell = new ShopBusinessLogic.SellerSell();
            ShopBusinessLogic.MemberPurchase purchase   = new ShopBusinessLogic.MemberPurchase();

            sellerSell.deleteGoods(phone, deleteGoodsId);

            string nowpath = savepath + phone + @"\" + deleteGoodsId.ToString();

            if (Directory.Exists(nowpath))
            {
                Directory.Delete(nowpath, true);
            }

            var sell_goods_list = sellerSell.getAllSellGoods(phone).Select(goods_info => new SellGoodsViewModel()
            {
                goods_id       = goods_info.goods_id,
                goods_name     = goods_info.goods_name,
                goods_tag      = goods_info.goods_tag,
                goods_img_path = goods_info.goods_img_path,
                goods_price    = goods_info.goods_price,
                sell_stock     = goods_info.goods_stock,
                sell_volume    = goods_info.goods_volume,
            }).ToList();
            var tag_list = purchase.getAllTags().Select(tag => new GoodsTag()
            {
                goods_tag = tag.tag,
            }).ToList();
            var resView = new SellGoodsViewModel()
            {
                total_sell_goods = sell_goods_list,
                total_goods_tags = tag_list,
            };

            return(PartialView("SellHomePart1", resView));
        }
        // GET: PurchaseList

        public ActionResult Index()
        {
            if (Session["has_login"] == null)
            {
                if (Session["ReturnToPurchaseList"] == null)
                {
                    Session["ReturnToPurchaseList"] = "true";
                }
                else
                {
                    Session["ReturnToPurchaseList"] = null;
                }
                return(Redirect("/Login"));
            }
            else
            {
                Session.Remove("ReturnToPurchaseList");
                ShopBusinessLogic.MemberPurchase memberPurchase = new ShopBusinessLogic.MemberPurchase();
                var p_list = memberPurchase.getPurchaseLists(Session["mem_phone"].ToString()).Select(p_info => new MemberPurchaseListViewModel()
                {
                    plist_id       = p_info.plist_id,
                    goods_id       = p_info.goods_id,
                    goods_name     = p_info.goods_name,
                    goods_img_path = memberPurchase.getGoods(p_info.goods_id).goods_img_path,
                    goods_num      = p_info.goods_num,
                    date           = p_info.date,
                    unit_price     = p_info.unit_price,
                    total_price    = p_info.total_price,
                }).ToList();
                var resView = new MemberPurchaseListViewModel()
                {
                    mem_phone      = Session["mem_phone"].ToString(),
                    purchase_lists = p_list,
                };
                //return PartialView("PlistPart1", resView);
                return(View(resView));
            }
        }
Example #20
0
        public ActionResult Index(int DeleteWishId)
        {
            Session.Remove("ReturnToWishList");
            string mem_phone = Session["mem_phone"].ToString();
            int    goods_id  = DeleteWishId;

            ShopBusinessLogic.MemberPurchase memberPurchase = new ShopBusinessLogic.MemberPurchase();
            memberPurchase.deleteWishList(mem_phone, goods_id);
            var wish_list = memberPurchase.getWishLists(Session["mem_phone"].ToString()).Select(wish_info => new MemberWishListViewModel()
            {
                goods_id         = wish_info.goods_id,
                goods_name       = memberPurchase.getGoods(wish_info.goods_id).goods_name,
                goods_unit_price = memberPurchase.getGoods(wish_info.goods_id).goods_price,
                goods_img_path   = memberPurchase.getGoods(wish_info.goods_id).goods_img_path,
            }).ToList();
            var resView = new MemberWishListViewModel()
            {
                mem_phone  = Session["mem_phone"].ToString(),
                wish_lists = wish_list,
            };

            return(PartialView("WishListPart1", resView));
        }
Example #21
0
        // GET: SellHome
        public ActionResult Index()
        {
            if (Session["mem_phone"] == null)
            {
                return(Redirect("/Login"));
            }
            if (Session["mem_phone"] != null && Convert.ToInt32(Session["mem_type"]) == 1)
            {
                return(Redirect("/SignUp/Seller"));
            }
            string phone = Session["mem_phone"].ToString();

            ShopBusinessLogic.SellerSell     sellerSell = new ShopBusinessLogic.SellerSell();
            ShopBusinessLogic.MemberPurchase purchase   = new ShopBusinessLogic.MemberPurchase();
            var sell_goods_list = sellerSell.getAllSellGoods(phone).Select(goods_info => new SellGoodsViewModel()
            {
                goods_id       = goods_info.goods_id,
                goods_name     = goods_info.goods_name,
                goods_tag      = goods_info.goods_tag,
                goods_img_path = goods_info.goods_img_path,
                goods_price    = goods_info.goods_price,
                sell_stock     = goods_info.goods_stock,
                sell_volume    = goods_info.goods_volume,
            }).ToList();
            var tag_list = purchase.getAllTags().Select(tag => new GoodsTag()
            {
                goods_tag = tag.tag,
            }).ToList();
            var resView = new SellGoodsViewModel()
            {
                total_sell_goods = sell_goods_list,
                total_goods_tags = tag_list,
            };

            return(View(resView));
        }
        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));
        }
Example #23
0
        public ActionResult Index(int?page)
        {
            ShopBusinessLogic.MemberPurchase memberPurchase = new ShopBusinessLogic.MemberPurchase();
            string search_tag   = this.Request.QueryString["search_tag"];
            string search_price = this.Request.QueryString["search_price"];
            Regex  regex1       = new Regex("^[0-9]*[1-9][0-9]*$");
            Regex  regex2       = new Regex("^\\d+_\\d+$");

            if (search_price != null && !regex1.IsMatch(search_price) && !regex2.IsMatch(search_price) && search_price != "all")
            {
                return(Redirect("/Error"));
            }
            var total_goods_list = memberPurchase.getGoodsList().Select(goods_info => new MemberPurchaseCarViewModel()
            {
                goods_id       = goods_info.goods_id,
                goods_name     = goods_info.goods_name,
                goods_img_path = goods_info.goods_img_path,
                unit_price     = goods_info.goods_price,
                sell_stock     = goods_info.goods_stock,
                sell_volume    = goods_info.goods_volume,
                seller_phone   = goods_info.seller_phone,
            }).ToList();
            var search_goods_list = new List <MemberPurchaseCarViewModel>();

            if ((search_price == null || search_price == "all" || search_price == "") && (search_tag == null || search_tag == "all" || search_tag == ""))
            {
                search_goods_list = memberPurchase.getGoodsList().Select(goods_info => new MemberPurchaseCarViewModel()
                {
                    goods_id       = goods_info.goods_id,
                    goods_name     = goods_info.goods_name,
                    goods_img_path = goods_info.goods_img_path,
                    unit_price     = goods_info.goods_price,
                    sell_stock     = goods_info.goods_stock,
                    sell_volume    = goods_info.goods_volume,
                    seller_phone   = goods_info.seller_phone,
                }).ToList();
            }
            else
            {
                search_goods_list = memberPurchase.getGoodsList(search_tag, search_price).Select(goods_info => new MemberPurchaseCarViewModel()
                {
                    goods_id       = goods_info.goods_id,
                    goods_name     = goods_info.goods_name,
                    goods_img_path = goods_info.goods_img_path,
                    unit_price     = goods_info.goods_price,
                    sell_stock     = goods_info.goods_stock,
                    sell_volume    = goods_info.goods_volume,
                    seller_phone   = goods_info.seller_phone,
                }).ToList();
            }
            int pageNumber = page ?? 1;
            int pageSize   = 8;
            var tag_list   = memberPurchase.getAllTags().Select(tag => new GoodsTag()
            {
                goods_tag = tag.tag,
            }).ToList();
            int    _index;
            string tmp_select_price;

            if (search_price == "all" || search_price == null || search_price == "")
            {
                tmp_select_price = "";
            }
            else
            {
                _index = search_price.IndexOf('_');
                if (_index == -1)
                {
                    tmp_select_price = "¥" + search_price + " 以上";
                }
                else
                {
                    tmp_select_price = "¥" + search_price.Substring(0, _index) + " ~ ¥" + search_price.Substring(_index + 1, search_price.Length - _index - 1);
                }
            }
            var resView = new PurchaseHomeTotalInfo()
            {
                select_price_interval = tmp_select_price,
                select_tag            = (search_tag == "all" || search_tag == "" || search_tag == null)?"":search_tag,
                total_goods_list      = total_goods_list,
                goods_tags            = tag_list,
                page_goods_list       = (PagedList <MemberPurchaseCarViewModel>)search_goods_list.ToPagedList(pageNumber, pageSize),
            };

            return(Request.IsAjaxRequest()? (ActionResult)PartialView("HomePart1", resView):View(resView));
        }
Example #24
0
        public ActionResult Index(SellGoodsViewModel sellGoodsViewModel)
        {
            ShopBusinessLogic.SellerSell     sellerSell = new ShopBusinessLogic.SellerSell();
            ShopBusinessLogic.MemberPurchase purchase   = new ShopBusinessLogic.MemberPurchase();


            string             phone        = Session["mem_phone"].ToString();
            int                add_goods_id = sellerSell.getAddGoodsId();
            string             nowpath      = savepath + phone + @"\" + add_goods_id.ToString() + @"\";
            HttpPostedFileBase fileBase     = Request.Files["image"];
            string             file_name    = DateTime.Now.ToString("yyyyMMddHHmmssfff");
            string             img_path     = "";

            if (fileBase.ContentType == "image/jpeg" || fileBase.ContentType == "image/png")
            {
                if (int.Parse(fileBase.ContentLength.ToString()) > (4 * 1024 * 1024))
                {
                    return(Redirect("/SellHome"));
                }
                //图片存储路径
                if (!Directory.Exists(nowpath))
                {
                    Directory.CreateDirectory(nowpath);
                }
                fileBase.SaveAs(nowpath + file_name + ".jpg");
                img_path = "/content/image/" + phone + "/" + add_goods_id.ToString() + "/" + file_name + ".jpg";
            }


            string  goods_name     = sellGoodsViewModel.goods_name;
            decimal goods_price    = sellGoodsViewModel.goods_price;
            string  goods_detail   = sellGoodsViewModel.goods_detail;
            string  goods_tag      = sellGoodsViewModel.goods_tag;
            string  goods_img_path = img_path == ""?"暂无": img_path;
            int     sell_stock     = sellGoodsViewModel.sell_stock;

            if (goods_detail == null)
            {
                goods_detail = "暂无";
            }
            if (sellerSell.addGoods(phone, goods_name, goods_tag, Convert.ToDecimal(goods_price), goods_detail, sell_stock, goods_img_path))
            {
                var sell_goods_list = sellerSell.getAllSellGoods(phone).Select(goods_info => new SellGoodsViewModel()
                {
                    goods_id       = goods_info.goods_id,
                    goods_name     = goods_info.goods_name,
                    goods_tag      = goods_info.goods_tag,
                    goods_img_path = goods_info.goods_img_path,
                    goods_price    = goods_info.goods_price,
                    sell_stock     = goods_info.goods_stock,
                    sell_volume    = goods_info.goods_volume,
                }).ToList();
                var tag_list = purchase.getAllTags().Select(tag => new GoodsTag()
                {
                    goods_tag = tag.tag,
                }).ToList();
                var resView = new SellGoodsViewModel()
                {
                    total_sell_goods = sell_goods_list,
                    total_goods_tags = tag_list,
                };
                return(Redirect("/SellHome"));
            }
            else
            {
                return(Redirect("/SellHome"));
            }
        }
Example #25
0
        public ActionResult Index(int?page)
        {
            ShopBusinessLogic.MemberPurchase memberPurchase = new ShopBusinessLogic.MemberPurchase();
            string search_tag   = this.Request.QueryString["search_tag"];
            string search_price = this.Request.QueryString["search_price"];
            Regex  regex1       = new Regex("^[0-9]*[1-9][0-9]*$");
            Regex  regex2       = new Regex("^\\d+_\\d+$");

            if (search_price != null && !regex1.IsMatch(search_price) && !regex2.IsMatch(search_price) && search_price != "all")
            {
                return(Redirect("/Error"));
            }
            var total_goods_list = memberPurchase.getGoodsList().Select(goods_info => new MemberPurchaseCarViewModel()
            {
                goods_id       = goods_info.goods_id,
                goods_name     = goods_info.goods_name,
                goods_img_path = goods_info.goods_img_path,
                unit_price     = goods_info.goods_price,
                sell_stock     = goods_info.goods_stock,
                sell_volume    = goods_info.goods_volume,
                seller_phone   = goods_info.seller_phone,
            }).ToList();
            List <MemberPurchaseCarViewModel> rand_goods_list = new List <MemberPurchaseCarViewModel>();
            //轮播图显示
            Random rand = new Random(unchecked ((int)DateTime.Now.Ticks));

            int[] randNum = new int[22];
            if (total_goods_list.Count <= 10)
            {
                rand_goods_list = total_goods_list;
            }
            else
            {
                for (int i = 0; i < 22; ++i)
                {
                    int tmp = rand.Next(0, total_goods_list.Count);
                    randNum[i] = getNum(tmp, randNum, 0, total_goods_list.Count, rand);
                    if (i < 10)
                    {
                        rand_goods_list.Add(total_goods_list[randNum[i]]);
                    }
                }
            }
            //购买记录推荐
            List <MemberPurchaseCarViewModel> ai_goods_list = new List <MemberPurchaseCarViewModel>();

            if (Session["mem_phone"] == null)
            {
                for (int i = 10; i < 16; ++i)
                {
                    ai_goods_list.Add(total_goods_list[randNum[i]]);
                }
            }
            else
            {
                string    mem_phone = Session["mem_phone"].ToString();
                Hashtable tagTable  = new Hashtable();
                var       aiTagList = memberPurchase.getPurchaseTag_ai(mem_phone);
                for (int i = 0; i < aiTagList.Count; ++i)
                {
                    if (!tagTable.ContainsKey(aiTagList[i].tag))
                    {
                        tagTable.Add(aiTagList[i].tag, 1);
                    }
                    else
                    {
                        tagTable[aiTagList[i].tag] = Convert.ToInt32(tagTable[aiTagList[i].tag]) + 1;
                    }
                }

                ICollection keys = tagTable.Keys;
                foreach (string now_tag in keys)
                {
                    var nowAiList = memberPurchase.getGoodsList(now_tag, Convert.ToInt32(tagTable[now_tag])).Select(goods_info => new MemberPurchaseCarViewModel()
                    {
                        goods_id       = goods_info.goods_id,
                        goods_name     = goods_info.goods_name,
                        goods_img_path = goods_info.goods_img_path,
                        unit_price     = goods_info.goods_price,
                        sell_stock     = goods_info.goods_stock,
                        sell_volume    = goods_info.goods_volume,
                        seller_phone   = goods_info.seller_phone,
                    }).ToList();
                    ai_goods_list.AddRange(nowAiList);
                }
                int now = ai_goods_list.Count, index = 10;
                for (int i = 0; i < 6 - now && index < 22;)
                {
                    bool flag = true;
                    for (int j = 0; j < ai_goods_list.Count; ++j)
                    {
                        if (ai_goods_list[j].goods_id == total_goods_list[randNum[index]].goods_id)
                        {
                            flag = false;
                            break;
                        }
                    }
                    if (flag)
                    {
                        ai_goods_list.Add(total_goods_list[randNum[index]]);
                        ++i;
                    }
                    index++;
                }
            }

            var search_goods_list = new List <MemberPurchaseCarViewModel>();

            if ((search_price == null || search_price == "all" || search_price == "") && (search_tag == null || search_tag == "all" || search_tag == ""))
            {
                search_goods_list = memberPurchase.getGoodsList().Select(goods_info => new MemberPurchaseCarViewModel()
                {
                    goods_id       = goods_info.goods_id,
                    goods_name     = goods_info.goods_name,
                    goods_img_path = goods_info.goods_img_path,
                    unit_price     = goods_info.goods_price,
                    sell_stock     = goods_info.goods_stock,
                    sell_volume    = goods_info.goods_volume,
                    seller_phone   = goods_info.seller_phone,
                }).ToList();
            }
            else
            {
                search_goods_list = memberPurchase.getGoodsList(search_tag, search_price).Select(goods_info => new MemberPurchaseCarViewModel()
                {
                    goods_id       = goods_info.goods_id,
                    goods_name     = goods_info.goods_name,
                    goods_img_path = goods_info.goods_img_path,
                    unit_price     = goods_info.goods_price,
                    sell_stock     = goods_info.goods_stock,
                    sell_volume    = goods_info.goods_volume,
                    seller_phone   = goods_info.seller_phone,
                }).ToList();
            }
            int pageNumber = page ?? 1;
            int pageSize   = 12;
            var tag_list   = memberPurchase.getAllTags().Select(tag => new GoodsTag()
            {
                goods_tag = tag.tag,
            }).ToList();
            int    _index;
            string tmp_select_price;

            if (search_price == "all" || search_price == null || search_price == "")
            {
                tmp_select_price = "";
            }
            else
            {
                _index = search_price.IndexOf('_');
                if (_index == -1)
                {
                    tmp_select_price = "¥" + search_price + " 以上";
                }
                else
                {
                    tmp_select_price = "¥" + search_price.Substring(0, _index) + " ~ ¥" + search_price.Substring(_index + 1, search_price.Length - _index - 1);
                }
            }
            var resView = new PurchaseHomeTotalInfo()
            {
                search_price            = search_price,
                search_tag              = search_tag,
                select_price_interval   = tmp_select_price,
                select_tag              = (search_tag == "all" || search_tag == "" || search_tag == null) ? "" : search_tag,
                total_goods_list        = total_goods_list,
                goods_tags              = tag_list,
                rand_display_goods_list = rand_goods_list,
                ai_display_goods_list   = ai_goods_list,
                page_goods_list         = (PagedList <MemberPurchaseCarViewModel>)search_goods_list.ToPagedList(pageNumber, pageSize),
            };

            return(Request.IsAjaxRequest() ? (ActionResult)PartialView("HomePart1", resView) : View(resView));
        }