private string GetApplicationPostedDate(DateTime dt) { CMSTranslateExtension trans = new CMSTranslateExtension(); string retDate = trans.GetProviderValueString("talentsearchlblposted"); DateTime current = DateTime.Now; var dateSpan = DateTimeSpan.CompareDates(dt, current); if (dateSpan.Months < 1) { retDate += $" {((int)dateSpan.Days / 7).ToString()} {trans.GetProviderValueString("talentsearchlblweeks")} {trans.GetProviderValueString("talentsearchlblpostedago")}"; } else { // weeks retDate += $" {dateSpan.Months.ToString()} {trans.GetProviderValueString("talentsearchlblmonths")} {trans.GetProviderValueString("talentsearchlblpostedago")}"; } return(retDate); }
private async Task ProcessSearch() { try { Dialog.ShowLoading(); StringBuilder searchFilter = new StringBuilder(); string filterJoin = string.Empty; if (GlobalSetting.FilterQuery == null || GlobalSetting.FilterQuery.Length < 0) { filterJoin = String.Format("JobType eq '*' "); searchFilter.Append(filterJoin); } if (_searchLocaiton != null && _searchLocaiton.Length > 0) { filterJoin = String.Format("and location eq '{0}' ", _searchLocaiton); searchFilter.Append(filterJoin); } if (_searchText != null && _searchText.Length > 0) { filterJoin = String.Format("and Keyword eq '{0}' ", _searchText); searchFilter.Append(filterJoin); } if (GlobalSetting.position != null) { filterJoin = String.Format("and geoLocationLatitude eq '{0}' ", GlobalSetting.position.Latitude); searchFilter.Append(filterJoin); filterJoin = String.Format("and geoLocationLongitude eq '{0}' ", GlobalSetting.position.Longitude); searchFilter.Append(filterJoin); } filterJoin = String.Format("and language eq '{0}' ", DebugDataSingleton.Instance.Language); searchFilter.Append(filterJoin); //filterJoin = String.Format("and regionOrProvince eq '{0}' ",); searchFilter.Append(filterJoin); var result = await AWHttpClient.Instance.GetCandidatesList(searchFilter.ToString()); if (result.Result.candidateObjectList.candidateList != null && result.Result.candidateObjectList.candidateList.Count > 0) { CandidateList = new ObservableCollection <Candidate>(result.Result.candidateObjectList.candidateList); } } catch (Exception ex) { Debug.WriteLine(ex.Message); } finally{ Dialog.HideLoading(); } //ApiService sv = new ApiService(); //Get the CandidateList //CandidateList = await sv.GetSearchApplicationsAsync(SearchText, SearchLocation); // set up ApplicationSearchResultPostedDate for localization //foreach(var item in CandidateList) //{ // item.ApplicationSearchResultPostedDate = GetApplicationPostedDate(item.ApplicationDate); //} CMSTranslateExtension trans = new CMSTranslateExtension(); //// setup count here SearchResultCount = $"{CandidateList.Count} {trans.GetProviderValueString("talentsearchlblresultsfound")}"; }