Exemplo n.º 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 ViewDoctors()

        {
            InitializeComponent();

            WpfWebClient.ServiceReferenceEHEC.ServiceClient client = new WpfWebClient.ServiceReferenceEHEC.ServiceClient();

            // call method GetDoctors and save them to doctorlist

            List <WpfWebClient.ServiceReferenceEHEC.Doctor> doctorlist = new List <ServiceReferenceEHEC.Doctor>(client.GetDoctors());

            DataGridViewDoctors.ItemsSource = doctorlist;

            client.Close();
        }