diff --git a/WebClient/WpfWebClient/ExamForm.xaml b/WebClient/WpfWebClient/ExamForm.xaml
index 331559f..22e1f61 100644
--- a/WebClient/WpfWebClient/ExamForm.xaml
+++ b/WebClient/WpfWebClient/ExamForm.xaml
@@ -18,16 +18,20 @@
-
-
+
+
-
+
-
-
+
+
-
-
+
+
+
+
+
+
diff --git a/WebClient/WpfWebClient/ExamForm.xaml.cs b/WebClient/WpfWebClient/ExamForm.xaml.cs
index d62a367..99e1486 100644
--- a/WebClient/WpfWebClient/ExamForm.xaml.cs
+++ b/WebClient/WpfWebClient/ExamForm.xaml.cs
@@ -27,27 +27,34 @@ namespace WpfWebClient
WpfWebClient.ServiceReferenceEHEC.ServiceClient client = new WpfWebClient.ServiceReferenceEHEC.ServiceClient();
- //Retrieve all doctors and save them into "doctorlist"
+ // Retrieve all doctors and save them into "doctorlist"
List doctorlist = new List(client.GetDoctors());
- //Display all doctors with name in Combobox
+ // Display all doctors with name in Combobox
ComboBoxDoctors.ItemsSource = doctorlist;
ComboBoxDoctors.DisplayMemberPath = "FirstName";
- //Retrieve all patients and save them into "patientlist"
+ // Retrieve all patients and save them into "patientlist"
List patientlist = new List(client.GetPersons());
- //Display all patients with name in Combobox
+ // Display all patients with name in Combobox
ComboBoxPatients.ItemsSource = patientlist;
ComboBoxPatients.DisplayMemberPath = "FirstName";
- //Retrieve all strains and save them into "strainlist"
+ // Retrieve all strains and save them into "strainlist"
List strainlist = new List(client.GetStrains());
- //Display all strains with name in Combobox
+ // Display all strains with name in Combobox
ComboBoxStrains.ItemsSource = strainlist;
ComboBoxStrains.DisplayMemberPath = "Name";
+ // Retrieve all foodplaces and save them into "fplist"
+ List fplist = new List(client.GetFoodPlaces());
+
+ // Display all foodplaces with name in Combobox
+ ComboBoxFoodPlace.ItemsSource = fplist;
+ ComboBoxFoodPlace.DisplayMemberPath = "Name";
+
client.Close();
}
@@ -60,11 +67,25 @@ namespace WpfWebClient
exam.Date = dateboxExamDate.SelectedDate.Value;
exam.Doctor = (Doctor)ComboBoxDoctors.SelectedValue;
exam.Patient = (Person)ComboBoxPatients.SelectedValue;
- exam.Description = txtDescription.ToString();
+ exam.Description = txtDescription.Text;
exam.Strain = (Strain)ComboBoxStrains.SelectedValue;
client.WriteExam(exam);
+ PatientAtFoodPlace patf = new PatientAtFoodPlace();
+
+
+ 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();
}
}
diff --git a/WebClient/WpfWebClient/FoodplaceForm.xaml b/WebClient/WpfWebClient/FoodplaceForm.xaml
index 8019a3d..bb93366 100644
--- a/WebClient/WpfWebClient/FoodplaceForm.xaml
+++ b/WebClient/WpfWebClient/FoodplaceForm.xaml
@@ -18,14 +18,16 @@
-
+
-
+
+
+
diff --git a/WebClient/WpfWebClient/FoodplaceForm.xaml.cs b/WebClient/WpfWebClient/FoodplaceForm.xaml.cs
index aa53e3f..6697c79 100644
--- a/WebClient/WpfWebClient/FoodplaceForm.xaml.cs
+++ b/WebClient/WpfWebClient/FoodplaceForm.xaml.cs
@@ -24,22 +24,37 @@ namespace WpfWebClient
public FoodplaceForm()
{
InitializeComponent();
+
+ WpfWebClient.ServiceReferenceEHEC.ServiceClient client = new WpfWebClient.ServiceReferenceEHEC.ServiceClient();
+
+ // Retrieve all cities and save them into "citylist"
+ List citylist = new List(client.GetCities());
+
+ // Display all cities with name in Combobox
+ ComboBoxFPCities.ItemsSource = citylist;
+ ComboBoxFPCities.DisplayMemberPath = "Name";
+
}
private void btnAddFoodPlace_Click(object sender, RoutedEventArgs e)
{
WpfWebClient.ServiceReferenceEHEC.ServiceClient client = new WpfWebClient.ServiceReferenceEHEC.ServiceClient();
- client.Open();
+ // create new foodplace from user input
- FoodPlace fp = new FoodPlace();
+ FoodPlace fp = new FoodPlace();
- fp.Name = txtFoodPlaceName.Text;
- fp.Streetname = txtFoodPlaceStreetName.Text;
- fp.Streetnumber = txtFoodPlaceHouseNumber.Text;
- fp.Description = txtFoodPlaceDescription.Text;
- client.WriteFoodPlace(fp);
+ 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();
}
diff --git a/WebClient/WpfWebClient/Helper/GenerateTestData.cs b/WebClient/WpfWebClient/Helper/GenerateTestData.cs
new file mode 100644
index 0000000..01175be
--- /dev/null
+++ b/WebClient/WpfWebClient/Helper/GenerateTestData.cs
@@ -0,0 +1,81 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WpfWebClient.ServiceReferenceEHEC;
+
+namespace WpfWebClient.Helper
+{
+ public static class GenerateTestData
+ {
+ private static List Foodplaces = new List();
+ private static List Exams = new List();
+ private static Random random = new Random();
+
+ private static List FoodPlaceNameFirstPart = new List(new string[]
+ {
+ "The ", "Tony's ", "Best ", "Paulas ", "Golden ", "Platinum ", "Super "
+ });
+
+ private static List FoodPlaceNameSecondPart = new List(new string[]
+ {
+ "Pizzaplace", "Meatclub", "Veganitorium", "Applepie", "Burger", "Esspalast", "Döner", "Bananorama"
+ });
+
+ private static List FoodPlaceDescription = new List(new string[]
+ {
+ "Einfach unglaublich", "Die grössten der ganzen Stadt", "Ziemlich durchschnittlich", "Einmal alles ohne scharf bitte",
+ "Das ist eine B-Schreibung", "Etwas teuer aber trotzdem einen Besuch Wert", "Grösster Müll EVER", "Do ane chumi NIE MEH!"
+ });
+
+ private static List FoodPlaceStreetName = new List(new string[]
+{
+ "Hansestrasse", "Dorfweg", "Rumpelstrasse", "Hauptstrasse",
+ "Blumengasse", "Pimpelpfad", "Im Grund", "Schotterweg"
+});
+
+ public static List CreateFoodPlaces()
+ {
+
+ WpfWebClient.ServiceReferenceEHEC.ServiceClient client = new WpfWebClient.ServiceReferenceEHEC.ServiceClient();
+ List cities = new List(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 FoodPlacesm = FoodPlaceStreetName[StreetName];
+
+ string FoodPlaceName = FoodPlaceNameFirstPart[FirstPart] + FoodPlaceNameSecondPart[SecondPart];
+ string streetname = FoodPlacesm;
+ 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++;
+ }
+
+ return Foodplaces;
+ }
+ }
+}
diff --git a/WebClient/WpfWebClient/Home.xaml b/WebClient/WpfWebClient/Home.xaml
index 1c7ea30..94e9aef 100644
--- a/WebClient/WpfWebClient/Home.xaml
+++ b/WebClient/WpfWebClient/Home.xaml
@@ -10,7 +10,17 @@
-
+
+
+
+
+
+
+
+
+
+
+
diff --git a/WebClient/WpfWebClient/Home.xaml.cs b/WebClient/WpfWebClient/Home.xaml.cs
index e652767..9798e20 100644
--- a/WebClient/WpfWebClient/Home.xaml.cs
+++ b/WebClient/WpfWebClient/Home.xaml.cs
@@ -13,6 +13,7 @@ using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using WpfWebClient.ServiceReferenceEHEC;
+using WpfWebClient.Helper;
namespace WpfWebClient
{
@@ -24,7 +25,95 @@ namespace WpfWebClient
public Home()
{
InitializeComponent();
+
}
+ private void btnRandomStrainGenerator_Click(object sender, RoutedEventArgs e)
+ {
+ // create new client connection
+ WpfWebClient.ServiceReferenceEHEC.ServiceClient client = new WpfWebClient.ServiceReferenceEHEC.ServiceClient();
+
+ // msgbox to confirm action
+ if (MessageBox.Show("This could take a while, are you sure?", "More strains?",
+ MessageBoxButton.YesNo, MessageBoxImage.Question) == MessageBoxResult.Yes)
+ {
+
+ // Get the number of words and letters per word.
+ int num_letters = int.Parse(txtNumLetters.Text);
+ int num_words = int.Parse(txtNumStrains.Text);
+
+ // Make an array of the letters we will use.
+ char[] letters = "AeIoUbRaTdAtIlU".ToCharArray();
+
+ // Make a random number generator.
+ Random rand = new Random();
+
+ // Make the words.
+ for (int i = 1; i <= num_words; i++)
+ {
+ // Make a word.
+ string word = "";
+ for (int j = 1; j <= num_letters; j++)
+ {
+ // Pick a random number between 0 and 25
+ // to select a letter from the letters array.
+ int letter_num = rand.Next(2, letters.Length - 1);
+
+ // Append the letter.
+ word += letters[letter_num];
+ }
+
+ // Write the strains into a list
+ List generatedStrains = new List();
+
+ generatedStrains.Add(word);
+
+ foreach (var item in generatedStrains)
+ {
+ Strain s = new Strain();
+ s.Name = item;
+ client.WriteStrain(s);
+ }
+ }
+ }
+
+ // Show success msgbox
+ System.Windows.MessageBox.Show("Success", "INFO", MessageBoxButton.OK, MessageBoxImage.Information);
+
+ client.Close();
+ }
+
+ private void btnGenerateExams(object sender, RoutedEventArgs e)
+ {
+ // create new client connection
+ WpfWebClient.ServiceReferenceEHEC.ServiceClient client = new WpfWebClient.ServiceReferenceEHEC.ServiceClient();
+
+ //to be continued
+
+
+ // Show success msgbox
+ System.Windows.MessageBox.Show("Success", "INFO", MessageBoxButton.OK, MessageBoxImage.Information);
+
+ client.Close();
+ }
+
+ private void btnGenerateFoodPlaces(object sender, RoutedEventArgs e)
+ {
+ // create new client connection
+ WpfWebClient.ServiceReferenceEHEC.ServiceClient client = new WpfWebClient.ServiceReferenceEHEC.ServiceClient();
+
+ //to be continued
+ var foodplaces = GenerateTestData.CreateFoodPlaces();
+
+ foreach (var f in foodplaces)
+ {
+ client.WriteFoodPlace(f);
+ }
+
+ // Show success msgbox
+ System.Windows.MessageBox.Show("Success", "INFO", MessageBoxButton.OK, MessageBoxImage.Information);
+
+ client.Close();
+ }
}
}
diff --git a/WebClient/WpfWebClient/PatientForm.xaml.cs b/WebClient/WpfWebClient/PatientForm.xaml.cs
index fe9d6c0..f34819f 100644
--- a/WebClient/WpfWebClient/PatientForm.xaml.cs
+++ b/WebClient/WpfWebClient/PatientForm.xaml.cs
@@ -27,31 +27,31 @@ namespace WpfWebClient
WpfWebClient.ServiceReferenceEHEC.ServiceClient client = new WpfWebClient.ServiceReferenceEHEC.ServiceClient();
- //Retrieve all salutations and save them into "salutationlist"
+ // Retrieve all salutations and save them into "salutationlist"
List salutationlist = new List(client.GetSalutations());
- //Display all salutations with name in Combobox
+ // Display all salutations with name in Combobox
ComboBoxSalutations.ItemsSource = salutationlist;
ComboBoxSalutations.DisplayMemberPath = "Name";
- //Retrieve all genders and save them into "genderlist"
+ // Retrieve all genders and save them into "genderlist"
List genderlist = new List(client.GetGenders());
- //Display all genders with name in Combobox
+ // Display all genders with name in Combobox
ComboBoxGenders.ItemsSource = genderlist;
ComboBoxGenders.DisplayMemberPath = "Name";
- //Retrieve all cities and save them into "citylist"
+ // Retrieve all cities and save them into "citylist"
List citylist = new List(client.GetCities());
- //Display all cities with name in Combobox
+ // Display all cities with name in Combobox
ComboBoxCities.ItemsSource = citylist;
ComboBoxCities.DisplayMemberPath = "Name";
- //Retrieve all salutations and save them into "countrylist"
+ // Retrieve all salutations and save them into "countrylist"
List countrylist = new List(client.GetCountries());
- //Display all countries with name in Combobox
+ // Display all countries with name in Combobox
ComboBoxCountries.ItemsSource = countrylist;
ComboBoxCountries.DisplayMemberPath = "Name";
@@ -68,11 +68,11 @@ namespace WpfWebClient
Person p = new Person();
- //if (ComboBoxSalutations.SelectedValue != null && ComboBoxSalutations.SelectedValue is Salutation)
- //if (ComboBoxGenders.SelectedValue != null && ComboBoxGenders.SelectedValue is Gender)
- //if (ComboBoxCities.SelectedValue != null && ComboBoxCities.SelectedValue is City)
+ // if (ComboBoxSalutations.SelectedValue != null && ComboBoxSalutations.SelectedValue is Salutation)
+ // if (ComboBoxGenders.SelectedValue != null && ComboBoxGenders.SelectedValue is Gender)
+ // if (ComboBoxCities.SelectedValue != null && ComboBoxCities.SelectedValue is City)
- //Pick all selected fields and send object to client
+ // Pick all selected fields and send object to client
p.Salutation = (Salutation)ComboBoxSalutations.SelectedValue;
p.Gender = (Gender)ComboBoxGenders.SelectedValue;
p.LastName = txtLastName.Text;
@@ -82,7 +82,10 @@ namespace WpfWebClient
p.City = (City)ComboBoxCities.SelectedValue;
client.WritePatient(p);
-
+
+ // Show success msgbox
+ System.Windows.MessageBox.Show("Success", "INFO", MessageBoxButton.OK, MessageBoxImage.Information);
+
client.Close();
}
diff --git a/WebClient/WpfWebClient/ViewDoctors.xaml.cs b/WebClient/WpfWebClient/ViewDoctors.xaml.cs
index c11ca2e..0799e1c 100644
--- a/WebClient/WpfWebClient/ViewDoctors.xaml.cs
+++ b/WebClient/WpfWebClient/ViewDoctors.xaml.cs
@@ -28,7 +28,7 @@ namespace WpfWebClient
WpfWebClient.ServiceReferenceEHEC.ServiceClient client = new WpfWebClient.ServiceReferenceEHEC.ServiceClient();
- //call method GetDoctors and save them to doctorlist
+ // call method GetDoctors and save them to doctorlist
List doctorlist = new List(client.GetDoctors());
diff --git a/WebClient/WpfWebClient/ViewStrains.xaml.cs b/WebClient/WpfWebClient/ViewStrains.xaml.cs
index a33ed5b..b35aadc 100644
--- a/WebClient/WpfWebClient/ViewStrains.xaml.cs
+++ b/WebClient/WpfWebClient/ViewStrains.xaml.cs
@@ -27,11 +27,12 @@ namespace WpfWebClient
WpfWebClient.ServiceReferenceEHEC.ServiceClient client = new WpfWebClient.ServiceReferenceEHEC.ServiceClient();
- //call method GetStrains and save them to strainlist
+ // call method GetStrains and save them to strainlist
List strainlist = new List(client.GetStrains());
DataGridViewStrains.ItemsSource = strainlist;
+
client.Close();
}
diff --git a/WebClient/WpfWebClient/WpfWebClient.csproj b/WebClient/WpfWebClient/WpfWebClient.csproj
index a7dede1..79a4a58 100644
--- a/WebClient/WpfWebClient/WpfWebClient.csproj
+++ b/WebClient/WpfWebClient/WpfWebClient.csproj
@@ -62,6 +62,7 @@
FoodplaceForm.xaml
+ Home.xaml