Пример #1
0
        public FoodplaceForm()
        {
            InitializeComponent();

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

            // Retrieve all cities and save them into "citylist"
            List <WpfWebClient.ServiceReferenceEHEC.City> citylist = new List <ServiceReferenceEHEC.City>(client.GetCities());

            // Display all cities with name in Combobox
            ComboBoxFPCities.ItemsSource       = citylist;
            ComboBoxFPCities.DisplayMemberPath = "Name";

            client.Close();
        }
        public static List <FoodPlace> CreateFoodPlaces()
        {
            WpfWebClient.ServiceReferenceEHEC.ServiceClient client = new WpfWebClient.ServiceReferenceEHEC.ServiceClient();
            List <WpfWebClient.ServiceReferenceEHEC.City>   cities = new List <ServiceReferenceEHEC.City>(client.GetCities());

            int FirstPartLength  = FoodPlaceNameFirstPart.Count();
            int SecondPartLength = FoodPlaceNameSecondPart.Count();
            int Counter          = FirstPartLength * SecondPartLength;

            int i = 1;

            while (i < 20)
            {
                int    FirstPart      = random.Next(1, FirstPartLength);
                int    SecondPart     = random.Next(1, SecondPartLength);
                int    Description    = random.Next(FoodPlaceDescription.Count);
                string FoodPlaceDescr = FoodPlaceDescription[Description];
                int    StreetName     = random.Next(FoodPlaceStreetName.Count);
                string FoodPlacesn    = FoodPlaceStreetName[StreetName];

                string    FoodPlaceName = FoodPlaceNameFirstPart[FirstPart] + FoodPlaceNameSecondPart[SecondPart];
                string    streetname    = FoodPlacesn;
                string    fpdescr       = FoodPlaceDescr;
                int       StreetNumber  = random.Next(1, 100);
                int       CityID        = random.Next(1, cities.Count());
                City      city          = cities[CityID];
                FoodPlace NewFoodPlace  = new FoodPlace();

                NewFoodPlace.Name         = FoodPlaceName;
                NewFoodPlace.Streetname   = streetname;
                NewFoodPlace.Streetnumber = StreetNumber.ToString();
                NewFoodPlace.Description  = fpdescr;
                NewFoodPlace.City         = city;



                Foodplaces.Add(NewFoodPlace);
                i++;
            }

            client.Close();

            return(Foodplaces);
        }
        public PatientForm()
        {
            InitializeComponent();
            WpfWebClient.ServiceReferenceEHEC.ServiceClient client = new WpfWebClient.ServiceReferenceEHEC.ServiceClient();


            // Retrieve all salutations and save them into "salutationlist"
            List <WpfWebClient.ServiceReferenceEHEC.Salutation> salutationlist = new List <ServiceReferenceEHEC.Salutation>(client.GetSalutations());

            // Display all salutations with name in Combobox
            ComboBoxSalutations.ItemsSource       = salutationlist;
            ComboBoxSalutations.DisplayMemberPath = "Name";

            // Retrieve all genders and save them into "genderlist"
            List <WpfWebClient.ServiceReferenceEHEC.Gender> genderlist = new List <ServiceReferenceEHEC.Gender>(client.GetGenders());

            // Display all genders with name in Combobox
            ComboBoxGenders.ItemsSource       = genderlist;
            ComboBoxGenders.DisplayMemberPath = "Name";

            // Retrieve all cities and save them into "citylist"
            List <WpfWebClient.ServiceReferenceEHEC.City> citylist = new List <ServiceReferenceEHEC.City>(client.GetCities());

            // Display all cities with name in Combobox
            ComboBoxCities.ItemsSource       = citylist;
            ComboBoxCities.DisplayMemberPath = "Name";

            // Retrieve all salutations and save them into "countrylist"
            List <WpfWebClient.ServiceReferenceEHEC.Country> countrylist = new List <ServiceReferenceEHEC.Country>(client.GetCountries());

            // Display all countries with name in Combobox
            ComboBoxCountries.ItemsSource       = countrylist;
            ComboBoxCountries.DisplayMemberPath = "Name";


            client.Close();
        }