private async Task LoadMoreVacancies() { IsBusy = true; LoadMoreIsVisible = false; FilterParameters.CurrentPage += 1; Dictionary <string, object> obj = await _candidateExploreService.GetCandidateJobsSearch(FilterParameters); if (obj["Jobs"] != null) { List <ContactJobs> listMore = JsonConvert.DeserializeObject <List <ContactJobs> >(obj["Jobs"].ToString()); foreach (var item in listMore) { Vacancies.Add(item); } if (listMore.Count < PageSize) { LoadMoreIsVisible = false; } else { LoadMoreIsVisible = true; } } else { FilterParameters.CurrentPage--; LoadMoreIsVisible = true; } IsBusy = false; }
private async Task LoadMoreVacancies() { IsBusy = true; _currentPageVacancies += 1; AccountJobs AJ = new AccountJobs { AccountID = _accountID, CurrentPage = _currentPageVacancies, PageSize = PageSize }; dynamic obj = await _employerJobService.GetRelatedJobs(AJ); if (obj["Jobs"] != null) { List <AccountJobs> listMore = JsonConvert.DeserializeObject <List <AccountJobs> >(obj["records"].ToString()); if (listMore.Count > 0) { foreach (var item in listMore) { Vacancies.Add(item); } if (obj["hasMore"] == false) { VacancisLoadMoreIsVisible = false; } } else { VacancisLoadMoreIsVisible = false; } } IsBusy = false; }
async public Task GetVacancies() { for (var page = 0; page < MaxNumberVacancies / PerPage; page++) { Console.Write("Page:{0}\t\r", page); using (MyClient = new HttpClient()) { MyClient.DefaultRequestHeaders.Add("user-agent", "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.106 Safari/537.36 OPR/38.0.2220.41"); MyClient.BaseAddress = Path; HttpResponseMessage response; using (response = await MyClient.GetAsync( string.Format("vacancies?page={0}&per_page={1}", page, PerPage))) { if (response.IsSuccessStatusCode) { var data = response.Content.ReadAsStringAsync(); var myContent = (JArray)JToken.Parse(data.Result.ToString())["items"]; foreach (var vacancyJson in myContent) { response = await MyClient.GetAsync( string.Format("vacancies/{0}", vacancyJson["id"].ToString())); if (response.IsSuccessStatusCode) { data = response.Content.ReadAsStringAsync(); var vacancy = Deserialize(data.Result.ToString()); if (vacancy != null) { if (vacancy.Salary.Check()) { Vacancies.Add(vacancy); } } } } } } } } }
private async Task LoadByGame(int pos) { if (IsLoading) { return; } IsLoading = true; try { var vacancies = await _vacancyService.GetVacanciesByGameAsync(Games[pos].GameId); Vacancies.Clear(); foreach (Vacancy vacancy in vacancies) { Vacancies.Add(vacancy); } } finally { IsLoading = false; } }
private void Vacancies_CollectionChanged1(object sender, NotifyCollectionChangedEventArgs e) { switch (e.Action) { case NotifyCollectionChangedAction.Add: foreach (Vacancy vacancy in e.NewItems) { if (!Vacancies.Contains(vacancy)) { Vacancies.Add(vacancy); } } break; case NotifyCollectionChangedAction.Remove: foreach (Vacancy vacancy in e.OldItems) { if (Vacancies.Contains(vacancy)) { Vacancies.Remove(vacancy); } } break; case NotifyCollectionChangedAction.Replace: break; case NotifyCollectionChangedAction.Move: break; case NotifyCollectionChangedAction.Reset: break; default: break; } }
public void Fill_Test_Data(int n) { List <string> pos = new List <string>(); try { using (StreamReader sr = new StreamReader("Position.txt", System.Text.Encoding.Default)) { string line; while ((line = sr.ReadLine()) != null) { pos.Add(line); } } } catch (System.IO.FileNotFoundException) { File.Create("Position.txt"); } List <string> spec = new List <string>(); try { using (StreamReader sr = new StreamReader("Speciality.txt", System.Text.Encoding.Default)) { string line; while ((line = sr.ReadLine()) != null) { spec.Add(line); } } } catch (System.IO.FileNotFoundException) { File.Create("Speciality.txt"); } if (pos.Count != 0 && spec.Count != 0) { //Vacancies if (Vacancies.Count == 0) { Vacancies.Clear(); for (int i = 0; i < n * 2; ++i) { Vacancies.Add(new Vacancy(pos[i % pos.Count], spec[i % spec.Count], 10000 + (i * 15.65))); } } //Job Seekers if (Job_Seekers.Count == 0) { Job_Seekers.Clear(); for (int i = 1; i <= n * 2; ++i) { Job_Seekers.Add(new Job_Seeker($"Name{i % 50}", $"Surname{i % 200}", DateTime.Now - TimeSpan.FromDays(7000) - TimeSpan.FromDays(i * i), "" + Convert.ToChar(i % 120) + $"{i * 8}", "Higher", spec[i % spec.Count], $"{i * 100 + (i + 3) * 10 + i}")); } } //Employees if (Employees.Count == 0) { Employees.Clear(); for (int i = 0; i < n; ++i) { Employees.Add(new Employee(Job_Seekers[i], Vacancies[i])); Job_Seekers.Remove(Job_Seekers[i]); Vacancies.Remove(Vacancies[i]); } } //Orders if (Orders.Count == 0) { Orders.Clear(); for (int i = 0; i < n / 2; ++i) { Orders.Add(new Order(Employees[i])); Orders.Add(new Order(Job_Seekers[i], Vacancies[i])); } } if (Director == null) { //Director //Создадим по 1 виду пользователя с более конкретнымми данными //для авторизации и проверки работоспособности приложения Employees.Add(new Employee(new Job_Seeker("EmployeeName", "EmployeeSurname", DateTime.Now - TimeSpan.FromDays(7000), "ANK1254", "Hight", "Loyer", "Employee"), Vacancies.Last())); Vacancies.Remove(Vacancies.Last()); Employees.Add(new Employee(new Job_Seeker("DirectorName", "DirectorSurname", DateTime.Now - TimeSpan.FromDays(8000), "SDK9054", "Hight", "Loyer", "Director"), Vacancies.Last())); Vacancies.Remove(Vacancies.Last()); Chenge_Director(Employees.Last()); Job_Seekers.Add(new Job_Seeker("JobseekerName", "JobseekerSurname", DateTime.Now - TimeSpan.FromDays(10000), "RTG1569", "Hight", "Pediatric_radiology", "Jobseeker")); } Save(); } }
public void AddNewVacancy(Vacancy vacancy) { CurrentHR.Vacancies.Add(vacancy); Vacancies.Add(vacancy); OnVacanciesChanged?.Invoke(); }