Ejemplo n.º 1
0
        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();
        }
Ejemplo n.º 2
0
        private void btnAddFoodPlace_Click(object sender, RoutedEventArgs e)
        {
            WpfWebClient.ServiceReferenceEHEC.ServiceClient client = new WpfWebClient.ServiceReferenceEHEC.ServiceClient();

            // create new foodplace from user input

            FoodPlace fp = new FoodPlace();

            // check if any box is empty

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

            if (txtFoodPlaceName.Text == null)
            {
                System.Windows.MessageBox.Show("Please enter a name for the food place", "INFO", MessageBoxButton.OK, MessageBoxImage.Information);
            }

            if (txtFoodPlaceHouseNumber.Text == null)
            {
                System.Windows.MessageBox.Show("Please enter a house number", "INFO", MessageBoxButton.OK, MessageBoxImage.Information);
            }

            if (txtFoodPlaceStreetName.Text == null)
            {
                System.Windows.MessageBox.Show("Please enter a street name", "INFO", MessageBoxButton.OK, MessageBoxImage.Information);
            }

            else
            {
                fp.Streetname   = txtFoodPlaceStreetName.Text;
                fp.Streetnumber = txtFoodPlaceHouseNumber.Text;
                fp.Name         = txtFoodPlaceName.Text;
                fp.Description  = txtFoodPlaceDescription.Text;
                fp.City         = (City)ComboBoxFPCities.SelectedValue;

                client.WriteFoodPlace(fp);

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

            client.Close();
        }