Ejemplo n.º 1
0
        public JsonResult EditCommodityType(FormCollection form)
        {
            var apiResult = new APIResult();

            try
            {
                var           opt   = form["opt"];
                CommodityType model = new CommodityType();
                model.Name = form["name"];
                if (opt == "0")
                {
                    model.Pid = Convert.ToInt64(form["id"]);
                }
                else
                {
                    model.Id = Convert.ToInt64(form["id"]);
                }

                CommodityTypeBll.AddOrUpdate(model, UserContext.CurrentUser.Name, UserContext.CurrentUser.HotelId);
            }
            catch (Exception ex)
            {
                apiResult.Ret = -1;
                apiResult.Msg = ex.Message;
                if (!(ex is OperationExceptionFacade))
                {
                    LogFactory.GetLogger().Log(LogLevel.Error, ex);
                }
            }

            return(Json(apiResult));
        }
Ejemplo n.º 2
0
        public ActionResult _RefundSearch()
        {
            List <SelectListItem> typeItems   = new List <SelectListItem>();
            List <CommodityType>  comTypeList = CommodityTypeBll.GetList(UserContext.CurrentUser.HotelId);

            foreach (var item in comTypeList)
            {
                typeItems.Add(new SelectListItem {
                    Text = item.Name, Value = item.Id.ToString()
                });
            }

            ViewData["commodityTypeList"] = typeItems;
            return(View());
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 构建tree树
        /// </summary>
        /// <returns></returns>
        public string GetTreeView()
        {
            List <CommodityType> comTypeList = CommodityTypeBll.GetList(UserContext.CurrentUser.HotelId);
            TreeNode             rootNode    = new TreeNode()
            {
                id       = 0,
                text     = "全部分类",
                state    = "open",
                children = findTreeChildren(comTypeList, 0)
            };

            var result = JsonConvert.SerializeObject(rootNode);

            return($"[{result}]");
        }
Ejemplo n.º 4
0
        // GET: Stock
        public ActionResult Index()
        {
            long hotelId = UserContext.CurrentUser.HotelId;
            List <CommodityType>  comTypeList = CommodityTypeBll.GetList(hotelId);
            List <SelectListItem> typeItems   = new List <SelectListItem>();

            foreach (var item in comTypeList)
            {
                typeItems.Add(new SelectListItem {
                    Text = item.Name, Value = item.Id.ToString()
                });
            }

            ViewData["commodityTypeList"] = typeItems;
            ViewData["warehouse"]         = WarehouseBll.GetAllList(hotelId);
            return(View());
        }
Ejemplo n.º 5
0
        public ActionResult DeleteCommodityType(long id)
        {
            var apiResult = new APIResult();

            try
            {
                CommodityTypeBll.Delete(id);
            }
            catch (Exception ex)
            {
                apiResult.Ret = -1;
                apiResult.Msg = ex.Message;
                if (!(ex is OperationExceptionFacade))
                {
                    LogFactory.GetLogger().Log(LogLevel.Error, ex);
                }
            }
            return(Json(apiResult));
        }
Ejemplo n.º 6
0
        /// <summary>
        /// 出库单商品列表页面
        /// </summary>
        /// <returns></returns>
        public ActionResult _OutStockSearch(long warehourseid)
        {
            List <SelectListItem> typeItems   = new List <SelectListItem>();
            List <CommodityType>  comTypeList = CommodityTypeBll.GetList(UserContext.CurrentUser.HotelId);

            foreach (var item in comTypeList)
            {
                typeItems.Add(new SelectListItem {
                    Text = item.Name, Value = item.Id.ToString()
                });
            }
            Warehouse house = WarehouseBll.GetById(warehourseid);

            if (house == null)
            {
                warehourseid = 0;
            }
            ViewData["commodityTypeList"] = typeItems;
            ViewData["warehourseid"]      = warehourseid;
            return(View());
        }
Ejemplo n.º 7
0
        public ActionResult Edit(long id = 0)
        {
            List <CommodityType>  comTypeList = CommodityTypeBll.GetList(UserContext.CurrentUser.HotelId);
            List <SelectListItem> typeItems   = new List <SelectListItem>();

            foreach (var item in comTypeList)
            {
                typeItems.Add(new SelectListItem {
                    Text = item.Name, Value = item.Id.ToString()
                });
            }

            ViewData["commodityTypeList"] = typeItems;

            List <CommodityUnit>  comUnitList = CommodityUnitBll.GetList(UserContext.CurrentUser.HotelId);
            List <SelectListItem> unitItems   = new List <SelectListItem>();

            foreach (var item in comUnitList)
            {
                unitItems.Add(new SelectListItem {
                    Text = item.Name, Value = item.Id.ToString()
                });
            }

            ViewData["commodityUnitList"] = unitItems;

            if (id == 0)
            {
                return(View(new Hotel.Model.Inventory.Commodity()
                {
                    HotelId = UserContext.CurrentUser.HotelId
                }));
            }

            var info = CommodityBll.GetById(id);

            return(View(info));
        }