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

This commit is contained in:
Andreas Zweili 2018-08-06 21:55:15 +02:00
commit b974d3b185
13 changed files with 308 additions and 60 deletions

View File

@ -11,7 +11,6 @@ namespace Server.DB
{
using (Context ctx = new Context())
{
ctx.Configuration.ProxyCreationEnabled = false;
return ctx.Persons
.Include("Gender")
@ -27,14 +26,19 @@ namespace Server.DB
using (Context ctx = new Context())
{
var city = ctx.Cities.FirstOrDefault(c => c.CityID == person.City.CityID);
var country = ctx.Countries.FirstOrDefault(c => c.CountryID == person.City.Country.CountryID);
var salutation = ctx.Salutations.FirstOrDefault(s => s.SalutationID == person.Salutation.SalutationID);
var gender = ctx.Genders.FirstOrDefault(g => g.GenderID == person.Gender.GenderID);
var salutation = ctx.Salutations.FirstOrDefault(c => c.SalutationID == person.Salutation.SalutationID);
var gender = ctx.Genders.FirstOrDefault(c => c.GenderID == person.Gender.GenderID);
var country = ctx.Countries.FirstOrDefault(c => c.CountryID == city.Country.CountryID);
ctx.Cities.Attach(city);
ctx.Countries.Attach(country);
ctx.Genders.Attach(gender);
ctx.Salutations.Attach(salutation);
ctx.Genders.Attach(gender);
ctx.Countries.Attach(country);
person.City = city;
person.Salutation = salutation;
person.Gender = gender;
ctx.Persons.Add(person);
ctx.SaveChanges();
}

View File

@ -407,22 +407,6 @@ namespace WpfWebClient.ServiceReferenceEHEC {
[System.Runtime.Serialization.DataContractAttribute(Name="Doctor", Namespace="http://schemas.datacontract.org/2004/07/Server.Models")]
[System.SerializableAttribute()]
public partial class Doctor : WpfWebClient.ServiceReferenceEHEC.Person {
[System.Runtime.Serialization.OptionalFieldAttribute()]
private int DoctorIDField;
[System.Runtime.Serialization.DataMemberAttribute()]
public int DoctorID {
get {
return this.DoctorIDField;
}
set {
if ((this.DoctorIDField.Equals(value) != true)) {
this.DoctorIDField = value;
this.RaisePropertyChanged("DoctorID");
}
}
}
}
[System.Diagnostics.DebuggerStepThroughAttribute()]
@ -956,6 +940,18 @@ namespace WpfWebClient.ServiceReferenceEHEC {
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IService/WriteFoodPlace", ReplyAction="http://tempuri.org/IService/WriteFoodPlaceResponse")]
System.Threading.Tasks.Task WriteFoodPlaceAsync(WpfWebClient.ServiceReferenceEHEC.FoodPlace foodplace);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IService/WriteStrain", ReplyAction="http://tempuri.org/IService/WriteStrainResponse")]
void WriteStrain(WpfWebClient.ServiceReferenceEHEC.Strain strain);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IService/WriteStrain", ReplyAction="http://tempuri.org/IService/WriteStrainResponse")]
System.Threading.Tasks.Task WriteStrainAsync(WpfWebClient.ServiceReferenceEHEC.Strain strain);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IService/WriteRelation", ReplyAction="http://tempuri.org/IService/WriteRelationResponse")]
void WriteRelation(WpfWebClient.ServiceReferenceEHEC.PatientAtFoodPlace relation);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IService/WriteRelation", ReplyAction="http://tempuri.org/IService/WriteRelationResponse")]
System.Threading.Tasks.Task WriteRelationAsync(WpfWebClient.ServiceReferenceEHEC.PatientAtFoodPlace relation);
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IService/GetGenders", ReplyAction="http://tempuri.org/IService/GetGendersResponse")]
WpfWebClient.ServiceReferenceEHEC.Gender[] GetGenders();
@ -1003,6 +999,12 @@ namespace WpfWebClient.ServiceReferenceEHEC {
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IService/GetRelations", ReplyAction="http://tempuri.org/IService/GetRelationsResponse")]
System.Threading.Tasks.Task<WpfWebClient.ServiceReferenceEHEC.PatientAtFoodPlace[]> GetRelationsAsync();
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IService/GetPersons", ReplyAction="http://tempuri.org/IService/GetPersonsResponse")]
WpfWebClient.ServiceReferenceEHEC.Person[] GetPersons();
[System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IService/GetPersons", ReplyAction="http://tempuri.org/IService/GetPersonsResponse")]
System.Threading.Tasks.Task<WpfWebClient.ServiceReferenceEHEC.Person[]> GetPersonsAsync();
}
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
@ -1072,6 +1074,22 @@ namespace WpfWebClient.ServiceReferenceEHEC {
return base.Channel.WriteFoodPlaceAsync(foodplace);
}
public void WriteStrain(WpfWebClient.ServiceReferenceEHEC.Strain strain) {
base.Channel.WriteStrain(strain);
}
public System.Threading.Tasks.Task WriteStrainAsync(WpfWebClient.ServiceReferenceEHEC.Strain strain) {
return base.Channel.WriteStrainAsync(strain);
}
public void WriteRelation(WpfWebClient.ServiceReferenceEHEC.PatientAtFoodPlace relation) {
base.Channel.WriteRelation(relation);
}
public System.Threading.Tasks.Task WriteRelationAsync(WpfWebClient.ServiceReferenceEHEC.PatientAtFoodPlace relation) {
return base.Channel.WriteRelationAsync(relation);
}
public WpfWebClient.ServiceReferenceEHEC.Gender[] GetGenders() {
return base.Channel.GetGenders();
}
@ -1135,5 +1153,13 @@ namespace WpfWebClient.ServiceReferenceEHEC {
public System.Threading.Tasks.Task<WpfWebClient.ServiceReferenceEHEC.PatientAtFoodPlace[]> GetRelationsAsync() {
return base.Channel.GetRelationsAsync();
}
public WpfWebClient.ServiceReferenceEHEC.Person[] GetPersons() {
return base.Channel.GetPersons();
}
public System.Threading.Tasks.Task<WpfWebClient.ServiceReferenceEHEC.Person[]> GetPersonsAsync() {
return base.Channel.GetPersonsAsync();
}
}
}

View File

@ -37,6 +37,18 @@
<wsdl:message name="IService_WriteFoodPlace_OutputMessage">
<wsdl:part name="parameters" element="tns:WriteFoodPlaceResponse" />
</wsdl:message>
<wsdl:message name="IService_WriteStrain_InputMessage">
<wsdl:part name="parameters" element="tns:WriteStrain" />
</wsdl:message>
<wsdl:message name="IService_WriteStrain_OutputMessage">
<wsdl:part name="parameters" element="tns:WriteStrainResponse" />
</wsdl:message>
<wsdl:message name="IService_WriteRelation_InputMessage">
<wsdl:part name="parameters" element="tns:WriteRelation" />
</wsdl:message>
<wsdl:message name="IService_WriteRelation_OutputMessage">
<wsdl:part name="parameters" element="tns:WriteRelationResponse" />
</wsdl:message>
<wsdl:message name="IService_GetGenders_InputMessage">
<wsdl:part name="parameters" element="tns:GetGenders" />
</wsdl:message>
@ -85,6 +97,12 @@
<wsdl:message name="IService_GetRelations_OutputMessage">
<wsdl:part name="parameters" element="tns:GetRelationsResponse" />
</wsdl:message>
<wsdl:message name="IService_GetPersons_InputMessage">
<wsdl:part name="parameters" element="tns:GetPersons" />
</wsdl:message>
<wsdl:message name="IService_GetPersons_OutputMessage">
<wsdl:part name="parameters" element="tns:GetPersonsResponse" />
</wsdl:message>
<wsdl:portType name="IService">
<wsdl:operation name="WritePatient">
<wsdl:input wsaw:Action="http://tempuri.org/IService/WritePatient" message="tns:IService_WritePatient_InputMessage" />
@ -106,6 +124,14 @@
<wsdl:input wsaw:Action="http://tempuri.org/IService/WriteFoodPlace" message="tns:IService_WriteFoodPlace_InputMessage" />
<wsdl:output wsaw:Action="http://tempuri.org/IService/WriteFoodPlaceResponse" message="tns:IService_WriteFoodPlace_OutputMessage" />
</wsdl:operation>
<wsdl:operation name="WriteStrain">
<wsdl:input wsaw:Action="http://tempuri.org/IService/WriteStrain" message="tns:IService_WriteStrain_InputMessage" />
<wsdl:output wsaw:Action="http://tempuri.org/IService/WriteStrainResponse" message="tns:IService_WriteStrain_OutputMessage" />
</wsdl:operation>
<wsdl:operation name="WriteRelation">
<wsdl:input wsaw:Action="http://tempuri.org/IService/WriteRelation" message="tns:IService_WriteRelation_InputMessage" />
<wsdl:output wsaw:Action="http://tempuri.org/IService/WriteRelationResponse" message="tns:IService_WriteRelation_OutputMessage" />
</wsdl:operation>
<wsdl:operation name="GetGenders">
<wsdl:input wsaw:Action="http://tempuri.org/IService/GetGenders" message="tns:IService_GetGenders_InputMessage" />
<wsdl:output wsaw:Action="http://tempuri.org/IService/GetGendersResponse" message="tns:IService_GetGenders_OutputMessage" />
@ -138,6 +164,10 @@
<wsdl:input wsaw:Action="http://tempuri.org/IService/GetRelations" message="tns:IService_GetRelations_InputMessage" />
<wsdl:output wsaw:Action="http://tempuri.org/IService/GetRelationsResponse" message="tns:IService_GetRelations_OutputMessage" />
</wsdl:operation>
<wsdl:operation name="GetPersons">
<wsdl:input wsaw:Action="http://tempuri.org/IService/GetPersons" message="tns:IService_GetPersons_InputMessage" />
<wsdl:output wsaw:Action="http://tempuri.org/IService/GetPersonsResponse" message="tns:IService_GetPersons_OutputMessage" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="BasicHttpBinding_IService" type="tns:IService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
@ -186,6 +216,24 @@
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="WriteStrain">
<soap:operation soapAction="http://tempuri.org/IService/WriteStrain" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="WriteRelation">
<soap:operation soapAction="http://tempuri.org/IService/WriteRelation" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetGenders">
<soap:operation soapAction="http://tempuri.org/IService/GetGenders" style="document" />
<wsdl:input>
@ -258,6 +306,15 @@
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="GetPersons">
<soap:operation soapAction="http://tempuri.org/IService/GetPersons" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Service">
<wsdl:port name="BasicHttpBinding_IService" binding="tns:BasicHttpBinding_IService">

View File

@ -61,6 +61,30 @@
<xs:sequence />
</xs:complexType>
</xs:element>
<xs:element name="WriteStrain">
<xs:complexType>
<xs:sequence>
<xs:element xmlns:q6="http://schemas.datacontract.org/2004/07/Server.Models" minOccurs="0" name="strain" nillable="true" type="q6:Strain" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="WriteStrainResponse">
<xs:complexType>
<xs:sequence />
</xs:complexType>
</xs:element>
<xs:element name="WriteRelation">
<xs:complexType>
<xs:sequence>
<xs:element xmlns:q7="http://schemas.datacontract.org/2004/07/Server.Models" minOccurs="0" name="relation" nillable="true" type="q7:PatientAtFoodPlace" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="WriteRelationResponse">
<xs:complexType>
<xs:sequence />
</xs:complexType>
</xs:element>
<xs:element name="GetGenders">
<xs:complexType>
<xs:sequence />
@ -69,7 +93,7 @@
<xs:element name="GetGendersResponse">
<xs:complexType>
<xs:sequence>
<xs:element xmlns:q6="http://schemas.datacontract.org/2004/07/Server.Models" minOccurs="0" name="GetGendersResult" nillable="true" type="q6:ArrayOfGender" />
<xs:element xmlns:q8="http://schemas.datacontract.org/2004/07/Server.Models" minOccurs="0" name="GetGendersResult" nillable="true" type="q8:ArrayOfGender" />
</xs:sequence>
</xs:complexType>
</xs:element>
@ -81,7 +105,7 @@
<xs:element name="GetSalutationsResponse">
<xs:complexType>
<xs:sequence>
<xs:element xmlns:q7="http://schemas.datacontract.org/2004/07/Server.Models" minOccurs="0" name="GetSalutationsResult" nillable="true" type="q7:ArrayOfSalutation" />
<xs:element xmlns:q9="http://schemas.datacontract.org/2004/07/Server.Models" minOccurs="0" name="GetSalutationsResult" nillable="true" type="q9:ArrayOfSalutation" />
</xs:sequence>
</xs:complexType>
</xs:element>
@ -93,7 +117,7 @@
<xs:element name="GetStrainsResponse">
<xs:complexType>
<xs:sequence>
<xs:element xmlns:q8="http://schemas.datacontract.org/2004/07/Server.Models" minOccurs="0" name="GetStrainsResult" nillable="true" type="q8:ArrayOfStrain" />
<xs:element xmlns:q10="http://schemas.datacontract.org/2004/07/Server.Models" minOccurs="0" name="GetStrainsResult" nillable="true" type="q10:ArrayOfStrain" />
</xs:sequence>
</xs:complexType>
</xs:element>
@ -105,7 +129,7 @@
<xs:element name="GetDoctorsResponse">
<xs:complexType>
<xs:sequence>
<xs:element xmlns:q9="http://schemas.datacontract.org/2004/07/Server.Models" minOccurs="0" name="GetDoctorsResult" nillable="true" type="q9:ArrayOfDoctor" />
<xs:element xmlns:q11="http://schemas.datacontract.org/2004/07/Server.Models" minOccurs="0" name="GetDoctorsResult" nillable="true" type="q11:ArrayOfDoctor" />
</xs:sequence>
</xs:complexType>
</xs:element>
@ -117,7 +141,7 @@
<xs:element name="GetCitiesResponse">
<xs:complexType>
<xs:sequence>
<xs:element xmlns:q10="http://schemas.datacontract.org/2004/07/Server.Models" minOccurs="0" name="GetCitiesResult" nillable="true" type="q10:ArrayOfCity" />
<xs:element xmlns:q12="http://schemas.datacontract.org/2004/07/Server.Models" minOccurs="0" name="GetCitiesResult" nillable="true" type="q12:ArrayOfCity" />
</xs:sequence>
</xs:complexType>
</xs:element>
@ -129,7 +153,7 @@
<xs:element name="GetCountriesResponse">
<xs:complexType>
<xs:sequence>
<xs:element xmlns:q11="http://schemas.datacontract.org/2004/07/Server.Models" minOccurs="0" name="GetCountriesResult" nillable="true" type="q11:ArrayOfCountry" />
<xs:element xmlns:q13="http://schemas.datacontract.org/2004/07/Server.Models" minOccurs="0" name="GetCountriesResult" nillable="true" type="q13:ArrayOfCountry" />
</xs:sequence>
</xs:complexType>
</xs:element>
@ -141,7 +165,7 @@
<xs:element name="GetFoodPlacesResponse">
<xs:complexType>
<xs:sequence>
<xs:element xmlns:q12="http://schemas.datacontract.org/2004/07/Server.Models" minOccurs="0" name="GetFoodPlacesResult" nillable="true" type="q12:ArrayOfFoodPlace" />
<xs:element xmlns:q14="http://schemas.datacontract.org/2004/07/Server.Models" minOccurs="0" name="GetFoodPlacesResult" nillable="true" type="q14:ArrayOfFoodPlace" />
</xs:sequence>
</xs:complexType>
</xs:element>
@ -153,7 +177,19 @@
<xs:element name="GetRelationsResponse">
<xs:complexType>
<xs:sequence>
<xs:element xmlns:q13="http://schemas.datacontract.org/2004/07/Server.Models" minOccurs="0" name="GetRelationsResult" nillable="true" type="q13:ArrayOfPatientAtFoodPlace" />
<xs:element xmlns:q15="http://schemas.datacontract.org/2004/07/Server.Models" minOccurs="0" name="GetRelationsResult" nillable="true" type="q15:ArrayOfPatientAtFoodPlace" />
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="GetPersons">
<xs:complexType>
<xs:sequence />
</xs:complexType>
</xs:element>
<xs:element name="GetPersonsResponse">
<xs:complexType>
<xs:sequence>
<xs:element xmlns:q16="http://schemas.datacontract.org/2004/07/Server.Models" minOccurs="0" name="GetPersonsResult" nillable="true" type="q16:ArrayOfPerson" />
</xs:sequence>
</xs:complexType>
</xs:element>

View File

@ -72,6 +72,14 @@
</xs:sequence>
</xs:complexType>
<xs:element name="Salutation" nillable="true" type="tns:Salutation" />
<xs:complexType name="Doctor">
<xs:complexContent mixed="false">
<xs:extension base="tns:Person">
<xs:sequence />
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="Doctor" nillable="true" type="tns:Doctor" />
<xs:complexType name="Exam">
<xs:sequence>
<xs:element minOccurs="0" name="Date" type="xs:dateTime" />
@ -83,16 +91,6 @@
</xs:sequence>
</xs:complexType>
<xs:element name="Exam" nillable="true" type="tns:Exam" />
<xs:complexType name="Doctor">
<xs:complexContent mixed="false">
<xs:extension base="tns:Person">
<xs:sequence>
<xs:element minOccurs="0" name="DoctorID" type="xs:int" />
</xs:sequence>
</xs:extension>
</xs:complexContent>
</xs:complexType>
<xs:element name="Doctor" nillable="true" type="tns:Doctor" />
<xs:complexType name="Strain">
<xs:sequence>
<xs:element minOccurs="0" name="Name" nillable="true" type="xs:string" />
@ -142,4 +140,10 @@
</xs:sequence>
</xs:complexType>
<xs:element name="ArrayOfFoodPlace" nillable="true" type="tns:ArrayOfFoodPlace" />
<xs:complexType name="ArrayOfPerson">
<xs:sequence>
<xs:element minOccurs="0" maxOccurs="unbounded" name="Person" nillable="true" type="tns:Person" />
</xs:sequence>
</xs:complexType>
<xs:element name="ArrayOfPerson" nillable="true" type="tns:ArrayOfPerson" />
</xs:schema>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
This file is automatically generated by Visual Studio .Net. It is
used to store generic object data source configuration information.
Renaming the file extension or editing the content of this file may
cause the file to be unrecognizable by the program.
-->
<GenericObjectDataSource DisplayName="Person" Version="1.0" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
<TypeInfo>WpfWebClient.ServiceReferenceEHEC.Person, Connected Services.ServiceReferenceEHEC.Reference.cs.dll, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null</TypeInfo>
</GenericObjectDataSource>

View File

@ -18,5 +18,16 @@
<ColumnDefinition Width="455*"/>
</Grid.ColumnDefinitions>
<Label Content="Add new exam" HorizontalAlignment="Left" VerticalAlignment="Top" Height="45" Width="433" FontFamily="Tahoma" FontSize="24" Margin="0.4,-3,0,0" Grid.Column="1" Grid.RowSpan="2"/>
<Label Content="Date" Margin="0,115.4,454.8,0" Grid.Row="1" VerticalAlignment="Top" Height="34" FontFamily="Tahoma" FontSize="24" Grid.ColumnSpan="2"/>
<Label Content="Description" Margin="0,163.4,454.8,0" Grid.Row="1" VerticalAlignment="Top" Height="44" FontFamily="Tahoma" FontSize="24" Grid.ColumnSpan="2"/>
<Label Content="Patient" Margin="0,23.4,454.8,0" Grid.Row="1" VerticalAlignment="Top" Height="34" FontSize="24" FontFamily="Tahoma" Grid.ColumnSpan="2"/>
<TextBox x:Name="txtDescription" HorizontalAlignment="Left" Height="34" Margin="137,163.4,0,0" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Top" Width="433" Grid.ColumnSpan="2"/>
<ComboBox x:Name="ComboBoxPatients" HorizontalAlignment="Left" Margin="0.4,23.4,0,0" Grid.Row="1" VerticalAlignment="Top" Width="433" Height="34" Grid.Column="1"/>
<ComboBox x:Name="ComboBoxStrains" HorizontalAlignment="Left" Margin="0.4,212.4,0,0" Grid.Row="1" VerticalAlignment="Top" Width="433" Grid.Column="1" Height="34"/>
<Label Content="Strain" Margin="0,212.4,454.8,0" Grid.Row="1" VerticalAlignment="Top" Height="41" FontFamily="Tahoma" FontSize="24" Grid.ColumnSpan="2"/>
<Label Content="Doctor" Margin="0,68.4,454.8,0" Grid.Row="1" VerticalAlignment="Top" Height="34" FontSize="24" FontFamily="Tahoma" Grid.ColumnSpan="2"/>
<ComboBox x:Name="ComboBoxDoctors" HorizontalAlignment="Left" Margin="0.4,68.4,0,0" Grid.Row="1" VerticalAlignment="Top" Width="433" Height="34" Grid.Column="1"/>
<DatePicker x:Name="dateboxExamDate" HorizontalAlignment="Left" Margin="137,115.4,0,0" Grid.Row="1" VerticalAlignment="Top" Grid.ColumnSpan="2" Width="433" Height="34"/>
<Button x:Name="btnAddExam" Content="ADD EXAM" HorizontalAlignment="Left" Margin="136,371.4,0,0" Grid.Row="1" VerticalAlignment="Top" Width="433" Click="btnAddFoodPlace_Click" Grid.ColumnSpan="2" Height="44" FontSize="20"/>
</Grid>
</Page>

View File

@ -24,6 +24,48 @@ namespace WpfWebClient
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";
client.Close();
}
private void btnAddFoodPlace_Click(object sender, RoutedEventArgs e)
{
WpfWebClient.ServiceReferenceEHEC.ServiceClient client = new WpfWebClient.ServiceReferenceEHEC.ServiceClient();
Exam exam = new Exam();
exam.Date = dateboxExamDate.SelectedDate.Value;
exam.Doctor = (Doctor)ComboBoxDoctors.SelectedValue;
exam.Patient = (Person)ComboBoxPatients.SelectedValue;
exam.Description = txtDescription.ToString();
exam.Strain = (Strain)ComboBoxStrains.SelectedValue;
client.WriteExam(exam);
client.Close();
}
}
}

View File

@ -18,5 +18,14 @@
<ColumnDefinition Width="455*"/>
</Grid.ColumnDefinitions>
<Label Content="Add new foodplace" HorizontalAlignment="Left" VerticalAlignment="Top" Height="45" Width="433" FontFamily="Tahoma" FontSize="24" Margin="0.4,-3,0,0" Grid.Column="1" Grid.RowSpan="2"/>
<Label Content="Description" Margin="1,173.4,453.8,0" Grid.Row="1" VerticalAlignment="Top" Height="41" FontFamily="Tahoma" FontSize="24" Grid.ColumnSpan="2"/>
<Label Content="Name" Margin="0,30.4,454.8,0" Grid.Row="1" VerticalAlignment="Top" Height="34" FontFamily="Tahoma" FontSize="24" Grid.ColumnSpan="2"/>
<Label Content="Street" Margin="0,79.4,454.8,0" Grid.Row="1" VerticalAlignment="Top" Height="34" FontFamily="Tahoma" FontSize="24" Grid.ColumnSpan="2"/>
<TextBox x:Name="txtFoodPlaceDescription" HorizontalAlignment="Left" Height="34" Margin="137,172.4,0,0" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Top" Width="433" Grid.ColumnSpan="2"/>
<TextBox x:Name="txtFoodPlaceName" HorizontalAlignment="Left" Height="34" Margin="136,30.4,0,0" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Top" Width="433" Grid.ColumnSpan="2"/>
<TextBox x:Name="txtFoodPlaceStreetName" Height="34" Margin="136,79.4,23.8,0" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Top" Grid.ColumnSpan="2"/>
<Label Content="House Nr." Margin="0,125.4,454.8,0" Grid.Row="1" VerticalAlignment="Top" Height="34" FontFamily="Tahoma" FontSize="24" Grid.ColumnSpan="2"/>
<TextBox x:Name="txtFoodPlaceHouseNumber" Height="34" Margin="137,125.4,23.8,0" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Top" Grid.ColumnSpan="2"/>
<Button x:Name="btnAddFoodPlace" Content="ADD FOODPLACE" HorizontalAlignment="Left" Margin="136,371.4,0,0" Grid.Row="1" VerticalAlignment="Top" Width="433" Click="btnAddFoodPlace_Click" Grid.ColumnSpan="2" Height="44" FontSize="20"/>
</Grid>
</Page>

View File

@ -25,5 +25,23 @@ namespace WpfWebClient
{
InitializeComponent();
}
private void btnAddFoodPlace_Click(object sender, RoutedEventArgs e)
{
WpfWebClient.ServiceReferenceEHEC.ServiceClient client = new WpfWebClient.ServiceReferenceEHEC.ServiceClient();
client.Open();
FoodPlace fp = new FoodPlace();
fp.Name = txtFoodPlaceName.Text;
fp.Streetname = txtFoodPlaceStreetName.Text;
fp.Streetnumber = txtFoodPlaceHouseNumber.Text;
fp.Description = txtFoodPlaceDescription.Text;
client.WriteFoodPlace(fp);
client.Close();
}
}
}

View File

@ -18,19 +18,22 @@
<ColumnDefinition Width="455*"/>
</Grid.ColumnDefinitions>
<Label Content="Add new patient" HorizontalAlignment="Left" VerticalAlignment="Top" Height="45" Width="433" FontFamily="Tahoma" FontSize="24" Margin="0.4,-3,0,0" Grid.Column="1" Grid.RowSpan="2"/>
<Label Content="Surname" Margin="0,66.4,454.8,0" Grid.Row="1" VerticalAlignment="Top" Height="34" FontFamily="Tahoma" FontSize="24" Grid.ColumnSpan="2"/>
<Label Content="Name" Margin="0,114.4,454.8,0" Grid.Row="1" VerticalAlignment="Top" Height="34" FontFamily="Tahoma" FontSize="24" Grid.ColumnSpan="2"/>
<Label Content="Street" Margin="0,163.4,454.8,0" Grid.Row="1" VerticalAlignment="Top" Height="34" FontFamily="Tahoma" FontSize="24" Grid.ColumnSpan="2"/>
<Label Content="City" Margin="0,210.4,454.8,0" Grid.Row="1" VerticalAlignment="Top" Height="39" FontFamily="Tahoma" FontSize="24" Grid.ColumnSpan="2"/>
<Label Content="Doctors" Margin="0,305.4,454.8,0" Grid.Row="1" VerticalAlignment="Top" Height="34" FontFamily="Tahoma" FontSize="24" RenderTransformOrigin="0.533,1.244" Grid.ColumnSpan="2"/>
<Label Content="Surname" Margin="0,115.4,454.8,0" Grid.Row="1" VerticalAlignment="Top" Height="34" FontFamily="Tahoma" FontSize="24" Grid.ColumnSpan="2"/>
<Label Content="Name" Margin="0,163.4,454.8,0" Grid.Row="1" VerticalAlignment="Top" Height="34" FontFamily="Tahoma" FontSize="24" Grid.ColumnSpan="2"/>
<Label Content="Street" Margin="0,212.4,454.8,0" Grid.Row="1" VerticalAlignment="Top" Height="34" FontFamily="Tahoma" FontSize="24" Grid.ColumnSpan="2"/>
<Label Content="City" Margin="0,301.4,454.8,0" Grid.Row="1" VerticalAlignment="Top" Height="39" FontFamily="Tahoma" FontSize="24" Grid.ColumnSpan="2"/>
<Label Content="Salutation" Margin="0,23.4,454.8,0" Grid.Row="1" VerticalAlignment="Top" Height="34" FontSize="24" FontFamily="Tahoma" Grid.ColumnSpan="2"/>
<TextBox x:Name="txtSurname" Grid.Column="1" HorizontalAlignment="Left" Height="34" Margin="0.4,66.4,0,0" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Top" Width="433"/>
<TextBox x:Name="txtFirstName" Grid.Column="1" HorizontalAlignment="Left" Height="34" Margin="0.4,114.4,0,0" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Top" Width="433"/>
<TextBox x:Name="txtStreet" Grid.Column="1" Height="34" Margin="0.4,163.4,21.8,0" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Top"/>
<TextBox x:Name="txtLastName" HorizontalAlignment="Left" Height="34" Margin="137,115.4,0,0" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Top" Width="433" Grid.ColumnSpan="2"/>
<TextBox x:Name="txtFirstName" HorizontalAlignment="Left" Height="34" Margin="137,163.4,0,0" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Top" Width="433" Grid.ColumnSpan="2"/>
<TextBox x:Name="txtStreetName" Height="34" Margin="137,212.4,22.8,0" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Top" Grid.ColumnSpan="2"/>
<ComboBox x:Name="ComboBoxSalutations" HorizontalAlignment="Left" Margin="0.4,23.4,0,0" Grid.Row="1" VerticalAlignment="Top" Width="433" Height="34" Grid.Column="1"/>
<ComboBox x:Name="ComboBoxCities" HorizontalAlignment="Left" Margin="0.4,215.4,0,0" Grid.Row="1" VerticalAlignment="Top" Width="433" Grid.Column="1" Height="34"/>
<ComboBox x:Name="ComboBoxCountries" HorizontalAlignment="Left" Margin="0.4,259.4,0,0" Grid.Row="1" VerticalAlignment="Top" Width="433" Grid.Column="1" Height="34"/>
<ComboBox x:Name="ComboBoxDoctors" HorizontalAlignment="Left" Margin="0.4,305.4,0,0" Grid.Row="1" VerticalAlignment="Top" Width="433" Grid.Column="1" Height="34"/>
<Label Content="Country" Margin="0,259.4,454.8,0" Grid.Row="1" VerticalAlignment="Top" Height="41" FontFamily="Tahoma" FontSize="24" Grid.ColumnSpan="2"/>
<ComboBox x:Name="ComboBoxCities" HorizontalAlignment="Left" Margin="0.4,306.4,0,0" Grid.Row="1" VerticalAlignment="Top" Width="433" Grid.Column="1" Height="34"/>
<ComboBox x:Name="ComboBoxCountries" HorizontalAlignment="Left" Margin="0.4,350.4,0,0" Grid.Row="1" VerticalAlignment="Top" Width="433" Grid.Column="1" Height="34"/>
<Label Content="Country" Margin="0,350.4,454.8,0" Grid.Row="1" VerticalAlignment="Top" Height="41" FontFamily="Tahoma" FontSize="24" Grid.ColumnSpan="2"/>
<Label Content="Gender" Margin="0,68.4,454.8,0" Grid.Row="1" VerticalAlignment="Top" Height="34" FontSize="24" FontFamily="Tahoma" Grid.ColumnSpan="2"/>
<ComboBox x:Name="ComboBoxGenders" HorizontalAlignment="Left" Margin="0.4,68.4,0,0" Grid.Row="1" VerticalAlignment="Top" Width="433" Height="34" Grid.Column="1"/>
<Button x:Name="btnAddPatient" Content="ADD PATIENT" HorizontalAlignment="Left" Margin="137,454.4,0,0" Grid.Row="1" VerticalAlignment="Top" Width="433" Grid.ColumnSpan="2" Height="34" FontSize="20" Click="btnAddPatient_Click"/>
<Label Content="House Nr." Margin="0,258.4,454.8,0" Grid.Row="1" VerticalAlignment="Top" Height="34" FontFamily="Tahoma" FontSize="24" Grid.ColumnSpan="2"/>
<TextBox x:Name="txtHouseNumber" Height="34" Margin="137,258.4,22.8,0" Grid.Row="1" TextWrapping="Wrap" VerticalAlignment="Top" Grid.ColumnSpan="2"/>
</Grid>
</Page>

View File

@ -34,6 +34,13 @@ namespace WpfWebClient
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());
@ -48,18 +55,36 @@ namespace WpfWebClient
ComboBoxCountries.ItemsSource = countrylist;
ComboBoxCountries.DisplayMemberPath = "Name";
//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";
client.Close();
}
private void btnAddPatient_Click(object sender, RoutedEventArgs e)
{
WpfWebClient.ServiceReferenceEHEC.ServiceClient client = new WpfWebClient.ServiceReferenceEHEC.ServiceClient();
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)
//Pick all selected fields and send object to client
p.Salutation = (Salutation)ComboBoxSalutations.SelectedValue;
p.Gender = (Gender)ComboBoxGenders.SelectedValue;
p.LastName = txtLastName.Text;
p.FirstName = txtFirstName.Text;
p.StreetName = txtStreetName.Text;
p.StreetNumber = txtHouseNumber.Text;
p.City = (City)ComboBoxCities.SelectedValue;
client.WritePatient(p);
client.Close();
}
}
}

View File

@ -164,6 +164,9 @@
<None Include="Connected Services\ServiceReferenceEHEC\WpfWebClient.ServiceReferenceEHEC.PatientAtFoodPlace.datasource">
<DependentUpon>Reference.svcmap</DependentUpon>
</None>
<None Include="Connected Services\ServiceReferenceEHEC\WpfWebClient.ServiceReferenceEHEC.Person.datasource">
<DependentUpon>Reference.svcmap</DependentUpon>
</None>
<None Include="Connected Services\ServiceReferenceEHEC\WpfWebClient.ServiceReferenceEHEC.Salutation.datasource">
<DependentUpon>Reference.svcmap</DependentUpon>
</None>