private List <int> Add5Nurse() { var list = new List <int>(); var nurses = Manage1.ListToAddToScheduleNurse(); for (int i = 0; i < 5; i++) { var IsSuccess = false; var choice = default(int); while (!IsSuccess) { Console.Clear(); foreach (var x in nurses.Select((value, index) => new { value, index })) { Console.WriteLine($"{x.index + 1}. {x.value}"); } Console.WriteLine("\n"); Console.WriteLine("Wybierz pielegniarke do tego dnia"); IsSuccess = int.TryParse(Console.ReadLine(), out choice); if (IsSuccess && (choice <= nurses.Count())) { break; } IsSuccess = false; Console.WriteLine("Wybrales niewlasciwa osobe, nacisnij dowolny klawisz aby kontynuowac"); Console.ReadLine(); } nurses.RemoveAt(choice - 1); list.Add(choice - 1); } return(list); }
/// <returns>Zwraca numer id (juz z deinkremenotwany) osoby do dodania</returns> private int AddDoctor(int specialization) { var doctors = Manage1.ListToAddToScheduleDoctor(specialization); var IsSuccess = false; var choice = default(int); while (!IsSuccess) { Console.Clear(); foreach (var x in doctors.Select((value, index) => new { value, index })) { Console.WriteLine($"{x.index + 1}. {x.value}"); } Console.WriteLine("\n"); Console.WriteLine("Wybierz doktora do tego dnia"); IsSuccess = int.TryParse(Console.ReadLine(), out choice); if (IsSuccess && (choice <= doctors.Count())) { break; } IsSuccess = false; Console.WriteLine("Wybrales niewlasciwa osobe, nacisnij dowolny klawisz aby kontynuowac"); Console.ReadLine(); } return(choice - 1); }
/// <returns>funkcja zwraca wybor stanowiska w int ktory potem przeksztalcimy na enuma</returns> private int getPosition() { var isSuccessChoicePostion = false; var choicePostion = default(int); while (!isSuccessChoicePostion) { Console.Clear(); Console.WriteLine("Wybierz stanowisko: "); var listPositions = Manage1.GetNameProffessions(); foreach (var x in listPositions.Select((value, index) => new { value, index })) { Console.WriteLine($"{x.index} - {x.value}"); } isSuccessChoicePostion = int.TryParse(Console.ReadLine(), out choicePostion); if (isSuccessChoicePostion && (choicePostion < listPositions.Count)) { break; } Console.WriteLine("\n Niepoprawna odpowiedz, wcisnij dowolny przycisk"); Console.ReadLine(); isSuccessChoicePostion = false; } return(choicePostion); }
/// <summary> /// Funkcja usuwa uzytkownika za pomoca deinkremetowanego id, /// ktory sie wyswietla w liscie showlistemployess /// </summary> public void DeleteUser() { var amountUsers = Manage1.ShowList4UserProffessions().Count(); var isSuccessDownloadId = false; var id = default(int); while (!isSuccessDownloadId) { this.ShowListEmployess(); Console.WriteLine("\n"); Console.WriteLine("Wybierz numer uzytkownika ktorego uzytkownika chcesz usunac: "); isSuccessDownloadId = int.TryParse(Console.ReadLine(), out id); if (isSuccessDownloadId && (id < amountUsers + 1) && (id > 0)) { break; } isSuccessDownloadId = false; Console.WriteLine("Wybrano niewlasciwa osobe. Czy chcesz sprobowaj jeszcze raz? T/N"); var again = Console.ReadLine(); if (again == "n" || again == "N") { return; } } Manage1.DeletePerson(id); }
/// <summary> /// glowne menu aplikacji /// </summary> /// <returns>Zwraca inta wyboru (jesli bedzie 0 glowna petla bedzie konczyla dzialanie)</returns> public int ChoiceOperation() { Console.Clear(); Console.WriteLine("Wybierz, co chcesz zrobic:"); if (Manage1.IsAdministrator()) { optionsList4Admin.ForEach(x => Console.WriteLine(x)); } else { optionsList.ForEach(x => Console.WriteLine(x)); } var isTrueChoice = int.TryParse(Console.ReadLine(), out int choice); if (isTrueChoice && (choice < optionsList4Admin.Count)) { return(choice); } else { Console.WriteLine("zly klawisz"); } return(-1); }
public void CheckMonth() { Console.Clear(); var list = Manage1.GetScheduleAllDays(); list.ForEach(x => Console.WriteLine(x)); Console.WriteLine("Nacisnij dowolny przycisk, aby zakonczyc"); Console.ReadLine(); }
public void Day() { Console.Clear(); var list = Manage1.GetScheduleAllDays(); Console.WriteLine("Najblizszy dzien: "); Console.WriteLine("\n"); for (int i = 0; i < 11; i++) { Console.WriteLine(list[i]); } Console.WriteLine("Nacisnij dowolny przycisk, aby zakonczyc"); Console.ReadLine(); }
public void MainSchedule() { var launch = true; while (launch) { Console.Clear(); this.optionsList.ForEach(x => Console.WriteLine(x)); Console.WriteLine("\n"); if (Manage1.IsDoctor()) { Console.WriteLine("3 - Dodaj personel"); } var isSuccessParse = int.TryParse(Console.ReadLine(), out int choice); switch (choice) { case 0: launch = false; break; case 1: this.CheckMonth(); break; case 2: this.Day(); break; case 3: this.AddPersonnel(); break; default: Console.WriteLine("Niewlasciwy klawisz, nacisnij dowolny przycisk aby powtorzyc"); Console.ReadLine(); break; } } }
/// <summary> /// Prosi uzytkownika o dane do logowania, nastepnie je sprawdza. /// z tego powodu ze jest to klasa dziedziczaca Manage1 jest niewidoczny w klasie ManageUI /// </summary> /// <returns>zwraca login i haslo</returns> public (string, string) CheckUserLoginPassword() { var isSuccess = false; var login = default(string); var pass = default(string); while (!isSuccess) { Console.WriteLine("Podaj login:"******"Podaj haslo:"); pass = Console.ReadLine(); isSuccess = Manage1.TryLogging(login, pass, false); if (!isSuccess) { Console.Clear(); Console.WriteLine("Login lub haslo jest niepoprawne"); } } return(login, pass); }
public void AddPersonnel() { Console.WriteLine("Czy chcesz dodac personel do konkretnego dnia, nacisnij T/N"); var isExit = Console.ReadLine(); if (isExit == "N" || isExit == "n") { return; } Console.Clear(); // specjalizacje lekarzy // 1 - laryngolog // 2 - kardiolog // 3 - urolog var docLaryngolog = this.AddDoctor(1); var docKardiolog = this.AddDoctor(2); var docUrolog = this.AddDoctor(3); var nurses5list = this.Add5Nurse(); var admin = this.AddAdmin(); Manage1.ScheduleManage(docLaryngolog, docKardiolog, docUrolog, nurses5list, admin); }
/// <summary> /// Pobieranie danych do stworzenia nowego uzytkownika /// </summary> public void AddNewUser() { Console.WriteLine("Chcesz dodac nowego uzytkownika? T/N"); var isContinue = Console.ReadLine(); if (isContinue == "n" || isContinue == "N") { return; } var checkGettingDate = false; var login = default(string); var pass = default(string); var name = default(string); var surname = default(string); var pesel = default(string); while (!checkGettingDate) { Console.Clear(); Console.WriteLine("Podaj login"); login = Console.ReadLine(); Console.WriteLine("Podaj haslo"); pass = Console.ReadLine(); Console.WriteLine("Podaj imie"); name = Console.ReadLine(); Console.WriteLine("Podaj nazwisko"); surname = Console.ReadLine(); Console.WriteLine("Podaj pesel"); pesel = Console.ReadLine(); if (login.Length < 3 || pass.Length < 3 || name.Length < 3 || surname.Length < 3 || pesel.Length != 11) { Console.WriteLine("Jedno z pol ma mniej niz 3 znaki, lub pesel nie ma 11 liczb"); Console.WriteLine("Nacisnij dowolny klawisz, aby wprowadzic dane jeszcze raz"); Console.ReadLine(); checkGettingDate = false; } else { break; } } var choicePosition = this.getPosition(); var choiceSpecialization = 0; if (choicePosition == 2) { choiceSpecialization = this.getDoctorSpecialization(); } Manage1.CreateNewPerson(login, pass, name, surname, pesel, choicePosition, choiceSpecialization); Console.Clear(); Console.WriteLine($"Dodano uzytkownika {name} {surname} \n"); }