コード例 #1
0
        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;
            }
        }
コード例 #2
0
        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();
            }
        }