private void FillFilterLists() { StatusList = new ObservableCollection <string>( ApartmentList.Select(c => c.StatusSaleName) .Distinct() .ToList()); HouseAddressList = new ObservableCollection <string>( ApartmentList.Select(c => c.HouseAddress) .Distinct() .ToList()); FloorList = new ObservableCollection <int>( ApartmentList.Select(c => c.Floor) .Distinct() .OrderBy(c => c) .ToList()); PorchList = new ObservableCollection <int>( ApartmentList.Select(c => c.Porch) .Distinct() .OrderBy(c => c) .ToList()); ComplexList = new ObservableCollection <string>( ApartmentList.Select(c => c.NameHousingComplex) .Distinct() .OrderBy(c => c) .ToList()); }
private void correctList(int start, int end) { for (int zone_id = start; zone_id <= end; zone_id++) { try { string link = string.Format("http://www.renthub.in.th/zones/switch_tab?locale=th&zone_id={0}&resource=Apartment&page=1", zone_id); string html = getHTMLdata(link); dynamic jsonresult = DeserializeJSON <object>(html); string result_per_40 = (string)(jsonresult.results.Value); string title = result_per_40.Substring(result_per_40.IndexOf("<h2>") + 4, result_per_40.IndexOf("</h2>") - 4 - result_per_40.IndexOf("<h2>")); int totalpage = (int)(jsonresult.total_entries.Value); ApartmentList container = new ApartmentList(); container.link = link; container.linkName = title; container.resuorce = "apartment"; container.zone_id = zone_id; container.total = totalpage; if (!db.apartmentList.Where(it => it.zone_id == zone_id).Any()) { db.apartmentList.Add(container); db.SaveChanges(); //db.Entry(container).State = EntityState.Modified; } } catch (Exception ex) { } } throw new NotImplementedException(); }