Beispiel #1
0
        public ExamForm()
        {
            InitializeComponent();
            WpfWebClient.ServiceReferenceEHEC.ServiceClient client = new WpfWebClient.ServiceReferenceEHEC.ServiceClient();


            // Retrieve all doctors and save them into "doctorlist"
            List <WpfWebClient.ServiceReferenceEHEC.Doctor> doctorlist = new List <ServiceReferenceEHEC.Doctor>(client.GetDoctors());

            // Display all doctors with name in Combobox
            ComboBoxDoctors.ItemsSource       = doctorlist;
            ComboBoxDoctors.DisplayMemberPath = "FirstName";

            // Retrieve all patients and save them into "patientlist"
            List <WpfWebClient.ServiceReferenceEHEC.Person> patientlist = new List <ServiceReferenceEHEC.Person>(client.GetPersons());

            // Display all patients with name in Combobox
            ComboBoxPatients.ItemsSource       = patientlist;
            ComboBoxPatients.DisplayMemberPath = "FirstName";

            // Retrieve all strains and save them into "strainlist"
            List <WpfWebClient.ServiceReferenceEHEC.Strain> strainlist = new List <ServiceReferenceEHEC.Strain>(client.GetStrains());

            // Display all strains with name in Combobox
            ComboBoxStrains.ItemsSource       = strainlist;
            ComboBoxStrains.DisplayMemberPath = "Name";

            // Retrieve all foodplaces and save them into "fplist"
            List <WpfWebClient.ServiceReferenceEHEC.FoodPlace> fplist = new List <ServiceReferenceEHEC.FoodPlace>(client.GetFoodPlaces());

            // Display all foodplaces with name in Combobox
            ComboBoxFoodPlace.ItemsSource       = fplist;
            ComboBoxFoodPlace.DisplayMemberPath = "Name";

            // check for proper data
            if (strainlist.Count == 0)
            {
                System.Windows.MessageBox.Show("Please create at least one Strain", "INFO", MessageBoxButton.OK, MessageBoxImage.Information);
            }

            if (fplist.Count == 0)
            {
                System.Windows.MessageBox.Show("Please create at least one Food Place", "INFO", MessageBoxButton.OK, MessageBoxImage.Information);
            }

            client.Close();
        }
        public static List <PatientAtFoodPlace> CreatePatientAtFoodPlaces(int userinput)
        {
            WpfWebClient.ServiceReferenceEHEC.ServiceClient    client     = new WpfWebClient.ServiceReferenceEHEC.ServiceClient();
            List <WpfWebClient.ServiceReferenceEHEC.FoodPlace> foodPlaces = new List <ServiceReferenceEHEC.FoodPlace>(client.GetFoodPlaces());
            List <WpfWebClient.ServiceReferenceEHEC.Person>    patients   = new List <ServiceReferenceEHEC.Person>(client.GetPersons());



            int i = 0;

            do
            {
                PatientAtFoodPlace patfgen = new PatientAtFoodPlace();

                int       randnumFP = random.Next(0, foodPlaces.Count());
                FoodPlace foodpl    = foodPlaces[randnumFP];

                int    randnumP = random.Next(0, patients.Count());
                Person patient  = patients[randnumP];

                patfgen.FoodPlace   = foodpl;
                patfgen.Patient     = patient;
                patfgen.VistingDate = new DateTime(2005, 12, 20);

                PatientsAtFoodPlaces.Add(patfgen);

                i++;
            } while (i < userinput);

            client.Close();

            return(PatientsAtFoodPlaces);
        }