Пример #1
0
        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));
        }
Пример #2
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));
            }
        }