public static void ShowWorkersInfoByDepartment(ref HumanResourceManager humanResourceManager) { Console.WriteLine("\n ======================= \n"); if (humanResourceManager.Departments.Length == 0) { Console.WriteLine("Hal-hazirda 1 dene bele olsun departament movcud deyil ona gore de departamente gore isci siyahisini gore bilmezsiniz!"); return; } Console.Write("Iscilerin siyahisini gormek istediyiniz departamentin adini daxil edin: "); string depname = Console.ReadLine(); depname = depname.Trim(); if (humanResourceManager.IsDepartmentExistByName(depname)) { if (humanResourceManager.GetEmployeesbyDepartment(depname).Length == 0) { Console.WriteLine("Bu departamentde isci yoxdur!"); return; } int i = 0; foreach (var item in humanResourceManager.GetDepartmentByName(depname).Employees) { Console.WriteLine($"\n ======================= \n{i + 1}. iscinin tam adi: {item.Fullname}\nNomresi: {item.No}\nMovqesi: {item.Position}\nMaasi: {item.Salary}\nDepartamenti: {item.DepartmentName}\nTevelludu: {item.BirthYear.ToString()}\nIse baslama tarixi: {item.StartDate.Year.ToString()} "); } } else { Console.WriteLine("Bu adda department yoxdur!"); } Console.WriteLine("\n ======================= \n"); }
public static void ResetValuesofADepartment(ref HumanResourceManager humanResourceManager) { Console.WriteLine("\n ======================= \n"); if (humanResourceManager.Departments.Length == 0) { Console.WriteLine("Hal-hazirda 1 dene bele olsun departament movcud deyil ona gore de hec neyi deyise bilmezsiniz!"); return; } Console.Write("Zehmet olmasa deyerlerini yenilemek istediyiniz departmentin adini daxil edin: "); string depname = Console.ReadLine(); string newdepname; string newworkerlimitStr; int newworkerlimit; string newsalarylimitStr; double newsalarylimit; if (humanResourceManager.IsDepartmentExistByName(depname)) { do { Console.Write("Yeni adi daxil edin: "); newdepname = Console.ReadLine(); if (humanResourceManager.IsDepartmentExistByName(newdepname)) { Console.WriteLine("Bu adda department artiq movcuddur!"); } } while (string.IsNullOrWhiteSpace(newdepname) || humanResourceManager.IsDepartmentExistByName(newdepname) || newdepname.Length < 2); do { Console.Write("Yeni isci limitini teyin edin: "); newworkerlimitStr = Console.ReadLine(); newworkerlimitStr = newworkerlimitStr.Trim(); } while (!int.TryParse(newworkerlimitStr, out newworkerlimit) || newworkerlimit < 1); do { Console.Write("Iscilerin maaslarinin yeni maksimum cemini daxil edin: "); newsalarylimitStr = Console.ReadLine(); newsalarylimitStr = newsalarylimitStr.Trim(); } while (!double.TryParse(newsalarylimitStr, out newsalarylimit)); { Department editeddepartment = humanResourceManager.GetDepartmentByName(depname); editeddepartment.Name = newdepname; editeddepartment.WorkerLimit = newworkerlimit; editeddepartment.SalaryLimit = newsalarylimit; Console.WriteLine("Deyisdirildi!"); } } else { Console.WriteLine("Bu adda department movcud deyil!"); } Console.WriteLine("\n ======================= \n"); }
public static void AddEmployeeToADepartment(ref HumanResourceManager humanResourceManager) { Console.WriteLine("\n ======================= \n"); Console.Write("Iscini elave edeceyiniz departamenti secin: "); string department = Console.ReadLine(); department = department.Trim(); string fullname; string birthDateStr; DateTime birthDate; string position; string salaryStr; double salary; if (humanResourceManager.IsDepartmentExistByName(department)) { if (humanResourceManager.GetDepartmentByName(department).Employees.Length == humanResourceManager.GetDepartmentByName(department).WorkerLimit) { Console.WriteLine("Departamentin isci limiti dolub!"); return; } else { do { Console.Write("Iscinin tam adini daxil edin: "); fullname = Console.ReadLine(); fullname = fullname.Trim(); if (fullname.Split(' ').Length == 2) { fullname = fullname.Split(' ')[0].ToUpper().Substring(0, 1) + fullname.Split(' ')[0].ToLower().Substring(1) + ' ' + fullname.Split(' ')[1].ToUpper().Substring(0, 1) + fullname.Split(' ')[1].ToLower().Substring(1); } } while (string.IsNullOrWhiteSpace(fullname) || fullname.Split(' ').Length != 2); do { Console.WriteLine("Iscinin dogum ilini,ayini ve gununu daxil edin(yyyy/mm/dd): "); birthDateStr = Console.ReadLine(); birthDateStr = birthDateStr.Trim(); if (!DateTime.TryParse(birthDateStr, out birthDate)) { Console.WriteLine("Tarixi dogru daxil edin!"); } } while (!DateTime.TryParse(birthDateStr, out birthDate)); do { Console.Write("Iscinin departamentdeki movqesini teyin edin: "); position = Console.ReadLine(); position = position.Trim(); if (position.Length <= 2) { Console.WriteLine("Movqe adinin uzunlugu 2 ve daha kicik ola bilmez!"); } } while (position.Length <= 2); do { Console.Write("Iscinin maasini teyin edin: "); salaryStr = Console.ReadLine(); salaryStr = salaryStr.Trim(); if (double.TryParse(salaryStr, out salary) && salary < 250) { Console.WriteLine("Iscinin maasi 250 ve daha az ola bilmez!"); } else if (!double.TryParse(salaryStr, out salary)) { Console.WriteLine("Maasi ededle ifade edin!"); } } while (!double.TryParse(salaryStr, out salary) || salary < 250); humanResourceManager.AddEmployee(fullname, birthDate, position, salary, DateTime.Now, department); } } else { Console.WriteLine("Bele bir departament movcud deyil!"); } Console.WriteLine("\n ======================= \n"); }