public async void closeClearSearchViewafterSearch(object sender, EventArgs e) { try { JobListHelper.IsSearching = false; JobListHelper.IntialzieList(); clear.IsEnabled = false; search.IsEnabled = false; await((JobSearchviewModel)CurrentJobsLayout.BindingContext).BindData(true, true); // ChangeToCurrent(null, null); } catch (Exception ex) { var logged = new LoggedException.LoggedException("Error in joblistingtapedimage.xaml.cs", ex); await logged.LoggAPI(); } finally { await FilterGrid.FadeTo(0); FilterGrid.IsVisible = false; searchtap.BackgroundColor = Color.White; isearchtap.Source = "Magnifier.png"; searchtapLabel.TextColor = Color.DimGray; MyJobstap.BackgroundColor = Color.FromHex("#87c8ee"); iMyJobstap.Source = "MyJobsi.png"; MyJobstapLabel.TextColor = Color.White; search.IsEnabled = true; clear.IsEnabled = true; } }
public static async Task LoadJobsListSearch(string searchtext, string ZipCode, DateTime startDate, DateTime endDate, double minhourrate, double maxhourate) { try { if (JobListHelper.SearchJobsModel == null) { JobListHelper.IntialzieList(); } JobSearchRestClient JobSearch = new JobSearchRestClient(); var currentPage = JobListHelper.CurrentPage; var pageSize = JobListHelper.PageSize; if (string.IsNullOrEmpty(searchtext)) { searchtext = "null"; } if (string.IsNullOrEmpty(ZipCode)) { ZipCode = "null"; } if (JobListHelper.IsSearching == false) { startDate = DateTime.MinValue; endDate = DateTime.MinValue; searchtext = "null"; ZipCode = "null"; minhourrate = 0; maxhourate = 0; if (JobListHelper.SearchJobsModel == null || JobListHelper.SearchJobsModel.result == null || JobListHelper.SearchJobsModel.result.Count() == 0) { JobListHelper.CurrentPage = 1; } else { JobListHelper.CurrentPage++; } pageSize = JobListHelper.PageSize; } else { JobListHelper.CurrentPage = 1; currentPage = JobListHelper.CurrentPage; pageSize = JobListHelper.SearchJobsModel.TotalCount; //JobListHelper.FilterPageSize; JobListHelper.SearchJobsModel.result = new System.Collections.Generic.List <Model.jobs.JobDataModel>(); } var newJobsList = await JobSearch.GeTJobsearchDetails(URLConfig.SearchUrl, searchtext, pageSize, currentPage, ZipCode, startDate, endDate, minhourrate, maxhourate); //TODO: Time Out Exception if (newJobsList == null) { return; } newJobsList.result = await BindJobsData(newJobsList.result); if (newJobsList != null && newJobsList.result.Count > 0) { foreach (var item in newJobsList.result) { if (JobListHelper.SearchJobsModel.result.Any(d => d.Id == item.Id) == false) { JobListHelper.SearchJobsModel.result.Add(item); } } JobsCounterHelper.NoOfCurrentJobs = newJobsList.TotalCount; JobsCounterHelper.NoOFSavedJobs = newJobsList.TotalSaved; JobsCounterHelper.NoOfAppliedJobs = newJobsList.TotalApplied; JobListHelper.SearchJobsModel.result = JobListHelper.SearchJobsModel.result.OrderByDescending(d => d.CreatedDate).ToList(); JobListHelper.SearchJobsModel.TotalCount = newJobsList.TotalCount; } else { if (JobListHelper.IsSearching) { JobListHelper.SearchJobsModel.result = new System.Collections.Generic.List <Model.jobs.JobDataModel>(); } } } catch (Exception ex) { var logged = new LoggedException.LoggedException("Error while trying to load jobs in the search screen", ex); await logged.LoggAPI(); } }