Merge remote-tracking branch 'origin/WebClient_Dev' into server

This commit is contained in:
Andreas Zweili 2018-09-01 16:08:03 +02:00
commit 899b784586
11 changed files with 220 additions and 57 deletions

View File

@ -6,7 +6,7 @@
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="BasicHttpBinding_IService" maxBufferSize="64000000" maxReceivedMessageSize="64000000"/>
<binding name="BasicHttpBinding_IService" maxBufferSize="64000000" maxReceivedMessageSize="64000000" />
</basicHttpBinding>
</bindings>
<client>

View File

@ -427,6 +427,9 @@ namespace WpfWebClient.ServiceReferenceEHEC {
[System.Runtime.Serialization.OptionalFieldAttribute()]
private WpfWebClient.ServiceReferenceEHEC.Person PatientField;
[System.Runtime.Serialization.OptionalFieldAttribute()]
private int PatientAtFoodPlaceIDField;
[System.Runtime.Serialization.OptionalFieldAttribute()]
private int PatientIDField;
@ -482,6 +485,19 @@ namespace WpfWebClient.ServiceReferenceEHEC {
}
}
[System.Runtime.Serialization.DataMemberAttribute()]
public int PatientAtFoodPlaceID {
get {
return this.PatientAtFoodPlaceIDField;
}
set {
if ((this.PatientAtFoodPlaceIDField.Equals(value) != true)) {
this.PatientAtFoodPlaceIDField = value;
this.RaisePropertyChanged("PatientAtFoodPlaceID");
}
}
}
[System.Runtime.Serialization.DataMemberAttribute()]
public int PatientID {
get {

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<ReferenceGroup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ID="8e4f3edd-51fa-4c88-be86-294051ef649d" xmlns="urn:schemas-microsoft-com:xml-wcfservicemap">
<ReferenceGroup xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" ID="ceaefb33-d2bd-40c8-8ef7-cf183b6daf15" xmlns="urn:schemas-microsoft-com:xml-wcfservicemap">
<ClientOptions>
<GenerateAsynchronousMethods>false</GenerateAsynchronousMethods>
<GenerateTaskBasedAsynchronousMethod>true</GenerateTaskBasedAsynchronousMethod>
@ -22,11 +22,11 @@
<MetadataSource Address="http://localhost:8000/Service.svc" Protocol="http" SourceId="1" />
</MetadataSources>
<Metadata>
<MetadataFile FileName="Service.xsd" MetadataType="Schema" ID="198fa5c2-33a6-4c44-b458-b5e50e997a82" SourceId="1" SourceUrl="http://localhost:8000/Service.svc?xsd=xsd0" />
<MetadataFile FileName="Service.wsdl" MetadataType="Wsdl" ID="bc6ac9a0-15c4-45e4-a373-a025bb3eeff5" SourceId="1" SourceUrl="http://localhost:8000/Service.svc?wsdl" />
<MetadataFile FileName="Service.disco" MetadataType="Disco" ID="a8cc90ab-4861-4d1a-b9ab-475e06c8828f" SourceId="1" SourceUrl="http://localhost:8000/Service.svc?disco" />
<MetadataFile FileName="Service1.xsd" MetadataType="Schema" ID="fd5859cf-36b9-49da-a06c-2b2ab351c9e8" SourceId="1" SourceUrl="http://localhost:8000/Service.svc?xsd=xsd1" />
<MetadataFile FileName="Service2.xsd" MetadataType="Schema" ID="53346a32-0a8b-4bc8-862d-2b724486f091" SourceId="1" SourceUrl="http://localhost:8000/Service.svc?xsd=xsd2" />
<MetadataFile FileName="Service.xsd" MetadataType="Schema" ID="55448dd8-d070-4e55-8d5d-da25476d738e" SourceId="1" SourceUrl="http://localhost:8000/Service.svc?xsd=xsd0" />
<MetadataFile FileName="Service.wsdl" MetadataType="Wsdl" ID="35362244-835e-40eb-bb5b-f0d601205450" SourceId="1" SourceUrl="http://localhost:8000/Service.svc?wsdl" />
<MetadataFile FileName="Service.disco" MetadataType="Disco" ID="46420a14-e14a-4898-a880-57c13420af82" SourceId="1" SourceUrl="http://localhost:8000/Service.svc?disco" />
<MetadataFile FileName="Service1.xsd" MetadataType="Schema" ID="559908da-70da-485b-9a95-4385db903b49" SourceId="1" SourceUrl="http://localhost:8000/Service.svc?xsd=xsd1" />
<MetadataFile FileName="Service2.xsd" MetadataType="Schema" ID="8e1f51f2-a819-4661-bf65-82a9ed37338a" SourceId="1" SourceUrl="http://localhost:8000/Service.svc?xsd=xsd2" />
</Metadata>
<Extensions>
<ExtensionFile FileName="configuration91.svcinfo" Name="configuration91.svcinfo" />

View File

@ -48,6 +48,7 @@
<xs:element minOccurs="0" name="FoodPlace" nillable="true" type="tns:FoodPlace" />
<xs:element minOccurs="0" name="FoodPlaceID" type="xs:int" />
<xs:element minOccurs="0" name="Patient" nillable="true" type="tns:Person" />
<xs:element minOccurs="0" name="PatientAtFoodPlaceID" type="xs:int" />
<xs:element minOccurs="0" name="PatientID" type="xs:int" />
<xs:element minOccurs="0" name="VistingDate" type="xs:dateTime" />
</xs:sequence>

View File

@ -55,6 +55,17 @@ namespace WpfWebClient
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();
}
@ -64,29 +75,75 @@ namespace WpfWebClient
Exam exam = new Exam();
exam.Date = dateboxExamDate.SelectedDate.Value;
exam.Doctor = (Doctor)ComboBoxDoctors.SelectedValue;
exam.Patient = (Person)ComboBoxPatients.SelectedValue;
exam.Description = txtDescription.Text;
exam.Strain = (Strain)ComboBoxStrains.SelectedValue;
// check if any box is empty
client.WriteExam(exam);
if (ComboBoxDoctors.SelectedIndex == -1)
{
System.Windows.MessageBox.Show("Please choose a doctor", "INFO", MessageBoxButton.OK, MessageBoxImage.Information);
}
PatientAtFoodPlace patf = new PatientAtFoodPlace();
if (dateboxExamDate.SelectedDate == null)
{
System.Windows.MessageBox.Show("Please enter a date of consultation", "INFO", MessageBoxButton.OK, MessageBoxImage.Information);
}
if (ComboBoxPatients.SelectedIndex == -1)
{
System.Windows.MessageBox.Show("No Patient? Really?", "INFO", MessageBoxButton.OK, MessageBoxImage.Information);
}
if (ComboBoxStrains.SelectedIndex == -1)
{
System.Windows.MessageBox.Show("Why would you fill out an exam when there is no strain?", "INFO", MessageBoxButton.OK, MessageBoxImage.Information);
}
else
{
exam.Date = dateboxExamDate.SelectedDate.Value;
exam.Doctor = (Doctor)ComboBoxDoctors.SelectedValue;
exam.Patient = (Person)ComboBoxPatients.SelectedValue;
exam.Description = txtDescription.Text;
exam.Strain = (Strain)ComboBoxStrains.SelectedValue;
patf.FoodPlace = (FoodPlace)ComboBoxFoodPlace.SelectedValue;
patf.Patient = (Person)ComboBoxPatients.SelectedValue;
patf.PatientID = ComboBoxPatients.SelectedIndex;
patf.VistingDate = dateboxFoodplaceDate.SelectedDate.Value;
client.WriteExam(exam);
}
client.WriteRelation(patf);
PatientAtFoodPlace patf = new PatientAtFoodPlace();
// Show success msgbox
System.Windows.MessageBox.Show("Success", "INFO", MessageBoxButton.OK, MessageBoxImage.Information);
// check if any box is empty
if (ComboBoxFoodPlace.SelectedIndex == -1)
{
System.Windows.MessageBox.Show("Please choose a food place", "INFO", MessageBoxButton.OK, MessageBoxImage.Information);
}
if (dateboxFoodplaceDate.SelectedDate == null)
{
System.Windows.MessageBox.Show("Please enter a date at Foodplace", "INFO", MessageBoxButton.OK, MessageBoxImage.Information);
}
else
{
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();
}
}
}

View File

@ -44,7 +44,30 @@ namespace WpfWebClient
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;
@ -53,8 +76,9 @@ namespace WpfWebClient
client.WriteFoodPlace(fp);
// Show success msgbox
System.Windows.MessageBox.Show("Success", "INFO", MessageBoxButton.OK, MessageBoxImage.Information);
// Show success msgbox
System.Windows.MessageBox.Show("Success", "INFO", MessageBoxButton.OK, MessageBoxImage.Information);
}
client.Close();
}

View File

@ -10,6 +10,7 @@ namespace WpfWebClient.Helper
public static class GenerateTestData
{
private static List<FoodPlace> Foodplaces = new List<FoodPlace>();
private static List<PatientAtFoodPlace> PatientsAtFoodPlaces = new List<PatientAtFoodPlace>();
private static List<Exam> Exams = new List<Exam>();
private static Random random = new Random();
@ -53,10 +54,10 @@ namespace WpfWebClient.Helper
int Description = random.Next(FoodPlaceDescription.Count);
string FoodPlaceDescr = FoodPlaceDescription[Description];
int StreetName = random.Next(FoodPlaceStreetName.Count);
string FoodPlacesm = FoodPlaceStreetName[StreetName];
string FoodPlacesn = FoodPlaceStreetName[StreetName];
string FoodPlaceName = FoodPlaceNameFirstPart[FirstPart] + FoodPlaceNameSecondPart[SecondPart];
string streetname = FoodPlacesm;
string streetname = FoodPlacesn;
string fpdescr = FoodPlaceDescr;
int StreetNumber = random.Next(1, 100);
int CityID = random.Next(1, cities.Count());
@ -77,5 +78,41 @@ namespace WpfWebClient.Helper
return Foodplaces;
}
public static List<PatientAtFoodPlace> CreatePatientAtFoodPlaces()
{
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 patf = new PatientAtFoodPlace();
int randnumFP = random.Next(0, foodPlaces.Count());
FoodPlace foodpl = foodPlaces[randnumFP];
int randnumP = random.Next(0, patients.Count());
Person patient = patients[randnumP];
patf.FoodPlace = foodpl;
patf.Patient = patient;
//patf.PatientID = i;
patf.VistingDate = new DateTime(2005, 12, 20);
PatientsAtFoodPlaces.Add(patf);
i++;
} while (i < 5);
return PatientsAtFoodPlaces;
}
}
}

View File

@ -0,0 +1,27 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace WpfWebClient.Helper
{
class RandomDateTime
{
DateTime start;
Random gen;
int range;
public RandomDateTime()
{
start = new DateTime(1995, 1, 1);
gen = new Random();
range = (DateTime.Today - start).Days;
}
public DateTime Next()
{
return start.AddDays(gen.Next(range)).AddHours(gen.Next(0, 24)).AddMinutes(gen.Next(0, 60)).AddSeconds(gen.Next(0, 60));
}
}
}

View File

@ -10,17 +10,15 @@
<Grid Width="593" Height="565">
<Label Content="Willkommen" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" FontFamily="Tahoma" FontSize="48" Height="61" Width="272"/>
<TextBlock HorizontalAlignment="Left" Margin="10,124,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="431" Width="573" FontSize="20"><Run Text="Haben Sie die Applikation zum ersten Mal gestartet"/><Run Text="?"/><LineBreak/><Run/><LineBreak/><Run Text="1. Erstellen Sie neue Patienten"/><LineBreak/><Run Text="2. "/><Run Text="Generieren "/><Run Text="Sie neue Bakterienstämme"/><Run Text=" "/><LineBreak/><Run/><LineBreak/><Run Text="Enter desired letters"/><Run Text=" per strain"/><Run Text=": "/><Run Text="&#x9;"/><InlineUIContainer>
<TextBlock HorizontalAlignment="Left" Margin="10,80,0,0" TextWrapping="Wrap" VerticalAlignment="Top" Height="475" Width="573" FontSize="20"><Run Text="Haben Sie die Applikation zum ersten Mal gestartet"/><Run Text="?"/><LineBreak/><Run/><LineBreak/><Run Text="1. Erstellen Sie neue Patienten"/><LineBreak/><Run Text="2. "/><Run Text="Generieren "/><Run Text="Sie neue Bakterienstämme"/><Run Text=" "/><LineBreak/><Run/><LineBreak/><Run Text="Enter desired letters"/><Run Text=" per strain"/><Run Text=": "/><Run Text="&#x9;"/><InlineUIContainer>
<TextBox x:Name="txtNumLetters" Height="30" TextWrapping="Wrap" Text="5" Width="120"/>
</InlineUIContainer><LineBreak/><Run Text="Enter desired"/><Run Text=" amount of"/><Run Text=" strains: "/><Run Text="&#x9;"/><InlineUIContainer>
<TextBox x:Name="txtNumStrains" Height="30" TextWrapping="Wrap" Text="100" Width="120"/>
</InlineUIContainer><LineBreak/><LineBreak/><InlineUIContainer>
<Button x:Name="btnRandomStrainGenerator" Content="CREATE RANDOM STRAINS" Width="580" Height="34" Click="btnRandomStrainGenerator_Click"/>
</InlineUIContainer><Run Text="&#x9;"/><LineBreak/><Run Text="3. Erfassen Sie einen neuen Fall"/><Run Text=" oder erstellen Sie Testdaten mit einem "/><Run Text="K"/><Run Text="lick auf diesen Button: "/><InlineUIContainer>
<Button Content="GENERATE EXAMS" Width="283" Click="btnGenerateExams"/>
</InlineUIContainer><LineBreak/><Run Text="4. Erfassen Sie neue FoodPlaces oder erstellen Sie Testdaten mit einem Klick auf diesen Button: "/><InlineUIContainer>
<Button Content="GENERATE FOODPLACES" Width="284" Click="btnGenerateFoodPlaces"/>
</InlineUIContainer><LineBreak/></TextBlock>
</InlineUIContainer><Run Text="&#x9;"/><LineBreak/><Run Text="3. Erfassen Sie einen neuen Fall"/><Run Text=" oder erstellen Sie Testdaten. "/><Run/><LineBreak/><Run Text="4. "/><Run Text="Erfassen Sie neue FoodPlaces oder erstellen Sie Testdaten"/><Run Text="."/><LineBreak/><Run/><LineBreak/><Run/><LineBreak/><InlineUIContainer>
<Button Content="CREATE TESTDATA" Width="582" Click="btnCreateTestdata_Click"/>
</InlineUIContainer><LineBreak/><Run/><LineBreak/><LineBreak/></TextBlock>
</Grid>
</Page>

View File

@ -43,7 +43,7 @@ namespace WpfWebClient
int num_words = int.Parse(txtNumStrains.Text);
// Make an array of the letters we will use.
char[] letters = "AeIoUbRaTdAtIlU".ToCharArray();
char[] letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZ".ToCharArray();
// Make a random number generator.
Random rand = new Random();
@ -71,7 +71,7 @@ namespace WpfWebClient
foreach (var item in generatedStrains)
{
Strain s = new Strain();
s.Name = item;
s.Name = "EHEC-"+ item;
client.WriteStrain(s);
}
}
@ -83,26 +83,13 @@ namespace WpfWebClient
client.Close();
}
private void btnGenerateExams(object sender, RoutedEventArgs e)
private void btnCreateTestdata_Click(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
// create a bunch of foodplaces
var foodplaces = GenerateTestData.CreateFoodPlaces();
foreach (var f in foodplaces)
@ -110,10 +97,25 @@ namespace WpfWebClient
client.WriteFoodPlace(f);
}
// create a bunch of people at foodplaces
var patientsatfps = GenerateTestData.CreatePatientAtFoodPlaces();
foreach (var f in patientsatfps)
{
client.WriteRelation(f);
}
// Show success msgbox
System.Windows.MessageBox.Show("Success", "INFO", MessageBoxButton.OK, MessageBoxImage.Information);
client.Close();
}
}
}

View File

@ -56,6 +56,11 @@
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="Connected Services\ServiceReferenceEHEC\Reference.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Reference.svcmap</DependentUpon>
</Compile>
<Compile Include="ExamForm.xaml.cs">
<DependentUpon>ExamForm.xaml</DependentUpon>
</Compile>
@ -63,6 +68,7 @@
<DependentUpon>FoodplaceForm.xaml</DependentUpon>
</Compile>
<Compile Include="Helper\GenerateTestData.cs" />
<Compile Include="Helper\RandomDateTime.cs" />
<Compile Include="Home.xaml.cs">
<DependentUpon>Home.xaml</DependentUpon>
</Compile>
@ -93,11 +99,6 @@
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Connected Services\ServiceReferenceEHEC\Reference.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Reference.svcmap</DependentUpon>
</Compile>
<Compile Include="MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
@ -185,6 +186,9 @@
<ItemGroup>
<WCFMetadata Include="Connected Services\" />
</ItemGroup>
<ItemGroup>
<Resource Include="Images\eheclogo.png" />
</ItemGroup>
<ItemGroup>
<WCFMetadataStorage Include="Connected Services\ServiceReferenceEHEC\" />
</ItemGroup>
@ -203,8 +207,5 @@
<LastGenOutput>Reference.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<Resource Include="Images\eheclogo.png" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>