public static List <ShopDetailModel> GetShopsForBaoyangAndXiChe() { List <ShopDetailModel> shopDetailList = new List <ShopDetailModel>(); List <int> specificregionIdList = new List <int>(); if (!string.IsNullOrWhiteSpace(ConfigurationManager.AppSettings["ShopRegionIdList"])) { specificregionIdList = ConfigurationManager.AppSettings["ShopRegionIdList"].Split(new char[] { ',' }).Select(q => Convert.ToInt32(q)).ToList(); } try { if (specificregionIdList.Any()) { using (var client = new ShopClient()) { foreach (var regionId in specificregionIdList) { //refresh shops in regions client.UpdateShopDetailsByRegionId(regionId); var result = client.SelectShopDetailsByRegionId(regionId); result.ThrowIfException(); if (result.Success && result.Result != null && result.Result.Any()) { shopDetailList.AddRange(result.Result); } } } shopDetailList = shopDetailList.Where(q => (q.ServiceType & 4) == 4 || (q.ServiceType & 2) == 2).ToList(); shopDetailList = shopDetailList.Where(q => q.SuspendStartDateTime == null || q.SuspendEndDateTime == null || (DateTime.Now < q.SuspendStartDateTime) || DateTime.Now > q.SuspendEndDateTime.Value.AddDays(1)).ToList(); } } catch (Exception ex) { TuhuShopSyncJob.Logger.Error(ex); } return(shopDetailList); }