public void AddEmployers(Employer employer) { employers.Add(employer); }
public void Control() { Employer emp = new Employer(); while (true) { Console.WriteLine("Username:"******"Password"); string password = Console.ReadLine(); emp = (Employer)database.LoginForUser(employer, username, password); if (emp == null) { Console.Clear(); Console.WriteLine("Input again"); continue; } else { break; } } Console.WriteLine("Xos geldin " + emp.Name); database.notifications.Add(new AllNotf { Text = $"{emp.Name} logged in" }); var bidigosteren = emp.GetAllListBid(); while (true) { string str = ""; int n; Console.Clear(); Console.WriteLine("1.Show All Worker"); Console.WriteLine("2.Sort By Work"); Console.WriteLine("3.Show By Skills"); Console.WriteLine("4.Show By City"); Console.WriteLine("5.Show Your Vacancie"); Console.WriteLine("6.Bid"); if (!bidigosteren.Any()) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("7.Show Bid"); Console.ResetColor(); } else { Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine("7.Show Bid"); Console.ResetColor(); } Console.WriteLine("8.Delete All bid"); Console.WriteLine("9.Exit"); try { Console.WriteLine("Select operation:"); int select = Convert.ToInt32(Console.ReadLine()); switch ((EmployerSort)select) { case EmployerSort.ShowAll: { bool b = true; database.ShowAllUser(worker); Console.WriteLine("Dp you want show Detail(CV):y/n"); char ch = Convert.ToChar(Console.ReadLine()); ch = char.ToUpper(ch); if (ch == 89) { Console.Clear(); database.ShowAllUser(worker, b); } database.notifications.Add(new AllNotf { Text = $"{emp.Name} look at all workers" }); Console.ReadLine(); } break; case EmployerSort.SortByWork: { List <CV> s = new List <CV>(); s = database.GetAllCvList(); int a = s.Count(); Console.WriteLine("Sort by Work"); for (int i = 0; i < a; i++) { Console.WriteLine((i + 1) + ")" + s[i].Speciality); } n = Convert.ToInt32(Console.ReadLine()); while (n <= 0 || n > a) { Console.WriteLine("Input again:"); n = Convert.ToInt32(Console.ReadLine()); } for (int i = 0; i < a; i++) { if (n == (i + 1)) { str = s[i].Speciality; } } database.UserWork(worker, str); database.notifications.Add(new AllNotf { Text = $"{emp.Name} filter by work" }); Console.ReadLine(); } break; case EmployerSort.SortBySkills: { List <CV> s = new List <CV>(); s = database.GetAllCvList(); int a = s.Count(); Console.WriteLine("Sort by Skills"); for (int i = 0; i < a; i++) { Console.WriteLine((i + 1) + ")" + s[i].Skills); } n = Convert.ToInt32(Console.ReadLine()); while (n <= 0 || n > a) { Console.WriteLine("Input again:"); n = Convert.ToInt32(Console.ReadLine()); } for (int i = 0; i < a; i++) { if (n == (i + 1)) { str = s[i].Skills; } } database.WorkerCvSkills(str); database.notifications.Add(new AllNotf { Text = $"{emp.Name} filter by skills" }); Console.ReadLine(); } break; case EmployerSort.SortByCity: { List <CV> s = new List <CV>(); s = database.GetAllCvList(); int a = s.Count(); Console.WriteLine("Sort by City"); for (int i = 0; i < a; i++) { Console.WriteLine((i + 1) + ")" + s[i].School); } n = Convert.ToInt32(Console.ReadLine()); while (n <= 0 || n > a) { Console.WriteLine("Input again:"); n = Convert.ToInt32(Console.ReadLine()); } for (int i = 0; i < a; i++) { if (n == (i + 1)) { str = s[i].School; } } //database.WorkerCvSkills(str); database.EmpVacancieCity(worker, str); database.notifications.Add(new AllNotf { Text = $"{emp.Name} filter by city" }); Console.ReadLine(); } break; case EmployerSort.Exit: { return; } case EmployerSort.ShowYourVacancie: { emp.ShowYourEmployersVacancie(); Console.ReadLine(); } break; case EmployerSort.Bid: { Console.WriteLine("Vakansiyanizi kime gondermek isteyirsiniz"); Console.WriteLine("ID:"); int id = Convert.ToInt32(Console.ReadLine()); Console.WriteLine("Hansi vakansiyanizi gondermek isteyirsiniz:"); int d = Convert.ToInt32(Console.ReadLine()); //var vac = emp.GetVacancieById(1); var vac = emp.GetVacancieById(d); var wk = GetWorkerById(id); wk.AddBid(vac); database.notifications.Add(new AllNotf { Text = $"{emp.Name} send vacancie to {wk.Name}" }); Console.ReadLine(); } break; case EmployerSort.ShowBid: { if (!bidigosteren.Any()) { Console.WriteLine("EMPTY!!!!"); } else { Console.WriteLine("\n\n"); Console.WriteLine("BIDI EMPLOYERDE GOSTER"); emp.ShowBide(); Console.WriteLine("\n\n"); } Console.ReadLine(); } break; case EmployerSort.DeleteAllBid: { bidigosteren.Clear(); database.notifications.Add(new AllNotf { Text = $"{emp.Name} clear all bid" }); Console.WriteLine("All bid deleted"); Console.ReadLine(); } break; } } catch (FormatException) { Console.WriteLine("WRONG!!!"); Console.ReadLine(); } catch (ArgumentOutOfRangeException ex) { Console.WriteLine(ex.StackTrace); Console.ReadLine(); } } }
static void Main(string[] args) { Console.OutputEncoding = System.Text.Encoding.UTF8; CV cv1 = new CV { Speciality = "Developer", Score = 601, School = "Baki", Skills = "C++ C#", Companies = "Step IT :)", Language = "English", IsDegree = false }; CV cv2 = new CV { Speciality = "Designer", Score = 618, School = "Gence", Skills = "Adobe Photoshop", Companies = "Google:)", Language = "English", IsDegree = true }; CV cv3 = new CV { Speciality = "Marketing", Score = 546, School = "Gence", Skills = "Market and İlustrator", Companies = "Freelance", Language = "English", IsDegree = true }; CV cv4 = new CV { Speciality = "Designer", Score = 500, School = "Sumqayit", //Skills = "Photoshopu", Skills = "Adobe Photoshop", Companies = "Freelance", Language = "English German", IsDegree = true }; //CV cv5 = new CV //{ // Speciality = "Designer", // Score = 500, // School = "Sumqayit", // //Skills = "Photoshopu", // Skills = "Marketing", // Companies = "Freelance", // Language = "English German", // IsDegree = true //}; Vacancie vacancie1 = new Vacancie { Work = "Designer", Field = "Web", City = "Baku", Price = 1000, HasEducation = true, Experience = 1, Text = "Sosial şəbəkələr üçün postalrın hazırlanması" }; Vacancie vacancie2 = new Vacancie { Work = "Designer", Field = "Artist", City = "Baku", Price = 700, HasEducation = false || true, Experience = 2, Text = "Rəssamlıq işlərinin görülməsi" }; Vacancie vacancie3 = new Vacancie { Work = "IT", Field = "Developer", City = "Baku", Price = 2000, HasEducation = true, Experience = 3, Text = "C# Net Developer" }; Vacancie vacancie4 = new Vacancie { Work = "IT", Field = "System Controller", City = "Gence", Price = 600, HasEducation = true || false, Experience = 3, Text = "Supporting server, desktop and network infrastructure of customers" }; Worker worker1 = new Worker { Name = "Vaqif", Surname = "Vaqifli", City = "Baki", Phone = "+994509983438", Age = 20, Field = "IT", WorkerName = "worker1", Password = "******" }; Worker worker2 = new Worker { Name = "Aysel", Surname = "Ayselli", City = "Gence", Phone = "+99434243", Age = 21, Field = "Designer", WorkerName = "worker2", Password = "******" }; Worker worker3 = new Worker { Name = "Kamil", Surname = "Kamilli", // City = "Baki", City = "Sumqayit", Phone = "+994354453", Age = 20, Field = "Designer", WorkerName = "worker3", Password = "******" }; List <Vacancie> vacancies = new List <Vacancie>(); vacancies.Add(vacancie1); vacancies.Add(vacancie2); vacancies.Add(vacancie3); vacancies.Add(vacancie4); //foreach (var item in vacancies) //{ // Console.WriteLine(item.Work); //} ////User user = new User(); worker1.AddCv(cv1); //worker1.Detail(); //worker1.UpdateCvById(1); //worker1.Detail(); worker2.AddCv(cv2); worker2.AddCv(cv3); worker3.AddCv(cv4); //worker3.AddCv(cv5); Worker worker = new Worker(); Employer employer = new Employer(); Employer employer1 = new Employer { Name = "Eli", Surname = "Elili", City = "Baki", Phone = "+99434643", Age = 21, WorkerName = "employer1", Password = "******" }; Employer employer2 = new Employer { Name = "Ali", Surname = "Alili", City = "Bakii", Phone = "+85393", Age = 21, WorkerName = "employer2", Password = "******" }; Employer employer3 = new Employer { Name = "Veli", Surname = "Velili", City = "Sumqayit", Phone = "+58833", Age = 21, WorkerName = "employer3", Password = "******" }; employer1.AddVacancie(vacancie1); employer2.AddVacancie(vacancie2); employer3.AddVacancie(vacancie3); employer3.AddVacancie(vacancie4); List <Worker> workers = new List <Worker>(); workers.Add(worker1); workers.Add(worker2); workers.Add(worker3); List <Employer> employers = new List <Employer>(); employers.Add(employer1); employers.Add(employer2); employers.Add(employer3); Database database = new Database(); database.AddWorker(worker1); database.AddWorker(worker2); database.AddWorker(worker3); database.AddEmployers(employer1); database.AddEmployers(employer2); database.AddEmployers(employer3); AdminLogin aw = new AdminLogin(worker, database); //aw.Control(); AdminLogin ae = new AdminLogin(employer, database); //ae.Control(); WorkerLogin workerLogin = new WorkerLogin(employer, database); //workerLogin.Control(); EmployerLogin employerLogin = new EmployerLogin(worker, database); //employerLogin.Control(); Admin admin = new Admin() { Name = "Raul" }; //Files.JsonSerializeWorker(workers); //Files.JsonDeSerializeWorker(); //Files.JsonSerializeEmployer(employers); //Files.JsonSerializeVacancie(vacancies); //Files.JsonDeSerializeEmployer(); // Console.ReadLine(); while (true) { Console.WriteLine("1)Admin"); Console.WriteLine("2)Worker"); Console.WriteLine("3)Employer"); Console.WriteLine("4)Close Program"); string selectt = Console.ReadLine(); int select; if (int.TryParse(selectt, out int num)) { select = int.Parse(selectt); while (select != 1 && select != 2 && select != 3 && select != 4) { Console.Clear(); Console.WriteLine("Input again"); break; } } else { Console.Clear(); Console.WriteLine("Input again"); continue; } switch ((TypeLogin)select) { case TypeLogin.Admin: { Log.SignIn(admin.Username, admin.PasswordHash); while (true) { Console.WriteLine("1)Control Worker\n2)Control Employer\n" + "3)Show Notification\n4)Exit"); string choicee = Console.ReadLine(); int choice; if (int.TryParse(choicee, out int nu)) { choice = int.Parse(choicee); if (choice != 1 && choice != 2 && choice != 3 && choice != 4) { Console.Clear(); Console.WriteLine("Input again"); //break; } else if (choice == 1) { aw.Control(); continue; } else if (choice == 2) { ae.Control(); continue; } else if (choice == 3) { //Console.WriteLine("****WorkerNotfication****"); aw.ShowNotf(); Console.ReadLine(); //Console.WriteLine("****EmployerNotfication****"); //ae.ShowNotf(); } else { break; } } else { Console.Clear(); Console.WriteLine("Input again"); continue; } } } break; case TypeLogin.Worker: { workerLogin.Control(); continue; } break; case TypeLogin.Employer: { employerLogin.Control(); continue; } break; case TypeLogin.CloseProgram: { var notf = database.notifications; //Files.JsonSerializeNotf(notf); return; } } } // employerLogin.VacancieControl(); //employer2.ShowEmployersVacancie(); }