コード例 #1
0
        /// <summary>
        /// 根据门店编号获取信息
        /// </summary>
        /// <param name="shopId">门店编号</param>
        /// <returns>操作结果</returns>
        public Result <Shop> GetShopInfoById(int shopId)
        {
            Result <Shop> result = new Result <Shop>()
            {
                Status  = false,
                Message = "没有获取到对应信息"
            };

            try
            {
                if (shopId == 0)
                {
                    throw new ArgumentException("查询门店信息,参数非法");
                }
                IShopCache shopservice = ServiceObjectContainer.Get <IShopCache>();

                ShopInfo shopcache = shopservice.GetshopInfoByShopId(shopId);

                if (shopcache != null)
                {
                    result.Data   = shopcache.Copy <Shop>();
                    result.Status = true;
                }
                else
                {
                    result.Data    = null;
                    result.Status  = false;
                    result.Message = "没有获取到对应信息";
                }
            }
            catch (Exception ex)
            {
                result.Data    = null;
                result.Status  = false;
                result.Message = "获取门店信息出错:" + ex.Message;
                LoggerUtils.LogIn(LoggerUtils.ColectExceptionMessage(ex, "At service:GetShopInfoById() .ShopService"), LogType.ErrorLog);
            }

            return(result);
        }