async void BindDropDowns() { btnFilter.IsHitTestVisible = false; string url = "http://api.faitango.it/filter.php?"; try { if (NetworkStatus.CheckInternetAccess()) { wsFilterDropDownsModel _result = new wsFilterDropDownsModel(); _result = await Common.CommonClass.GetFiltersDropDowns(url); if (_result != null) { List <Province> lstProvince = new List <Models.Province>(); lstProvince = _result.province.ToList(); lstProvince.Insert(0, new Models.Province { codes = "0", name = "Select province" }); cmbProvince.ItemsSource = lstProvince; cmbProvince.DisplayMemberPath = "name"; cmbProvince.SelectedValuePath = "codes"; cmbProvince.SelectedIndex = 0; List <Region> lstRegion = new List <Models.Region>(); lstRegion = _result.region.ToList(); lstRegion.Insert(0, new Models.Region { codes = "0", name = "Select region" }); cmbRegion.ItemsSource = lstRegion; cmbRegion.DisplayMemberPath = "name"; cmbRegion.SelectedValuePath = "codes"; cmbRegion.SelectedIndex = 0; } else { MessageDialog msgbox = new MessageDialog("Server error."); await msgbox.ShowAsync(); } } else { MessageDialog msgbox = new MessageDialog("Internet connection is not available."); await msgbox.ShowAsync(); } } catch { } finally { btnFilter.IsHitTestVisible = true; } }
async void LoadFestivals(string todate = "", string fromdate = "", string province = "", string region = "", string search = "", bool isfilterClick = false) { if (!availableLanguage.Contains(systemLanguage)) { systemLanguage = "it"; } //string url = "http://api.faitango.it/tango.php?type=festival&lang" + systemLanguage + "&to&from&provincia®ion&search"; string url = "http://api.faitango.it/tango.php?type=festival&lang=" + systemLanguage + ""; if (todate != string.Empty) { url += "&to=" + todate + ""; } else { url += "&to"; } if (fromdate != string.Empty) { url += "&from=" + fromdate + ""; } else { url += "&from"; } if (province != string.Empty && province != "0") { url += "&provincia=" + province + ""; } else { url += "&provincia"; } if (region != string.Empty && region != "0") { url += "®ion=" + region + ""; } else { url += "®ion"; } if (search != string.Empty && search.Trim() != "Enter text here!") { url += "&search=" + search; } else { url += "&search"; } try { progresRing.IsActive = true; progresRing.Visibility = Visibility.Visible; if (NetworkStatus.CheckInternetAccess()) { wsTypeModel _result = new wsTypeModel(); _result = await Common.CommonClass.GetServiceData(url); progresRing.IsActive = false; progresRing.Visibility = Visibility.Collapsed; lstFestivals.ItemsSource = null; if (_result != null) { if (_result.data == null || _result.data.Count == 0) { MessageDialog msgbox = new MessageDialog(_result.mesg); await msgbox.ShowAsync(); return; } if (isfilterClick) { btnFilter.Source = new BitmapImage(new Uri( "ms-appx:///Assets/filter-icon.png", UriKind.Absolute)); } lstFestivals.ItemsSource = _result.data; lstRecords = _result.data; } else { MessageDialog msgbox = new MessageDialog("Server error."); await msgbox.ShowAsync(); } } else { MessageDialog msgbox = new MessageDialog("Internet connection is not available."); await msgbox.ShowAsync(); } } catch { } finally { progresRing.IsActive = false; progresRing.Visibility = Visibility.Collapsed; } }
async void LoadNews(string todate = "", string fromdate = "", string search = "", bool isfilterClick = false) { if (!availableLanguage.Contains(systemLanguage)) { systemLanguage = "it"; } // string url = "http://www.faitango.it/tyg_news_reader.php?date_from&date_to&filter_text&lang="+systemLanguage+""; string url = "http://www.faitango.it/tyg_news_reader.php?lang=" + systemLanguage + ""; if (todate != string.Empty) { url += "&date_to=" + todate; } else { url += "&date_to"; } if (fromdate != string.Empty) { url += "&date_from=" + fromdate; } else { url += "&date_from"; } if (search != string.Empty && search.Trim() != "Enter text here!") { url += "&filter_text=" + search; } else { url += "&filter_text"; } try { progresRing.IsActive = true; progresRing.Visibility = Visibility.Visible; if (NetworkStatus.CheckInternetAccess()) { wsNewsModel _result = new wsNewsModel(); _result = await Common.CommonClass.GetNewsList(url); progresRing.IsActive = false; progresRing.Visibility = Visibility.Collapsed; if (_result != null) { if (_result.data == null || _result.responce == "0" || _result.data.Count == 0) { MessageDialog msgbox = new MessageDialog("No Records"); await msgbox.ShowAsync(); return; } if (isfilterClick) { btnFilter.Source = new BitmapImage(new Uri( "ms-appx:///Assets/filter-icon.png", UriKind.Absolute)); } lstNews.ItemsSource = _result.data; lstRecords = _result.data; } else { MessageDialog msgbox = new MessageDialog("Server error."); await msgbox.ShowAsync(); } } else { MessageDialog msgbox = new MessageDialog("Internet connection is not available."); await msgbox.ShowAsync(); } } catch { } finally { progresRing.IsActive = false; progresRing.Visibility = Visibility.Collapsed; } }