public UpdatePage(string pacjentPesel) { InitializeComponent(); pesel = pacjentPesel; Pacjenci pacjent = (from m in _db.Pacjencis where m.Pesel == pesel select m).Single(); nameTextBox.Text = pacjent.Imie; surnameTextBox.Text = pacjent.Nazwisko; peselTextBox.Text = pacjent.Pesel; addressTextBox.Text = pacjent.Adres; phoneTextBox.Text = pacjent.Telefon; descriptionTextBox.Text = pacjent.Opis; }
private void updateBtn_Click(object sender, RoutedEventArgs e) { Pacjenci pacjent = (from m in _db.Pacjencis where m.Pesel == pesel select m).Single(); pacjent.Imie = nameTextBox.Text; pacjent.Nazwisko = surnameTextBox.Text; pacjent.Pesel = peselTextBox.Text; pacjent.Adres = addressTextBox.Text; pacjent.Telefon = phoneTextBox.Text; pacjent.Opis = descriptionTextBox.Text; //TODO: Pesel nie moze byc zmieniony _db.SaveChanges(); MainWindow.dataGrid.ItemsSource = _db.Pacjencis.ToList(); this.Hide(); }
private void insertBtn_Click(object sender, RoutedEventArgs e) { Pacjenci pacjent = new Pacjenci() { Imie = nameTextBox.Text, Nazwisko = surnameTextBox.Text, Pesel = peselTextBox.Text, Adres = addressTextBox.Text, Telefon = phoneTextBox.Text, Opis = descriptionTextBox.Text }; if (zagranica.IsChecked == true) { pacjent.Pesel = "NA" + System.Guid.NewGuid().ToString().Substring(0, 9); } _db.Pacjencis.Add(pacjent); _db.SaveChanges(); MainWindow.dataGrid.ItemsSource = _db.Pacjencis.ToList(); this.Hide(); }