Beispiel #1
0
 private void Button_Click_Ok(object sender, RoutedEventArgs e)
 {
     //if (string.IsNullOrEmpty(comboBox1.Text))
     if (ComboBoxDoctor.SelectedItem != null && ComboBoxPatient.SelectedItem != null && cldSample.SelectedDate != null)
     {
         if (AddEditVisitLabel.Text == "Create Visit")
         {
             visitToEdit = new VISIT
             {
                 DOCTOR1     = (DOCTOR)ComboBoxDoctor.SelectedItem,
                 PATIENT1    = (PATIENT)ComboBoxPatient.SelectedItem,
                 DATEOFVISIT = cldSample.SelectedDate.Value
             };
             main_.AddFinished(visitToEdit);
             this.Close();
         }
         else if (AddEditVisitLabel.Text == "Edit Visit")
         {
             visitToEdit.DOCTOR1     = (DOCTOR)ComboBoxDoctor.SelectedItem;
             visitToEdit.PATIENT1    = (PATIENT)ComboBoxPatient.SelectedItem;
             visitToEdit.DATEOFVISIT = cldSample.SelectedDate.Value;
             main_.EditFinished(visitToEdit);
             this.Close();
         }
     }
     else
     {
         MessageBox.Show("Error. Choose all the properties for the visit");
     }
 }
Beispiel #2
0
        private void Button_Click_Ok(object sender, RoutedEventArgs e)
        {
            if (TextBoxFirstName.Text != "" && TextBoxLastName.Text != "" && TextBoxAddress.Text != "" && cldSample.SelectedDate != null)
            {
                string gender = "";
                if (FemaleCheckBox.IsChecked == true)
                {
                    gender = "F";
                }
                else if (MaleCheckBox.IsChecked == true)
                {
                    gender = "M";
                }
                else
                {
                    MessageBox.Show("Select your gender", "Exception", MessageBoxButton.OK, MessageBoxImage.Warning);
                    return;
                }

                if (AddEditPatientLabel.Text == "Create Patient")
                {
                    patientToEdit = new PATIENT
                    {
                        NAME        = TextBoxFirstName.Text,
                        SURNAME     = TextBoxLastName.Text,
                        ADDRESS     = TextBoxAddress.Text,
                        GENDER      = gender,
                        DATEOFBIRTH = cldSample.SelectedDate.Value
                    };
                    main_.AddFinished(patientToEdit);
                    this.Close();
                }
                else if (AddEditPatientLabel.Text == "Edit Patient")
                {
                    patientToEdit.NAME        = TextBoxFirstName.Text;
                    patientToEdit.SURNAME     = TextBoxLastName.Text;
                    patientToEdit.ADDRESS     = TextBoxAddress.Text;
                    patientToEdit.GENDER      = gender;
                    patientToEdit.DATEOFBIRTH = cldSample.DisplayDate;
                    main_.EditFinished(patientToEdit);
                    this.Close();
                }
            }
            else
            {
                MessageBox.Show("Error. Choose all the properties for the patient");
            }
        }