示例#1
0
        // Добавление записи о посещении
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            DialogResult dr     = new DialogResult();
            VisitAdd     visit2 = new VisitAdd();

            dr = visit2.ShowDialog();

            if (visit2.cancelFlag == true)
            {
                return;
            }
            else
            {
                Visit visit = new Visit();
                visit2.comboBox2.DisplayMember = "FIELD_TO_DISPLAY";
                // visit2.comboBox2.ValueMember = "FIELD_TO_HIDE";
                // string str=visit2.comboBox2.Text.ToString();


                int Id_Patient;
                Id_Patient = int.Parse(visit2.comboBox2.SelectedValue.ToString());

                //visit.Patient.Name = str;
                visit.PatientId   = Id_Patient;
                visit.Date1       = DateTime.Today;
                visit.TypeOfVisit = visit2.comboBox1.SelectedItem.ToString();
                visit.Diagnosis   = visit2.comboBox3.Text;


                db.Visits.Add(visit);
                db.SaveChanges();

                System.Windows.Forms.MessageBox.Show("Запись о посещении добавлена!");
            }
        }
示例#2
0
 // Редактирование.  сохранение изменений
 private void updateButton_Click(object sender, RoutedEventArgs e)
 {
     db.SaveChanges();
 }