diff --git a/Client/Client/Client.csproj b/Client/Client/Client.csproj index ad64320..c5b8496 100644 --- a/Client/Client/Client.csproj +++ b/Client/Client/Client.csproj @@ -74,6 +74,10 @@ MSBuild:Compile Designer + + + + MSBuild:Compile Designer @@ -87,7 +91,7 @@ True Reference.svcmap - + MainWindow.xaml @@ -95,7 +99,7 @@ - + Code @@ -173,7 +177,6 @@ - \ No newline at end of file diff --git a/Client/Client/MainWindow.xaml b/Client/Client/MainWindow.xaml index 4e74734..a0be05d 100644 --- a/Client/Client/MainWindow.xaml +++ b/Client/Client/MainWindow.xaml @@ -158,63 +158,105 @@ - + - + - + + + + + + + + + + + + + + + - + - + - + + + + + + + + + + + + + + + - + - + - + + + + + + + + + + + + + + + - + - + - + - + - + diff --git a/Client/Client/MainWindow.xaml.cs b/Client/Client/MainWindow.xaml.cs index d542aee..a1a79ec 100644 --- a/Client/Client/MainWindow.xaml.cs +++ b/Client/Client/MainWindow.xaml.cs @@ -27,7 +27,7 @@ namespace Client InitializeComponent(); // loading of dropdowns - + } private void ButtonClose_Click(object sender, RoutedEventArgs e) @@ -52,31 +52,13 @@ namespace Client TextboxPatientRegion.Text, TextboxPatientGeburtstag.Text ); - newDoctor.CreateDoctor(); - newPatient.CreatePatient(); + Result newResult = new Result(TextboxBakterienstamm.Text); + //Origin newOrigin = new Origin(); - - String Bakterienstamm = TextboxBakterienstamm.Text; - String Nahrung1Restaurant = TextboxNahrung1Restaurant.Text; - String Nahrung2Restaurant = TextboxNahrung2Restaurant.Text; - String Nahrung3Restaurant = TextboxNahrung3Restaurant.Text; - String Nahrung4Restaurant = TextboxNahrung4Restaurant.Text; - String Nahrung5Restaurant = TextboxNahrung5Restaurant.Text; - - - - //try { - // Global.GlobalInstance.Service.WritePatient(p); - // //servize.WritePatient(p); - //} catch (Exception) { - // if (p.PatientId == 0) { - // LabelRueckmeldungsfeld.Content = "fehler id = 0, beim schreiben von Patient!"; - // } else { - // LabelRueckmeldungsfeld.Content = "fehler id != 0, beim schreiben von Patient!"; - // } - //} - //LabelRueckmeldungsfeld.Content = "erfolgreich Patient gespeichert"; - //TextboxPatientName.Clear(); + Exam newExam = new Exam(newDoctor.CreateDoctor(), + newPatient.CreatePatient(), + newResult.CreateResult() + ); } @@ -86,30 +68,48 @@ namespace Client } } - //private void TextChanged(object sender, KeyboardFocusChangedEventArgs e) - //{ - // if (((TextBox)sender).Text.Length == 0) - // ((TextBox)sender).Text = ((TextBox)sender).Text.ToString(); - //} - //private void TextInputs(object sender, EventArgs e) - //{ - // if ((((TextBox)sender).Text) == (((TextBox)sender).Text)) - // ((TextBox)sender).Text = string.Empty; - // ((TextBox)sender).SelectionStart = 1; - //} - //private void TextboxArztName_LostFocus(object sender, KeyboardFocusChangedEventArgs e) => TextChanged(sender, e); - //private void TextboxArztName_MouseDown(object sender, MouseButtonEventArgs e) - //{ - // TextInputs(sender, e); - // //TextboxArztName.Text = string.Empty; - //} - //private void TextboxArztName_PreviewTextInput(object sender, TextCompositionEventArgs e) - //{ - // TextInputs(sender, e); - //} + // aufbewahren für die integration von Id's in die FK Tabellenspalten: + //try { + // Global.GlobalInstance.Service.WritePatient(p); + // //servize.WritePatient(p); + //} catch (Exception) { + // if (p.PatientId == 0) { + // LabelRueckmeldungsfeld.Content = "fehler id = 0, beim schreiben von Patient!"; + // } else { + // LabelRueckmeldungsfeld.Content = "fehler id != 0, beim schreiben von Patient!"; + // } + //} + //LabelRueckmeldungsfeld.Content = "erfolgreich Patient gespeichert"; + //TextboxPatientName.Clear(); + + + //private void TextChanged(object sender, KeyboardFocusChangedEventArgs e) + //{ + // if (((TextBox)sender).Text.Length == 0) + // ((TextBox)sender).Text = ((TextBox)sender).Text.ToString(); + //} + + //private void TextInputs(object sender, EventArgs e) + //{ + // if ((((TextBox)sender).Text) == (((TextBox)sender).Text)) + // ((TextBox)sender).Text = string.Empty; + // ((TextBox)sender).SelectionStart = 1; + //} + + //private void TextboxArztName_LostFocus(object sender, KeyboardFocusChangedEventArgs e) => TextChanged(sender, e); + + //private void TextboxArztName_MouseDown(object sender, MouseButtonEventArgs e) + //{ + // TextInputs(sender, e); + // //TextboxArztName.Text = string.Empty; + //} + //private void TextboxArztName_PreviewTextInput(object sender, TextCompositionEventArgs e) + //{ + // TextInputs(sender, e); + //} + - } diff --git a/Client/Client/Doctor.cs b/Client/Client/ServiceClasses/Doctor.cs similarity index 93% rename from Client/Client/Doctor.cs rename to Client/Client/ServiceClasses/Doctor.cs index 17118ef..5a38b8e 100644 --- a/Client/Client/Doctor.cs +++ b/Client/Client/ServiceClasses/Doctor.cs @@ -16,11 +16,6 @@ namespace Client public string Region { get; set; } public string DocType { get; set; } - public Doctor() - { - - } - /// /// this is my doctor construcor /// @@ -34,7 +29,8 @@ namespace Client string plz, string ort, string region, - string doctype ) + string doctype + ) { FirstName = firstName; LastName = lastName; @@ -48,7 +44,7 @@ namespace Client /// /// This writes the doctor back to the service into the db /// - public void CreateDoctor() + public int CreateDoctor() { // write doctor to wcf interface EHEC_Service.Doctor mydoctor = new EHEC_Service.Doctor @@ -59,6 +55,7 @@ namespace Client DoctorOrigin = DocType }; Global.GlobalInstance.Service.WriteDoctor(mydoctor); + return mydoctor.DoctorId; } } diff --git a/Client/Client/ServiceClasses/Exam.cs b/Client/Client/ServiceClasses/Exam.cs new file mode 100644 index 0000000..6741002 --- /dev/null +++ b/Client/Client/ServiceClasses/Exam.cs @@ -0,0 +1,35 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Client +{ + public class Exam + { + public int DocID { get; set; } + public int PatientID { get; set; } + public int ResultID { get; set; } + public Exam(int docId, + int patientId, + int resultId + ) + { + DocID = docId; + PatientID = patientId; + ResultID = resultId; + } + public int CreateExam() + { + EHEC_Service.Exam myExam = new EHEC_Service.Exam + { + DoctorId = DocID, + PatientId = PatientID, + Result_ResultId = ResultID + }; + Global.GlobalInstance.Service.WriteExam(myExam); + return myExam.ExamId; + } + } +} diff --git a/Client/Client/ServiceClasses/Origin.cs b/Client/Client/ServiceClasses/Origin.cs new file mode 100644 index 0000000..98c69a5 --- /dev/null +++ b/Client/Client/ServiceClasses/Origin.cs @@ -0,0 +1,43 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Client +{ + public class Origin + { + public string RestaurantName { get; set; } + public string Foodtype { get; set; } + public string Street { get; set; } + public int Plz { get; set; } + public string City { get; set; } + public Origin(string restName, + string foodtype, + string street, + int plz, + string city + ) + { + RestaurantName = restName; + Foodtype = foodtype; + Street = street; + Plz = plz; + City = city; + } + + public int CreateOrigin() + { + EHEC_Service.Origin myorigin = new EHEC_Service.Origin + { + Name = RestaurantName, + Food = Foodtype, + Street = Street, + City = City, + }; + Global.GlobalInstance.Service.WriteOrigin(myorigin); + return myorigin.OriginId; + } + } +} diff --git a/Client/Client/ServiceClasses/Origin_Exam.cs b/Client/Client/ServiceClasses/Origin_Exam.cs new file mode 100644 index 0000000..a618241 --- /dev/null +++ b/Client/Client/ServiceClasses/Origin_Exam.cs @@ -0,0 +1,31 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Client.ServiceClasses +{ + public class Origin_Exam + { + public int OriginOriginId; + public int ExamExamId; + public Origin_Exam(int originOriginId, + int examExamId + ) + { + OriginOriginId = originOriginId; + ExamExamId = examExamId; + } + public int CreateOrigin_Exam() + { + EHEC_Service.Origin_Exam myorigin_Exam = new EHEC_Service.Origin_Exam + { + OriginOriginId = OriginOriginId, + ExamExamId = ExamExamId + }; + //Global.GlobalInstance.Service.W + return myorigin_Exam.Origin_ExamId; + } + } +} diff --git a/Client/Client/Patient.cs b/Client/Client/ServiceClasses/Patient.cs similarity index 93% rename from Client/Client/Patient.cs rename to Client/Client/ServiceClasses/Patient.cs index dc2c104..a24f9cb 100644 --- a/Client/Client/Patient.cs +++ b/Client/Client/ServiceClasses/Patient.cs @@ -6,7 +6,7 @@ using System.Threading.Tasks; namespace Client { - class Patient + public class Patient { public string FirstName { get; set; } public string LastName { get; set; } @@ -34,7 +34,7 @@ namespace Client BirthDate = birthDate; } - public void CreatePatient() + public int CreatePatient() { EHEC_Service.Patient mypatient = new EHEC_Service.Patient { @@ -46,6 +46,7 @@ namespace Client BirthDate = Convert.ToDateTime(BirthDate) }; Global.GlobalInstance.Service.WritePatient(mypatient); + return mypatient.PatientId; } } } diff --git a/Client/Client/ServiceClasses/Result.cs b/Client/Client/ServiceClasses/Result.cs new file mode 100644 index 0000000..225ff24 --- /dev/null +++ b/Client/Client/ServiceClasses/Result.cs @@ -0,0 +1,27 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Client +{ + public class Result + { + public string ResultName { get; set; } + + public Result(string resultName) + { + ResultName = resultName; + } + public int CreateResult() + { + EHEC_Service.Result myResult = new EHEC_Service.Result + { + Name = ResultName + }; + Global.GlobalInstance.Service.WriteResult(myResult); + return myResult.ResultId; + } + } +}