private async Task LoadData(AdvertiseType type, string search = "") { try { if (type == AdvertiseType.Divar) { var list = await DivarCityBussines.GetAllAsync(search); DivarBindingSource.DataSource = list.OrderBy(q => q.Name).Where(q => q.Status).ToList(); lblCounter.Text = DivarBindingSource.Count.ToString(); } else if (type == AdvertiseType.Sheypoor) { var list = await SheypoorCityBussines.GetAllAsync(search); SheypoorBindingSource.DataSource = list.OrderBy(q => q.Name).Where(q => q.Status).ToList(); lblCounter.Text = SheypoorBindingSource.Count.ToString(); } } catch (Exception e) { WebErrorLog.ErrorInstence.StartErrorLog(e); } }
private async Task FillCity() { try { var list3 = await DivarCityBussines.GetAllAsync(); cityBindingSource.DataSource = list3.ToList(); var list4 = await SheypoorCityBussines.GetAllAsync(); SheypoorCityBindingSource.DataSource = list4; } catch (Exception e) { WebErrorLog.ErrorInstence.StartErrorLog(e); } }
private void FillComboBox() { try { Invoke(new MethodInvoker(async() => { var list = await SimcardBussines.GetAllAsync(); var a = list.Select(q => q.Operator).Distinct().ToList(); cmbOperator.DataSource = a; var divarCat1 = await AdvCategoryBussines.GetAllAsync(Guid.Empty, AdvertiseType.Divar); divarCat1 = divarCat1.OrderBy(q => q.Name).ToList(); PostCat1BindingSource.DataSource = divarCat1; var dCity = await DivarCityBussines.GetAllAsync(); dCity = dCity.OrderBy(q => q.Name).ToList(); DivarCBindingSource.DataSource = dCity; cmbDivarCity.SelectedIndex = 0; var shCity = await SheypoorCityBussines.GetAllAsync(); shCity = shCity.OrderBy(q => q.Name).ToList(); SheypoorCBindingSource.DataSource = shCity; cmbSheypoorCity.SelectedIndex = 0; var divarChat1 = await AdvCategoryBussines.GetAllAsync(Guid.Empty, AdvertiseType.Divar); divarChat1 = divarChat1.OrderBy(q => q.Name).ToList(); DivarChatBindingSource1.DataSource = divarChat1; var sheypoorChat1 = await AdvCategoryBussines.GetAllAsync(Guid.Empty, AdvertiseType.Sheypoor); sheypoorChat1 = sheypoorChat1.OrderBy(q => q.Name).ToList(); SheypoorChatBindingSource1.DataSource = sheypoorChat1; var postCity = await DivarCityBussines.GetAllAsync(); postCity = postCity.OrderBy(q => q.Name).ToList(); PostCityBindingSource.DataSource = postCity; cmbPostCity.SelectedIndex = 0; })); } catch (Exception e) { WebErrorLog.ErrorInstence.StartErrorLog(e); } }
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); } }