示例#1
0
        public List <Shop> GetShop(string Regions, string ShopBusinessType, string ShopServices, string ShopTechLevel)
        {
            ShopsForPromotionSearchRequest search = new ShopsForPromotionSearchRequest();

            if (!string.IsNullOrWhiteSpace(Regions))
            {
                search.Regions = JsonConvert.DeserializeObject <RegionInfo[]>(Regions);
            }
            if (!string.IsNullOrWhiteSpace(ShopBusinessType))
            {
                ShopBusinessType        = ShopBusinessType.Substring(0, ShopBusinessType.Length - 1);
                search.ShopBusinessType = ShopBusinessType.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(ShopServices))
            {
                ShopServices        = ShopServices.Substring(0, ShopServices.Length - 1);
                search.ShopServices = ShopServices.Split(',');
            }
            if (!string.IsNullOrWhiteSpace(ShopTechLevel))
            {
                ShopTechLevel = ShopTechLevel.Substring(0, ShopTechLevel.Length - 1);

                var   list = ShopTechLevel.Split(',');
                int[] arr  = new int[list.Length];
                for (int i = 0; i < list.Length; i++)
                {
                    arr[i] = Convert.ToInt32(list[i]);
                }
                search.ShopTechLevel = arr;
            }

            search.PageIndex = 1;
            search.PageSize  = int.MaxValue;
            List <Shop> result = new List <Shop>();

            using (var client = new ShopClient())
            {
                var action = client.SelectShopForPromotion(search);
                if (action.Success && action.Result.Any())
                {
                    result = action.Result.ToList();
                }
            }
            return(result);
        }