public UpdateReception(int ReceptionId) { InitializeComponent(); Id = ReceptionId; Receptions updateReception = (from p in _db.Receptions where p.IdReception == Id select p).Single(); ReceptionDatePicker.SelectedDate = updateReception.DateReception; TypeComboBox.Text = updateReception.TypeReception; DiagnosisTextBox.Text = updateReception.Diagnosis; }
private void Button_Click(object sender, RoutedEventArgs e) { try { Receptions updateReception = (from p in _db.Receptions where p.IdReception == Id select p).Single(); updateReception.DateReception = ReceptionDatePicker.SelectedDate; updateReception.TypeReception = TypeComboBox.Text; updateReception.Diagnosis = DiagnosisTextBox.Text; _db.SaveChanges(); MainWindow.datagrid.ItemsSource = _db.Patient.ToList(); this.Hide(); } catch (System.Exception) { MessageBox.Show("Проверьте корректность сохраняемых данных", "Внимание", MessageBoxButton.OK, MessageBoxImage.Exclamation); throw; } }
private void Button_Click(object sender, RoutedEventArgs e) { //try //{ Receptions newReception = new Receptions() { DateReception = ReceptionDatePicker.SelectedDate, TypeReception = TypeComboBox.Text, Diagnosis = DiagnosisTextBox.Text }; _db.Receptions.Add(newReception); _db.SaveChanges(); Receptions.datagrid.ItemsSource = _db.Receptions.ToList(); this.Hide(); //} //catch (System.Exception) //{ // MessageBox.Show("Проверьте корректность сохраняемых данных", "Внимание", MessageBoxButton.OK, MessageBoxImage.Exclamation); //} }
private void Button_Click_1(object sender, RoutedEventArgs e) { Receptions receptions = new Receptions(); receptions.ShowDialog(); }