Ejemplo n.º 1
0
        public JsonResult Edit(Hotel.Model.Inventory.Commodity model)
        {
            var apiResult = new APIResult();

            try
            {
                if (model.CostStandardPrice > model.HighLimitPrice)
                {
                    apiResult.Ret = -1;
                    apiResult.Msg = "采购最高限价不能低于成本卡标准价!";
                    return(Json(apiResult));
                }
                //最高库存最低库存判断
                if (model.HighStock < model.LowStock)
                {
                    apiResult.Ret = -1;
                    apiResult.Msg = "最高库存不能低于最低库存!";
                    return(Json(apiResult));
                }

                CommodityBll.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 Delete(long id)
        {
            var apiResult = new APIResult();

            try
            {
                CommodityBll.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.º 3
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));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// 获取某个库存商品列表
        /// </summary>
        /// <param name="page"></param>
        /// <param name="rows"></param>
        /// <param name="WarehourseId"></param>
        /// <param name="commodityType"></param>
        /// <param name="searchValue"></param>
        /// <returns></returns>
        public string GetStockPager(int page, int rows, long warehourseId, long commodityType = 0, string searchValue = "")
        {
            var pager = CommodityBll.GetStockPager(page, rows, UserContext.CurrentUser.HotelId, warehourseId, commodityType, searchValue);

            return(JsonConvert.SerializeObject(pager));
        }
Ejemplo n.º 5
0
        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="page"></param>
        /// <param name="rows"></param>
        /// <param name="commodityName"></param>
        /// <param name="commodityStatus"></param>
        /// <param name="commodityType"></param>
        /// <returns></returns>
        public string GetPager(int page, int rows, string commodityName, string commodityStatus, long commodityType = 0)
        {
            var pager = CommodityBll.GetPager(page, rows, UserContext.CurrentUser.HotelId, commodityName, commodityStatus, commodityType);

            return(JsonConvert.SerializeObject(pager));
        }