private void btnCreateTestdata_Click(object sender, RoutedEventArgs e)
        {
            // create new client connection
            WpfWebClient.ServiceReferenceEHEC.ServiceClient client = new WpfWebClient.ServiceReferenceEHEC.ServiceClient();

            // create a bunch of foodplaces
            var foodplaces = GenerateTestData.CreateFoodPlaces();

            foreach (var f in foodplaces)
            {
                client.WriteFoodPlace(f);
            }

            // create a bunch of people at foodplaces
            var patientsatfps = GenerateTestData.CreatePatientAtFoodPlaces(int.Parse(txtNumberofTestdata.Text));

            foreach (var f in patientsatfps)
            {
                client.WriteRelation(f);
            }



            // Show success msgbox
            System.Windows.MessageBox.Show("Success", "INFO", MessageBoxButton.OK, MessageBoxImage.Information);


            client.Close();
        }
Exemple #2
0
        private void btnAddFoodPlace_Click(object sender, RoutedEventArgs e)
        {
            WpfWebClient.ServiceReferenceEHEC.ServiceClient client = new WpfWebClient.ServiceReferenceEHEC.ServiceClient();

            Exam exam = new Exam();

            // check if any box is empty

            if (ComboBoxDoctors.SelectedIndex == -1)
            {
                System.Windows.MessageBox.Show("Please choose a doctor", "INFO", MessageBoxButton.OK, MessageBoxImage.Information);
            }

            if (dateboxExamDate.SelectedDate == null)
            {
                System.Windows.MessageBox.Show("Please enter a date of consultation", "INFO", MessageBoxButton.OK, MessageBoxImage.Information);
            }

            if (ComboBoxPatients.SelectedIndex == -1)
            {
                System.Windows.MessageBox.Show("No Patient? Really?", "INFO", MessageBoxButton.OK, MessageBoxImage.Information);
            }

            if (ComboBoxStrains.SelectedIndex == -1)
            {
                System.Windows.MessageBox.Show("Why would you fill out an exam when there is no strain?", "INFO", MessageBoxButton.OK, MessageBoxImage.Information);
            }

            else
            {
                exam.Date        = dateboxExamDate.SelectedDate.Value;
                exam.Doctor      = (Doctor)ComboBoxDoctors.SelectedValue;
                exam.Patient     = (Person)ComboBoxPatients.SelectedValue;
                exam.Description = txtDescription.Text;
                exam.Strain      = (Strain)ComboBoxStrains.SelectedValue;



                client.WriteExam(exam);
            }


            PatientAtFoodPlace patf = new PatientAtFoodPlace();

            // check if any box is empty

            if (ComboBoxFoodPlace.SelectedIndex == -1)
            {
                System.Windows.MessageBox.Show("Please choose a food place", "INFO", MessageBoxButton.OK, MessageBoxImage.Information);
            }

            if (dateboxFoodplaceDate.SelectedDate == null)
            {
                System.Windows.MessageBox.Show("Please enter a date at Foodplace", "INFO", MessageBoxButton.OK, MessageBoxImage.Information);
            }


            else
            {
                patf.FoodPlace   = (FoodPlace)ComboBoxFoodPlace.SelectedValue;
                patf.Patient     = (Person)ComboBoxPatients.SelectedValue;
                patf.PatientID   = ComboBoxPatients.SelectedIndex;
                patf.VistingDate = dateboxFoodplaceDate.SelectedDate.Value;


                client.WriteRelation(patf);

                // Show success msgbox
                System.Windows.MessageBox.Show("Success", "INFO", MessageBoxButton.OK, MessageBoxImage.Information);
            }

            client.Close();
        }