public async Task <IActionResult> Edit(int id, [Bind("Pielegniarkaid,Doswiadczenie,Osobaid")] Pielegniarka pielegniarka) { if (id != pielegniarka.Pielegniarkaid) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(pielegniarka); await _context.SaveChangesAsync(); _context.Attach(pielegniarka).State = EntityState.Detached; } catch (DbUpdateConcurrencyException) { if (!PielegniarkaExists(pielegniarka.Pielegniarkaid)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["Osobaid"] = new SelectList(_context.Osoba, "Osobaid", "Info", pielegniarka.Osobaid); return(View(pielegniarka)); }
static void EdycjaPielegniarki(Pielegniarka pielegniarka) { Console.WriteLine("Edycja danych pielegniarki " + pielegniarka.Imie + " " + pielegniarka.Nazwisko); Console.WriteLine("Podaj nowe imie:"); pielegniarka.Imie = Console.ReadLine(); Console.WriteLine("Podaj nowe nazwisko:"); pielegniarka.Nazwisko = Console.ReadLine(); Console.WriteLine("Podaj nowy pesel:"); while (true) { try { pielegniarka.Pesel = long.Parse(Console.ReadLine()); break; } catch (Exception e) { Console.WriteLine(e.Message); } } Console.WriteLine("Podaj nowy login:"******"Podaj nowe hasło:"); pielegniarka.Haslo = Console.ReadLine(); Console.WriteLine(""); Console.WriteLine("Nowe dane pielegniarki:"); Console.WriteLine(pielegniarka.InfoPielegniarka()); Console.ReadKey(); }
static void DodajPielegniarke() { Pielegniarka nowaPielengniarka = new Pielegniarka(); Console.WriteLine("Tworzenie konta pielegniarki:"); Console.WriteLine("Podaj imie:"); nowaPielengniarka.Imie = Console.ReadLine(); Console.WriteLine("Podaj nazwisko:"); nowaPielengniarka.Nazwisko = Console.ReadLine(); Console.WriteLine("Podaj pesel:"); while (true) { try { nowaPielengniarka.Pesel = double.Parse(Console.ReadLine()); break; } catch (Exception e) { Console.WriteLine(e.Message); } } Console.WriteLine("Podaj login:"******"Podaj hasło:"); nowaPielengniarka.Haslo = Console.ReadLine(); Osoby.Add(nowaPielengniarka); Console.WriteLine(""); Console.WriteLine("Dane stworzonego konta pielęgniarki:"); Console.WriteLine(nowaPielengniarka.InfoPielegniarka()); }
private void ZalogujBtn_Click(object sender, RoutedEventArgs e) { Wynik.Visibility = Visibility.Collapsed; userLogin.ClearValue(TextBox.BorderBrushProperty); userPassword.ClearValue(TextBox.BorderBrushProperty); long login; if (!Int64.TryParse(userLogin.Text, out login)) { userLogin.BorderBrush = Brushes.Red; return; } string password = userPassword.Password.ToString(); using DataBaseContext dataBaseContext = new DataBaseContext(); Lekarz user = dataBaseContext.Lekarze.Where(p => p.PESEL == login).FirstOrDefault(); if (user != null) { if (user.Password == password) { this.Visibility = Visibility.Collapsed; doctorForm = new DoctorForm(user.PESEL); doctorForm.ShowDialog(); this.Visibility = Visibility.Visible; userLogin.Text = ""; userPassword.Password = ""; return; } userPassword.BorderBrush = Brushes.Red; return; } Pielegniarka user2 = dataBaseContext.Pielegniarki.Where(p => p.PESEL == login).FirstOrDefault(); if (user2 != null) { if (user2.Password == password) { this.Visibility = Visibility.Collapsed; nurseForm = new NurseForm(user2); nurseForm.ShowDialog(); this.Visibility = Visibility.Visible; userLogin.Text = ""; userPassword.Password = ""; return; } userPassword.BorderBrush = Brushes.Red; return; } Wynik.Content = "Podany użytkownik nie istnieje!"; Wynik.Visibility = Visibility.Visible; return; }
public NurseForm(Pielegniarka pielegniarka) { InitializeComponent(); ObecnaPielegniarka = pielegniarka; using DataBaseContext dataBaseContext = new DataBaseContext(); dataBaseContext.Zabiegi.Include(z => z.pielegniarka).Include(z => z.pacjent).Include(z => z.rodzajZabiegu).Load(); ZabiegiListBox.ItemsSource = dataBaseContext.Zabiegi.Local.Where(z => z.pielegniarka.PESEL == ObecnaPielegniarka.PESEL); PielengniarkaLabel.Content = pielegniarka.Imie + " " + pielegniarka.Nazwisko; }
public async Task <IActionResult> Create([Bind("Pielegniarkaid,Doswiadczenie,Osobaid")] Pielegniarka pielegniarka) { if (ModelState.IsValid) { _context.Add(pielegniarka); await _context.SaveChangesAsync(); _context.Attach(pielegniarka).State = EntityState.Detached; return(RedirectToAction(nameof(Index))); } ViewData["Osobaid"] = new SelectList(_context.Osoba, "Osobaid", "Osobaid", pielegniarka.Osobaid); return(View(pielegniarka)); }
public static Czlowiek UtworzPracownika() { string imie, nazwisko, specjalizacja; int pesel, pwz; Czlowiek pracownik; imie = podajTekst("Podaj imie: "); nazwisko = podajTekst("Podaj nazwisko: "); pesel = podajLiczbe("Podaj pesel: "); if (pytanieTlubN("Czy uzytkownik to admin?<T/N>")) { return(pracownik = new Administrator(imie, nazwisko, pesel, true, "123")); } else if (pytanieTlubN("Czy chcesz podac specjalizacje?<T/N>")) { specjalizacja = podajSpecjalizacje("Wybierz specjalizacje"); pwz = podajLiczbe("Podaj nr PWZ: "); return(pracownik = new Lekarz(imie, nazwisko, pesel, pwz, specjalizacja, false, "123")); } else { return(pracownik = new Pielegniarka(imie, nazwisko, pesel, false, "123")); } }
private void Button_Click(object sender, RoutedEventArgs e) { using DataBaseContext dataBaseContext = new DataBaseContext(); Adres a1 = new Adres { Miasto = "Pitulic", Ulica = "5", Kod_pocztowy = "5-1", Nr_domu = 1 }; Lekarz lekarz1 = new Lekarz { PESEL = 11, Password = "******", Imie = "Jan", Nazwisko = "Boi", Specjalizacja = "Chirureg", adres = a1 }; Lekarz lekarz2 = new Lekarz { PESEL = 12, Password = "******", Imie = "Shrek", Nazwisko = "isLove", Specjalizacja = "Psycholog", adres = a1 }; Lekarz lekarz3 = new Lekarz { PESEL = 13, Password = "******", Imie = "Gandalf", Nazwisko = "Szary", Specjalizacja = "EpicReviving", adres = a1 }; Pielegniarka pielegniarka1 = new Pielegniarka { PESEL = 21, Password = "******", Imie = "Yo", Nazwisko = "Mama", adres = a1 }; Pielegniarka pielegniarka2 = new Pielegniarka { PESEL = 22, Password = "******", Imie = "Big", Nazwisko = "Smoke", adres = a1 }; Pielegniarka pielegniarka3 = new Pielegniarka { PESEL = 23, Password = "******", Imie = "C", Nazwisko = "J", adres = a1 }; Pacjent pacjent1 = new Pacjent { PESEL = 31, Imie = "Bez", Nazwisko = "Imienny", adres = a1 }; Pacjent pacjent2 = new Pacjent { PESEL = 32, Imie = "Ehh", Nazwisko = "Nudy", adres = a1 }; Pacjent pacjent3 = new Pacjent { PESEL = 33, Imie = "Bajo", Nazwisko = "Jajo", adres = a1 }; dataBaseContext.Add(lekarz1); dataBaseContext.Add(lekarz2); dataBaseContext.Add(lekarz3); dataBaseContext.Add(pielegniarka1); dataBaseContext.Add(pielegniarka2); dataBaseContext.Add(pielegniarka3); dataBaseContext.Add(pacjent1); dataBaseContext.Add(pacjent2); dataBaseContext.Add(pacjent3); dataBaseContext.SaveChanges(); }
static void FunkcjePielegniarka(Pielegniarka pielegniarka) { for (; ;) { Console.Clear(); int wybor; Console.WriteLine("Wybierz odpowiednią opcję: "); Console.WriteLine("1. Wyświetlanie listy lekarzy i pielęgniarek"); Console.WriteLine("2. Wyświetlanie dyżurów"); Console.WriteLine("3. Powrót do logowania"); Console.WriteLine(""); Console.WriteLine("0. Wyjście"); while (true) { try { wybor = int.Parse(Console.ReadLine()); break; } catch (Exception e) { Console.WriteLine(e.Message); } } switch (wybor) { case 1: { Console.Clear(); Console.WriteLine("Lista lekarzy i pielęgniarek: "); Osoby.WyswietlLekarzyPielegniarki(); Console.ReadKey(); break; } case 2: { Console.Clear(); pielegniarka.WyswietlDyzuryPielegniarki(); Console.ReadKey(); break; } case 3: { Login(); Console.ReadKey(); break; } case 0: { System.Environment.Exit(0); break; } default: break; } } }