예제 #1
0
        public ActionResult StockAddView(Guid goodsId)
        {
            var categories = _stockCategoryService.SearchService.GetLeafCategories()
                             .Select(s => new SelectListItem {
                Text = s.Name, Value = s.Id.ToString()
            });

            ViewData["categories"] = categories;
            var stock = _stockService.CreateEmptyStock();
            var goods = _goodsSearchService.GetGoods(goodsId);

            stock.GoodsId   = goods.Id;
            stock.GoodsName = goods.Name;
            return(View(stock));
        }
        public ActionResult PurchaseAddView(Guid goodsId)
        {
            var categories = _purchaseCategoryService.SearchService.GetLeafCategories()
                             .Select(s => new SelectListItem {
                Text = s.Name, Value = s.Id.ToString()
            });

            ViewData["categories"] = categories;
            var purchase = _purchaseService.CreateEmptyPurchase();
            var goods    = _goodsSearchService.GetGoods(goodsId);

            purchase.GoodsId   = goods.Id;
            purchase.GoodsName = goods.Name;
            return(View(purchase));
        }
        public void Wrapper(List <StockModel> stocks)
        {
            if (!stocks.Any())
            {
                return;
            }
            var goodsIds = stocks.Select(s => s.GoodsId);
            var goodses  = _goodsSearchService.GetGoods(goodsIds);

            stocks.ForEach(order =>
            {
                var goods = goodses.FirstOrDefault(s => s.Id == order.GoodsId);
                if (goods != null)
                {
                    order.GoodsName = goods.Name;
                }
            });
        }
예제 #4
0
        public void Wrapper(List <DeliveryNoteItemModel> items)
        {
            if (!items.Any())
            {
                return;
            }
            var goodsIds = items.Select(s => s.GoodsId);
            var goodses  = _goodsSearchService.GetGoods(goodsIds);

            items.ForEach(item =>
            {
                var goods = goodses.FirstOrDefault(s => s.Id == item.GoodsId);
                if (goods != null)
                {
                    item.GoodsName = goods.Name;
                }
            });
        }
        public ActionResult OrderAddView(Guid goodsId)
        {
            var goods     = _goodsSearchService.GetGoods(goodsId);
            var customers = _customerSearchService.GetCustomers().Select(s => new SelectListItem {
                Text = s.Name, Value = s.Id.ToString()
            });

            ViewData["customers"] = customers;
            var categories = _orderCategorySearchService.GetCategories().Select(s => new SelectListItem {
                Text = s.Name, Value = s.Id.ToString()
            }).OrderBy(s => s.Text);

            ViewData["categories"] = categories;
            OrderModel order = _orderService.CreateEmptyOrder();

            order.GoodsId   = goods.Id;
            order.GoodsName = goods.Name;
            order.Price     = goods.Price;
            return(View(order));
        }
        public ActionResult SearchGoods(string key)
        {
            var goods = _goodsSearchService.GetGoods(key);

            return(Success(goods));
        }