removing some mapping error with the server
This commit is contained in:
parent
c46a53682b
commit
99b84a9add
|
@ -46,42 +46,42 @@ namespace EHEC_Server.DataBuilder
|
|||
|
||||
|
||||
|
||||
public static List<Patient> CreatePatients()
|
||||
{
|
||||
// public static List<Patient> CreatePatients()
|
||||
// {
|
||||
//int Counter = Patients.Count();
|
||||
//for (int i = 0; i < Counter; i++)
|
||||
foreach (var c in FirstNames)
|
||||
{
|
||||
for (int j = 0; j < 10; j++)
|
||||
{
|
||||
Patient patient = new Patient(
|
||||
FirstNames[Rnd.Next(1, FirstNames.Count())],
|
||||
LastNames[Rnd.Next(1, LastNames.Count())],
|
||||
BirthDate[Rnd.Next(1, BirthDate.Count())],
|
||||
Street[Rnd.Next(1, Street.Count())],
|
||||
City[Rnd.Next(1, City.Count())]);
|
||||
Patients.Add(patient);
|
||||
}
|
||||
}
|
||||
return Patients;
|
||||
// foreach (var c in FirstNames)
|
||||
// {
|
||||
// for (int j = 0; j < 10; j++)
|
||||
// {
|
||||
// Patient patient = new Patient(
|
||||
// FirstNames[Rnd.Next(1, FirstNames.Count())],
|
||||
// LastNames[Rnd.Next(1, LastNames.Count())],
|
||||
// BirthDate[Rnd.Next(1, BirthDate.Count())],
|
||||
// Street[Rnd.Next(1, Street.Count())],
|
||||
// City[Rnd.Next(1, City.Count())]);
|
||||
// Patients.Add(patient);
|
||||
// }
|
||||
// }
|
||||
// return Patients;
|
||||
}
|
||||
|
||||
public static List<Doctor> CreateDoctors()
|
||||
{
|
||||
// public static List<Doctor> CreateDoctors()
|
||||
//{
|
||||
//int Counter = Patients.Count();
|
||||
//for (int i = 0; i < Counter; i++)
|
||||
foreach (var c in FirstNames)
|
||||
{
|
||||
for (int j = 0; j < 10; j++)
|
||||
{
|
||||
Doctor doctor = new Doctor(
|
||||
FirstNames[Rnd.Next(1, FirstNames.Count())],
|
||||
LastNames[Rnd.Next(1, LastNames.Count())],
|
||||
DoctorOrigins[Rnd.Next(1, DoctorOrigins.Count())]);
|
||||
Doctors.Add(doctor);
|
||||
}
|
||||
}
|
||||
return Doctors;
|
||||
}
|
||||
}
|
||||
// foreach (var c in FirstNames)
|
||||
//{
|
||||
// for (int j = 0; j < 10; j++)
|
||||
//{
|
||||
// Doctor doctor = new Doctor(
|
||||
// FirstNames[Rnd.Next(1, FirstNames.Count())],
|
||||
// LastNames[Rnd.Next(1, LastNames.Count())],
|
||||
//DoctorOrigins[Rnd.Next(1, DoctorOrigins.Count())]);
|
||||
//Doctors.Add(doctor);
|
||||
//}
|
||||
//}
|
||||
//return Doctors;
|
||||
//}
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace EHEC_Server.DataBuilder
|
||||
{
|
||||
public class ExamAccess
|
||||
{
|
||||
public bool CreateExam(Exam exam)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (EHEC_DBEntities ctx = new EHEC_DBEntities())
|
||||
{
|
||||
ctx.Exam.Add(exam);
|
||||
ctx.SaveChanges();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace EHEC_Server.DatabaseAccess
|
||||
{
|
||||
public class OriginAccess
|
||||
{
|
||||
public bool CreateOrigin(Origin origin)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (EHEC_DBEntities ctx = new EHEC_DBEntities())
|
||||
{
|
||||
ctx.Origin.Add(origin);
|
||||
ctx.SaveChanges();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace EHEC_Server.DatabaseAccess
|
||||
{
|
||||
public class PatientAccess
|
||||
{
|
||||
public bool CreatePatient(Patient patient)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (EHEC_DBEntities ctx = new EHEC_DBEntities())
|
||||
{
|
||||
ctx.Patient.Add(patient);
|
||||
ctx.SaveChanges();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public List<Patient> GetAllPatients()
|
||||
{
|
||||
using (EHEC_DBEntities ctx = new EHEC_DBEntities())
|
||||
{
|
||||
return ctx.Patient.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace EHEC_Server.DatabaseAccess
|
||||
{
|
||||
public class ResultAccess
|
||||
{
|
||||
public bool CreateResult(Result result)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (EHEC_DBEntities ctx = new EHEC_DBEntities())
|
||||
{
|
||||
ctx.Result.Add(result);
|
||||
ctx.SaveChanges();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -9,13 +9,10 @@
|
|||
|
||||
namespace EHEC_Server
|
||||
{
|
||||
using EHEC_Server.DataBuilder;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using EHEC_Server.DatabaseAccess;
|
||||
|
||||
public partial class Doctor : DoctorAccess
|
||||
public partial class Doctor
|
||||
{
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
|
||||
public Doctor()
|
||||
|
@ -23,36 +20,13 @@ namespace EHEC_Server
|
|||
this.Exam = new HashSet<Exam>();
|
||||
}
|
||||
|
||||
|
||||
public void CreateDoctors(Doctor doctor)
|
||||
{
|
||||
using (EHEC_DBEntities ctx = new EHEC_DBEntities())
|
||||
{
|
||||
var doctors = GenerateDataBuilder.CreateDoctors();
|
||||
|
||||
foreach (var d in doctors)
|
||||
{
|
||||
ctx.Doctor.Add(d);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Doctor(string firstname, string lastname, string doctororigin)
|
||||
{
|
||||
this.FirstName = firstname;
|
||||
this.LastName = lastname;
|
||||
this.DoctorOrigin = doctororigin;
|
||||
}
|
||||
public int DoctorId { get; set; }
|
||||
public string FirstName { get; set; }
|
||||
public string LastName { get; set; }
|
||||
public string DoctorOrigin { get; set; }
|
||||
public string Region { get; set; }
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||
public virtual ICollection<Exam> Exam { get; set; }
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -107,7 +107,11 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="DatabaseAccess\DoctorAccess.cs" />
|
||||
<Compile Include="DatabaseAccess\OriginAccess.cs" />
|
||||
<Compile Include="DatabaseAccess\PatientAccess.cs" />
|
||||
<Compile Include="DatabaseAccess\ResultAccess.cs" />
|
||||
<Compile Include="DataBuilder\DataSeeder.cs" />
|
||||
<Compile Include="DatabaseAccess\ExamAccess.cs" />
|
||||
<Compile Include="DataBuilder\GenerateDataBuilder.cs" />
|
||||
<Compile Include="Doctor.cs">
|
||||
<DependentUpon>Model.tt</DependentUpon>
|
||||
|
@ -134,6 +138,9 @@
|
|||
<Compile Include="Origin.cs">
|
||||
<DependentUpon>Model.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Origin_Exam.cs">
|
||||
<DependentUpon>Model.tt</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Patient.cs">
|
||||
<DependentUpon>Model.tt</DependentUpon>
|
||||
</Compile>
|
||||
|
@ -144,6 +151,9 @@
|
|||
<Compile Include="Service.svc.cs">
|
||||
<DependentUpon>Service.svc</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="sysdiagrams.cs">
|
||||
<DependentUpon>Model.tt</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Service Include="{508349B6-6B84-4DF5-91F0-309BEEBAD82D}" />
|
||||
|
|
|
@ -14,34 +14,22 @@ namespace EHEC_Server
|
|||
|
||||
public partial class Exam
|
||||
{
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
|
||||
public Exam()
|
||||
{
|
||||
this.Origin_Exam = new HashSet<Origin_Exam>();
|
||||
}
|
||||
|
||||
public int ExamId { get; set; }
|
||||
public int DoctorId { get; set; }
|
||||
public int PatientId { get; set; }
|
||||
public bool SicknessStatus { get; set; }
|
||||
public string SicknessDesignation { get; set; }
|
||||
public int OriginOriginId { get; set; }
|
||||
public int Result_ResultId { get; set; }
|
||||
|
||||
public virtual Doctor Doctor { get; set; }
|
||||
public virtual Origin Origin { get; set; }
|
||||
public virtual Patient Patient { get; set; }
|
||||
public virtual Result Result { get; set; }
|
||||
|
||||
public bool CreateExam(Exam exam)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (EHEC_DBEntities ctx = new EHEC_DBEntities())
|
||||
{
|
||||
ctx.Exam.Add(exam);
|
||||
ctx.SaveChanges();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||
public virtual ICollection<Origin_Exam> Origin_Exam { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,8 +11,6 @@ namespace EHEC_Server
|
|||
[ServiceContract]
|
||||
public interface IService
|
||||
{
|
||||
[OperationContract]
|
||||
void CreateRandomData(Doctor doctor);
|
||||
|
||||
[OperationContract]
|
||||
void WriteDoctor(Doctor doctor);
|
||||
|
|
|
@ -30,5 +30,7 @@ namespace EHEC_Server
|
|||
public virtual DbSet<Origin> Origin { get; set; }
|
||||
public virtual DbSet<Patient> Patient { get; set; }
|
||||
public virtual DbSet<Result> Result { get; set; }
|
||||
public virtual DbSet<Origin_Exam> Origin_Exam { get; set; }
|
||||
public virtual DbSet<sysdiagrams> sysdiagrams { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@
|
|||
<Property Name="FirstName" Type="nvarchar(max)" Nullable="false" />
|
||||
<Property Name="LastName" Type="nvarchar(max)" Nullable="false" />
|
||||
<Property Name="DoctorOrigin" Type="nvarchar(max)" Nullable="false" />
|
||||
<Property Name="Region" Type="nvarchar(max)" Nullable="false" />
|
||||
</EntityType>
|
||||
<EntityType Name="Exam">
|
||||
<Key>
|
||||
|
@ -21,8 +22,6 @@
|
|||
<Property Name="ExamId" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
|
||||
<Property Name="DoctorId" Type="int" Nullable="false" />
|
||||
<Property Name="PatientId" Type="int" Nullable="false" />
|
||||
<Property Name="SicknessStatus" Type="bit" Nullable="false" />
|
||||
<Property Name="SicknessDesignation" Type="nvarchar(max)" Nullable="false" />
|
||||
<Property Name="OriginOriginId" Type="int" Nullable="false" />
|
||||
<Property Name="Result_ResultId" Type="int" Nullable="false" />
|
||||
</EntityType>
|
||||
|
@ -31,11 +30,19 @@
|
|||
<PropertyRef Name="OriginId" />
|
||||
</Key>
|
||||
<Property Name="OriginId" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
|
||||
<Property Name="SicknessId" Type="int" Nullable="false" />
|
||||
<Property Name="Name" Type="nvarchar(max)" Nullable="false" />
|
||||
<Property Name="Food" Type="nvarchar(max)" Nullable="false" />
|
||||
<Property Name="Street" Type="nvarchar(max)" Nullable="false" />
|
||||
<Property Name="City" Type="nvarchar(max)" Nullable="false" />
|
||||
</EntityType>
|
||||
<EntityType Name="Origin_Exam">
|
||||
<Key>
|
||||
<PropertyRef Name="Origin_ExamId" />
|
||||
</Key>
|
||||
<Property Name="Origin_ExamId" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
|
||||
<Property Name="OriginOriginId" Type="int" Nullable="false" />
|
||||
<Property Name="ExamExamId" Type="int" Nullable="false" />
|
||||
</EntityType>
|
||||
<EntityType Name="Patient">
|
||||
<Key>
|
||||
<PropertyRef Name="PatientId" />
|
||||
|
@ -46,6 +53,7 @@
|
|||
<Property Name="BirthDate" Type="datetime" Nullable="false" />
|
||||
<Property Name="Street" Type="nvarchar(max)" Nullable="false" />
|
||||
<Property Name="City" Type="nvarchar(max)" Nullable="false" />
|
||||
<Property Name="Region" Type="nvarchar(max)" Nullable="false" />
|
||||
</EntityType>
|
||||
<EntityType Name="Result">
|
||||
<Key>
|
||||
|
@ -53,7 +61,16 @@
|
|||
</Key>
|
||||
<Property Name="ResultId" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
|
||||
<Property Name="Name" Type="nvarchar(max)" Nullable="false" />
|
||||
<Property Name="Description" Type="nvarchar(max)" Nullable="false" />
|
||||
</EntityType>
|
||||
<EntityType Name="sysdiagrams">
|
||||
<Key>
|
||||
<PropertyRef Name="diagram_id" />
|
||||
</Key>
|
||||
<Property Name="name" Type="nvarchar" MaxLength="128" Nullable="false" />
|
||||
<Property Name="principal_id" Type="int" Nullable="false" />
|
||||
<Property Name="diagram_id" Type="int" StoreGeneratedPattern="Identity" Nullable="false" />
|
||||
<Property Name="version" Type="int" />
|
||||
<Property Name="definition" Type="varbinary(max)" />
|
||||
</EntityType>
|
||||
<Association Name="FK_DoctorExam">
|
||||
<End Role="Doctor" Type="Self.Doctor" Multiplicity="1" />
|
||||
|
@ -67,14 +84,26 @@
|
|||
</Dependent>
|
||||
</ReferentialConstraint>
|
||||
</Association>
|
||||
<Association Name="FK_OriginExam">
|
||||
<Association Name="FK_Exam">
|
||||
<End Role="Exam" Type="Self.Exam" Multiplicity="1" />
|
||||
<End Role="Origin_Exam" Type="Self.Origin_Exam" Multiplicity="*" />
|
||||
<ReferentialConstraint>
|
||||
<Principal Role="Exam">
|
||||
<PropertyRef Name="ExamId" />
|
||||
</Principal>
|
||||
<Dependent Role="Origin_Exam">
|
||||
<PropertyRef Name="ExamExamId" />
|
||||
</Dependent>
|
||||
</ReferentialConstraint>
|
||||
</Association>
|
||||
<Association Name="FK_Origin">
|
||||
<End Role="Origin" Type="Self.Origin" Multiplicity="1" />
|
||||
<End Role="Exam" Type="Self.Exam" Multiplicity="*" />
|
||||
<End Role="Origin_Exam" Type="Self.Origin_Exam" Multiplicity="*" />
|
||||
<ReferentialConstraint>
|
||||
<Principal Role="Origin">
|
||||
<PropertyRef Name="OriginId" />
|
||||
</Principal>
|
||||
<Dependent Role="Exam">
|
||||
<Dependent Role="Origin_Exam">
|
||||
<PropertyRef Name="OriginOriginId" />
|
||||
</Dependent>
|
||||
</ReferentialConstraint>
|
||||
|
@ -107,15 +136,21 @@
|
|||
<EntitySet Name="Doctor" EntityType="Self.Doctor" Schema="dbo" store:Type="Tables" />
|
||||
<EntitySet Name="Exam" EntityType="Self.Exam" Schema="dbo" store:Type="Tables" />
|
||||
<EntitySet Name="Origin" EntityType="Self.Origin" Schema="dbo" store:Type="Tables" />
|
||||
<EntitySet Name="Origin_Exam" EntityType="Self.Origin_Exam" Schema="dbo" store:Type="Tables" />
|
||||
<EntitySet Name="Patient" EntityType="Self.Patient" Schema="dbo" store:Type="Tables" />
|
||||
<EntitySet Name="Result" EntityType="Self.Result" Schema="dbo" store:Type="Tables" />
|
||||
<EntitySet Name="sysdiagrams" EntityType="Self.sysdiagrams" Schema="dbo" store:Type="Tables" />
|
||||
<AssociationSet Name="FK_DoctorExam" Association="Self.FK_DoctorExam">
|
||||
<End Role="Doctor" EntitySet="Doctor" />
|
||||
<End Role="Exam" EntitySet="Exam" />
|
||||
</AssociationSet>
|
||||
<AssociationSet Name="FK_OriginExam" Association="Self.FK_OriginExam">
|
||||
<End Role="Origin" EntitySet="Origin" />
|
||||
<AssociationSet Name="FK_Exam" Association="Self.FK_Exam">
|
||||
<End Role="Exam" EntitySet="Exam" />
|
||||
<End Role="Origin_Exam" EntitySet="Origin_Exam" />
|
||||
</AssociationSet>
|
||||
<AssociationSet Name="FK_Origin" Association="Self.FK_Origin">
|
||||
<End Role="Origin" EntitySet="Origin" />
|
||||
<End Role="Origin_Exam" EntitySet="Origin_Exam" />
|
||||
</AssociationSet>
|
||||
<AssociationSet Name="FK_PatientExam" Association="Self.FK_PatientExam">
|
||||
<End Role="Patient" EntitySet="Patient" />
|
||||
|
@ -126,8 +161,7 @@
|
|||
<End Role="Exam" EntitySet="Exam" />
|
||||
</AssociationSet>
|
||||
</EntityContainer>
|
||||
</Schema>
|
||||
</edmx:StorageModels>
|
||||
</Schema></edmx:StorageModels>
|
||||
<!-- CSDL content -->
|
||||
<edmx:ConceptualModels>
|
||||
<Schema Namespace="EHEC_DBModel" Alias="Self" annotation:UseStrongSpatialTypes="false" xmlns:annotation="http://schemas.microsoft.com/ado/2009/02/edm/annotation" xmlns:customannotation="http://schemas.microsoft.com/ado/2013/11/edm/customannotation" xmlns="http://schemas.microsoft.com/ado/2009/11/edm">
|
||||
|
@ -140,6 +174,7 @@
|
|||
<Property Name="LastName" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" Nullable="false" />
|
||||
<Property Name="DoctorOrigin" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" Nullable="false" />
|
||||
<NavigationProperty Name="Exam" Relationship="Self.FK_DoctorExam" FromRole="Doctor" ToRole="Exam" />
|
||||
<Property Name="Region" Type="String" Nullable="false" MaxLength="Max" FixedLength="false" Unicode="true" />
|
||||
</EntityType>
|
||||
<EntityType Name="Exam">
|
||||
<Key>
|
||||
|
@ -148,25 +183,23 @@
|
|||
<Property Name="ExamId" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<Property Name="DoctorId" Type="Int32" Nullable="false" />
|
||||
<Property Name="PatientId" Type="Int32" Nullable="false" />
|
||||
<Property Name="SicknessStatus" Type="Boolean" Nullable="false" />
|
||||
<Property Name="SicknessDesignation" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" Nullable="false" />
|
||||
<Property Name="OriginOriginId" Type="Int32" Nullable="false" />
|
||||
<Property Name="Result_ResultId" Type="Int32" Nullable="false" />
|
||||
<NavigationProperty Name="Doctor" Relationship="Self.FK_DoctorExam" FromRole="Exam" ToRole="Doctor" />
|
||||
<NavigationProperty Name="Origin" Relationship="Self.FK_OriginExam" FromRole="Exam" ToRole="Origin" />
|
||||
<NavigationProperty Name="Patient" Relationship="Self.FK_PatientExam" FromRole="Exam" ToRole="Patient" />
|
||||
<NavigationProperty Name="Result" Relationship="Self.FK_ResultExam" FromRole="Exam" ToRole="Result" />
|
||||
<NavigationProperty Name="Origin_Exam" Relationship="EHEC_DBModel.FK_Exam" FromRole="Exam" ToRole="Origin_Exam" />
|
||||
</EntityType>
|
||||
<EntityType Name="Origin">
|
||||
<Key>
|
||||
<PropertyRef Name="OriginId" />
|
||||
</Key>
|
||||
<Property Name="OriginId" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<Property Name="SicknessId" Type="Int32" Nullable="false" />
|
||||
<Property Name="Name" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" Nullable="false" />
|
||||
<Property Name="Street" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" Nullable="false" />
|
||||
<Property Name="City" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" Nullable="false" />
|
||||
<NavigationProperty Name="Exam" Relationship="Self.FK_OriginExam" FromRole="Origin" ToRole="Exam" />
|
||||
<Property Name="Food" Type="String" Nullable="false" MaxLength="Max" FixedLength="false" Unicode="true" />
|
||||
<NavigationProperty Name="Origin_Exam" Relationship="EHEC_DBModel.FK_Origin" FromRole="Origin" ToRole="Origin_Exam" />
|
||||
</EntityType>
|
||||
<EntityType Name="Patient">
|
||||
<Key>
|
||||
|
@ -175,10 +208,11 @@
|
|||
<Property Name="PatientId" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<Property Name="FirstName" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" Nullable="false" />
|
||||
<Property Name="LastName" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" Nullable="false" />
|
||||
<Property Name="BirthDate" Type="String" Nullable="false" />
|
||||
<Property Name="BirthDate" Type="DateTime" Nullable="false" />
|
||||
<Property Name="Street" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" Nullable="false" />
|
||||
<Property Name="City" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" Nullable="false" />
|
||||
<NavigationProperty Name="Exam" Relationship="Self.FK_PatientExam" FromRole="Patient" ToRole="Exam" />
|
||||
<Property Name="Region" Type="String" Nullable="false" MaxLength="Max" FixedLength="false" Unicode="true" />
|
||||
</EntityType>
|
||||
<EntityType Name="Result">
|
||||
<Key>
|
||||
|
@ -186,7 +220,6 @@
|
|||
</Key>
|
||||
<Property Name="ResultId" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<Property Name="Name" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" Nullable="false" />
|
||||
<Property Name="Description" Type="String" MaxLength="Max" FixedLength="false" Unicode="true" Nullable="false" />
|
||||
<NavigationProperty Name="Exam" Relationship="Self.FK_ResultExam" FromRole="Result" ToRole="Exam" />
|
||||
</EntityType>
|
||||
<Association Name="FK_DoctorExam">
|
||||
|
@ -201,18 +234,6 @@
|
|||
</Dependent>
|
||||
</ReferentialConstraint>
|
||||
</Association>
|
||||
<Association Name="FK_OriginExam">
|
||||
<End Role="Origin" Type="Self.Origin" Multiplicity="1" />
|
||||
<End Role="Exam" Type="Self.Exam" Multiplicity="*" />
|
||||
<ReferentialConstraint>
|
||||
<Principal Role="Origin">
|
||||
<PropertyRef Name="OriginId" />
|
||||
</Principal>
|
||||
<Dependent Role="Exam">
|
||||
<PropertyRef Name="OriginOriginId" />
|
||||
</Dependent>
|
||||
</ReferentialConstraint>
|
||||
</Association>
|
||||
<Association Name="FK_PatientExam">
|
||||
<End Role="Patient" Type="Self.Patient" Multiplicity="1" />
|
||||
<End Role="Exam" Type="Self.Exam" Multiplicity="*" />
|
||||
|
@ -247,10 +268,6 @@
|
|||
<End Role="Doctor" EntitySet="Doctor" />
|
||||
<End Role="Exam" EntitySet="Exam" />
|
||||
</AssociationSet>
|
||||
<AssociationSet Name="FK_OriginExam" Association="Self.FK_OriginExam">
|
||||
<End Role="Origin" EntitySet="Origin" />
|
||||
<End Role="Exam" EntitySet="Exam" />
|
||||
</AssociationSet>
|
||||
<AssociationSet Name="FK_PatientExam" Association="Self.FK_PatientExam">
|
||||
<End Role="Patient" EntitySet="Patient" />
|
||||
<End Role="Exam" EntitySet="Exam" />
|
||||
|
@ -259,7 +276,61 @@
|
|||
<End Role="Result" EntitySet="Result" />
|
||||
<End Role="Exam" EntitySet="Exam" />
|
||||
</AssociationSet>
|
||||
<EntitySet Name="Origin_Exam" EntityType="EHEC_DBModel.Origin_Exam" />
|
||||
<EntitySet Name="sysdiagrams" EntityType="EHEC_DBModel.sysdiagrams" />
|
||||
<AssociationSet Name="FK_Exam" Association="EHEC_DBModel.FK_Exam">
|
||||
<End Role="Exam" EntitySet="Exam" />
|
||||
<End Role="Origin_Exam" EntitySet="Origin_Exam" />
|
||||
</AssociationSet>
|
||||
<AssociationSet Name="FK_Origin" Association="EHEC_DBModel.FK_Origin">
|
||||
<End Role="Origin" EntitySet="Origin" />
|
||||
<End Role="Origin_Exam" EntitySet="Origin_Exam" />
|
||||
</AssociationSet>
|
||||
</EntityContainer>
|
||||
<EntityType Name="Origin_Exam">
|
||||
<Key>
|
||||
<PropertyRef Name="Origin_ExamId" />
|
||||
</Key>
|
||||
<Property Name="Origin_ExamId" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<Property Name="OriginOriginId" Type="Int32" Nullable="false" />
|
||||
<Property Name="ExamExamId" Type="Int32" Nullable="false" />
|
||||
<NavigationProperty Name="Exam" Relationship="EHEC_DBModel.FK_Exam" FromRole="Origin_Exam" ToRole="Exam" />
|
||||
<NavigationProperty Name="Origin" Relationship="EHEC_DBModel.FK_Origin" FromRole="Origin_Exam" ToRole="Origin" />
|
||||
</EntityType>
|
||||
<EntityType Name="sysdiagrams">
|
||||
<Key>
|
||||
<PropertyRef Name="diagram_id" />
|
||||
</Key>
|
||||
<Property Name="name" Type="String" Nullable="false" MaxLength="128" FixedLength="false" Unicode="true" />
|
||||
<Property Name="principal_id" Type="Int32" Nullable="false" />
|
||||
<Property Name="diagram_id" Type="Int32" Nullable="false" annotation:StoreGeneratedPattern="Identity" />
|
||||
<Property Name="version" Type="Int32" />
|
||||
<Property Name="definition" Type="Binary" MaxLength="Max" FixedLength="false" />
|
||||
</EntityType>
|
||||
<Association Name="FK_Exam">
|
||||
<End Type="EHEC_DBModel.Exam" Role="Exam" Multiplicity="1" />
|
||||
<End Type="EHEC_DBModel.Origin_Exam" Role="Origin_Exam" Multiplicity="*" />
|
||||
<ReferentialConstraint>
|
||||
<Principal Role="Exam">
|
||||
<PropertyRef Name="ExamId" />
|
||||
</Principal>
|
||||
<Dependent Role="Origin_Exam">
|
||||
<PropertyRef Name="ExamExamId" />
|
||||
</Dependent>
|
||||
</ReferentialConstraint>
|
||||
</Association>
|
||||
<Association Name="FK_Origin">
|
||||
<End Type="EHEC_DBModel.Origin" Role="Origin" Multiplicity="1" />
|
||||
<End Type="EHEC_DBModel.Origin_Exam" Role="Origin_Exam" Multiplicity="*" />
|
||||
<ReferentialConstraint>
|
||||
<Principal Role="Origin">
|
||||
<PropertyRef Name="OriginId" />
|
||||
</Principal>
|
||||
<Dependent Role="Origin_Exam">
|
||||
<PropertyRef Name="OriginOriginId" />
|
||||
</Dependent>
|
||||
</ReferentialConstraint>
|
||||
</Association>
|
||||
</Schema>
|
||||
</edmx:ConceptualModels>
|
||||
<!-- C-S mapping content -->
|
||||
|
@ -269,6 +340,7 @@
|
|||
<EntitySetMapping Name="Doctor">
|
||||
<EntityTypeMapping TypeName="EHEC_DBModel.Doctor">
|
||||
<MappingFragment StoreEntitySet="Doctor">
|
||||
<ScalarProperty Name="Region" ColumnName="Region" />
|
||||
<ScalarProperty Name="DoctorId" ColumnName="DoctorId" />
|
||||
<ScalarProperty Name="FirstName" ColumnName="FirstName" />
|
||||
<ScalarProperty Name="LastName" ColumnName="LastName" />
|
||||
|
@ -282,8 +354,6 @@
|
|||
<ScalarProperty Name="ExamId" ColumnName="ExamId" />
|
||||
<ScalarProperty Name="DoctorId" ColumnName="DoctorId" />
|
||||
<ScalarProperty Name="PatientId" ColumnName="PatientId" />
|
||||
<ScalarProperty Name="SicknessStatus" ColumnName="SicknessStatus" />
|
||||
<ScalarProperty Name="SicknessDesignation" ColumnName="SicknessDesignation" />
|
||||
<ScalarProperty Name="OriginOriginId" ColumnName="OriginOriginId" />
|
||||
<ScalarProperty Name="Result_ResultId" ColumnName="Result_ResultId" />
|
||||
</MappingFragment>
|
||||
|
@ -292,8 +362,8 @@
|
|||
<EntitySetMapping Name="Origin">
|
||||
<EntityTypeMapping TypeName="EHEC_DBModel.Origin">
|
||||
<MappingFragment StoreEntitySet="Origin">
|
||||
<ScalarProperty Name="Food" ColumnName="Food" />
|
||||
<ScalarProperty Name="OriginId" ColumnName="OriginId" />
|
||||
<ScalarProperty Name="SicknessId" ColumnName="SicknessId" />
|
||||
<ScalarProperty Name="Name" ColumnName="Name" />
|
||||
<ScalarProperty Name="Street" ColumnName="Street" />
|
||||
<ScalarProperty Name="City" ColumnName="City" />
|
||||
|
@ -303,6 +373,7 @@
|
|||
<EntitySetMapping Name="Patient">
|
||||
<EntityTypeMapping TypeName="EHEC_DBModel.Patient">
|
||||
<MappingFragment StoreEntitySet="Patient">
|
||||
<ScalarProperty Name="Region" ColumnName="Region" />
|
||||
<ScalarProperty Name="PatientId" ColumnName="PatientId" />
|
||||
<ScalarProperty Name="FirstName" ColumnName="FirstName" />
|
||||
<ScalarProperty Name="LastName" ColumnName="LastName" />
|
||||
|
@ -317,7 +388,26 @@
|
|||
<MappingFragment StoreEntitySet="Result">
|
||||
<ScalarProperty Name="ResultId" ColumnName="ResultId" />
|
||||
<ScalarProperty Name="Name" ColumnName="Name" />
|
||||
<ScalarProperty Name="Description" ColumnName="Description" />
|
||||
</MappingFragment>
|
||||
</EntityTypeMapping>
|
||||
</EntitySetMapping>
|
||||
<EntitySetMapping Name="Origin_Exam">
|
||||
<EntityTypeMapping TypeName="EHEC_DBModel.Origin_Exam">
|
||||
<MappingFragment StoreEntitySet="Origin_Exam">
|
||||
<ScalarProperty Name="ExamExamId" ColumnName="ExamExamId" />
|
||||
<ScalarProperty Name="OriginOriginId" ColumnName="OriginOriginId" />
|
||||
<ScalarProperty Name="Origin_ExamId" ColumnName="Origin_ExamId" />
|
||||
</MappingFragment>
|
||||
</EntityTypeMapping>
|
||||
</EntitySetMapping>
|
||||
<EntitySetMapping Name="sysdiagrams">
|
||||
<EntityTypeMapping TypeName="EHEC_DBModel.sysdiagrams">
|
||||
<MappingFragment StoreEntitySet="sysdiagrams">
|
||||
<ScalarProperty Name="definition" ColumnName="definition" />
|
||||
<ScalarProperty Name="version" ColumnName="version" />
|
||||
<ScalarProperty Name="diagram_id" ColumnName="diagram_id" />
|
||||
<ScalarProperty Name="principal_id" ColumnName="principal_id" />
|
||||
<ScalarProperty Name="name" ColumnName="name" />
|
||||
</MappingFragment>
|
||||
</EntityTypeMapping>
|
||||
</EntitySetMapping>
|
||||
|
|
|
@ -7,13 +7,16 @@
|
|||
<Diagram DiagramId="09c9d242de5f41b186b4e8e8af51e2a7" Name="Diagram1">
|
||||
<EntityTypeShape EntityType="EHEC_DBModel.Doctor" Width="1.5" PointX="2.625" PointY="0.75" IsExpanded="true" />
|
||||
<EntityTypeShape EntityType="EHEC_DBModel.Exam" Width="1.5" PointX="5.5" PointY="1.875" IsExpanded="true" />
|
||||
<EntityTypeShape EntityType="EHEC_DBModel.Origin" Width="1.5" PointX="0.75" PointY="5" IsExpanded="true" />
|
||||
<EntityTypeShape EntityType="EHEC_DBModel.Origin" Width="1.5" PointX="0.875" PointY="4.75" IsExpanded="true" />
|
||||
<EntityTypeShape EntityType="EHEC_DBModel.Patient" Width="1.5" PointX="0.5" PointY="1.875" IsExpanded="true" />
|
||||
<EntityTypeShape EntityType="EHEC_DBModel.Result" Width="1.5" PointX="9.125" PointY="2.625" IsExpanded="true" />
|
||||
<AssociationConnector Association="EHEC_DBModel.FK_DoctorExam" ManuallyRouted="false" />
|
||||
<AssociationConnector Association="EHEC_DBModel.FK_OriginExam" ManuallyRouted="false" />
|
||||
<AssociationConnector Association="EHEC_DBModel.FK_PatientExam" ManuallyRouted="false" />
|
||||
<AssociationConnector Association="EHEC_DBModel.FK_ResultExam" ManuallyRouted="false" />
|
||||
<EntityTypeShape EntityType="EHEC_DBModel.Origin_Exam" Width="1.5" PointX="4.875" PointY="6.375" />
|
||||
<EntityTypeShape EntityType="EHEC_DBModel.sysdiagrams" Width="1.5" PointX="0.5" PointY="7.375" />
|
||||
<AssociationConnector Association="EHEC_DBModel.FK_Exam" />
|
||||
<AssociationConnector Association="EHEC_DBModel.FK_Origin" />
|
||||
</Diagram>
|
||||
</edmx:Diagrams>
|
||||
</edmx:Designer>
|
||||
|
|
|
@ -17,33 +17,16 @@ namespace EHEC_Server
|
|||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
|
||||
public Origin()
|
||||
{
|
||||
this.Exam = new HashSet<Exam>();
|
||||
this.Origin_Exam = new HashSet<Origin_Exam>();
|
||||
}
|
||||
|
||||
public int OriginId { get; set; }
|
||||
public int SicknessId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Street { get; set; }
|
||||
public string City { get; set; }
|
||||
public string Food { get; set; }
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||
public virtual ICollection<Exam> Exam { get; set; }
|
||||
|
||||
public bool CreateOrigin(Origin origin)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (EHEC_DBEntities ctx = new EHEC_DBEntities())
|
||||
{
|
||||
ctx.Origin.Add(origin);
|
||||
ctx.SaveChanges();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public virtual ICollection<Origin_Exam> Origin_Exam { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,24 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace EHEC_Server
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class Origin_Exam
|
||||
{
|
||||
public int Origin_ExamId { get; set; }
|
||||
public int OriginOriginId { get; set; }
|
||||
public int ExamExamId { get; set; }
|
||||
|
||||
public virtual Exam Exam { get; set; }
|
||||
public virtual Origin Origin { get; set; }
|
||||
}
|
||||
}
|
|
@ -9,11 +9,12 @@
|
|||
|
||||
namespace EHEC_Server
|
||||
{
|
||||
using EHEC_Server.DatabaseAccess;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
public partial class Patient
|
||||
public partial class Patient : PatientAccess
|
||||
{
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2214:DoNotCallOverridableMethodsInConstructors")]
|
||||
public Patient()
|
||||
|
@ -21,7 +22,7 @@ namespace EHEC_Server
|
|||
this.Exam = new HashSet<Exam>();
|
||||
}
|
||||
|
||||
public Patient(string firstname, string lastname, string birthDate, string street, string city)
|
||||
public Patient(string firstname, string lastname, DateTime birthDate, string street, string city)
|
||||
{
|
||||
this.FirstName = firstname;
|
||||
this.LastName = lastname;
|
||||
|
@ -33,8 +34,7 @@ namespace EHEC_Server
|
|||
public int PatientId { get; set; }
|
||||
public string FirstName { get; set; }
|
||||
public string LastName { get; set; }
|
||||
//public System.DateTime BirthDate { get; set; }
|
||||
public string BirthDate { get; set; }
|
||||
public DateTime BirthDate { get; set; }
|
||||
public string Street { get; set; }
|
||||
public string City { get; set; }
|
||||
|
||||
|
@ -42,29 +42,6 @@ namespace EHEC_Server
|
|||
public virtual ICollection<Exam> Exam { get; set; }
|
||||
|
||||
|
||||
public bool CreatePatient(Patient patient)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (EHEC_DBEntities ctx = new EHEC_DBEntities())
|
||||
{
|
||||
ctx.Patient.Add(patient);
|
||||
ctx.SaveChanges();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public List<Patient> GetAllPatients()
|
||||
{
|
||||
using (EHEC_DBEntities ctx = new EHEC_DBEntities())
|
||||
{
|
||||
return ctx.Patient.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,26 +22,8 @@ namespace EHEC_Server
|
|||
|
||||
public int ResultId { get; set; }
|
||||
public string Name { get; set; }
|
||||
public string Description { get; set; }
|
||||
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227:CollectionPropertiesShouldBeReadOnly")]
|
||||
public virtual ICollection<Exam> Exam { get; set; }
|
||||
|
||||
public bool CreateResult(Result result)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (EHEC_DBEntities ctx = new EHEC_DBEntities())
|
||||
{
|
||||
ctx.Result.Add(result);
|
||||
ctx.SaveChanges();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -13,11 +13,7 @@ namespace EHEC_Server
|
|||
// NOTE: In order to launch WCF Test Client for testing this service, please select Service.svc or Service.svc.cs at the Solution Explorer and start debugging.
|
||||
public class Service : IService
|
||||
{
|
||||
public void CreateRandomData(Doctor doctor)
|
||||
{
|
||||
Doctor dataaccess = new Doctor();
|
||||
dataaccess.CreateDoctors(doctor);
|
||||
}
|
||||
|
||||
public List<Doctor> GetDoctors()
|
||||
{
|
||||
Doctor dataaccess = new Doctor();
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace EHEC_Server
|
||||
{
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
public partial class sysdiagrams
|
||||
{
|
||||
public string name { get; set; }
|
||||
public int principal_id { get; set; }
|
||||
public int diagram_id { get; set; }
|
||||
public Nullable<int> version { get; set; }
|
||||
public byte[] definition { get; set; }
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue