示例#1
0
        private async Task SheypoorRegion(int cityCount)
        {
            try
            {
                var lstTupple = new List <Tuple <string, string> >();
                var finalList = new List <RegionBussiness>();
                lstTupple.Add(new Tuple <string, string>("آذربایجان شرقی", "تبریز"));
                lstTupple.Add(new Tuple <string, string>("اصفهان", "اصفهان"));
                lstTupple.Add(new Tuple <string, string>("البرز", "کرج"));
                lstTupple.Add(new Tuple <string, string>("تهران", "تهران"));
                lstTupple.Add(new Tuple <string, string>("خراسان رضوی", "مشهد"));
                lstTupple.Add(new Tuple <string, string>("خوزستان", "اهواز"));
                lstTupple.Add(new Tuple <string, string>("فارس", "شیراز"));
                lstTupple.Add(new Tuple <string, string>("قم", "قم"));
                lstTupple.Add(new Tuple <string, string>("گیلان", "رشت"));
                lstTupple.Add(new Tuple <string, string>("مازندران", "ساری"));
                foreach (var(item1, item2) in lstTupple)
                {
                    var sheypoor = await SheypoorAdv.GetInstance();

                    var regions = await sheypoor.GetAllRegionFromSheypoor(item1, item2);

                    var a = SheypoorCityBussines.GetAsync(item2);
                    foreach (var aRegion in regions)
                    {
                        var clsRegionBusiness = new RegionBussiness()
                        {
                            Guid     = Guid.NewGuid(),
                            CityGuid = a.Guid,
                            DateSabt = DateConvertor.M2SH(DateTime.Now),
                            Type     = AdvertiseType.Sheypoor,
                            Name     = aRegion
                        };
                        finalList.Add(clsRegionBusiness);
                    }
                }
                await RegionBussiness.SaveAsync(AdvertiseType.Sheypoor, finalList);
            }
            catch (Exception ex)
            {
                WebErrorLog.ErrorInstence.StartErrorLog(ex);
            }
        }
示例#2
0
        private async Task DivarRegion(int cityCount)
        {
            try
            {
                var lst = new List <string>();
                lst.Add("اصفهان");
                lst.Add("اهواز");
                lst.Add("تهران");
                lst.Add("شیراز");
                lst.Add("قم");
                lst.Add("کرج");
                lst.Add("مشهد");
                var divar = await DivarAdv.GetInstance();

                var regList = await divar.GetAllRegionFromDivar(lst);

                await RegionBussiness.SaveAsync(AdvertiseType.Divar, regList);
            }
            catch (Exception exception)
            {
                WebErrorLog.ErrorInstence.StartErrorLog(exception);
            }
        }