change db patient call

This commit is contained in:
Ivan Hörler 2018-07-17 21:41:04 +02:00
parent f8e2705de3
commit f46b9e466b
3 changed files with 18 additions and 17 deletions

View File

@ -58,9 +58,9 @@ namespace EHEC_Server
//add patients //add patients
//using (EHEC_DBEntities ctx = new EHEC_DBEntities()) using (EHEC_DBEntities ctx = new EHEC_DBEntities())
//{ {
Random p = new Random(); Random p = new Random();
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
{ {
Patient patient = new Patient Patient patient = new Patient
@ -72,14 +72,14 @@ namespace EHEC_Server
City = Cities[p.Next(0, 7)].ToString(), City = Cities[p.Next(0, 7)].ToString(),
Region = Regions[p.Next(0, 6)].ToString() Region = Regions[p.Next(0, 6)].ToString()
}; };
Global.GlobalInstance.DbAccess.Patients.Add(patient); //Global.GlobalInstance.DbAccess.Patients.Add(patient);
//ctx.Patients.Add(patient); ctx.Patients.Add(patient);
//ctx.SaveChanges(); ctx.SaveChanges();
} }
//} }
//add doctors //add doctors
//using (EHEC_DBEntities ctx = new EHEC_DBEntities()) using (EHEC_DBEntities ctx = new EHEC_DBEntities())
//{ {
Random d = new Random(); Random d = new Random();
for (int i = 0; i < 10; i++) for (int i = 0; i < 10; i++)
@ -91,11 +91,11 @@ namespace EHEC_Server
DoctorOrigin = DoctorOrigins[d.Next(0, 4)].ToString(), DoctorOrigin = DoctorOrigins[d.Next(0, 4)].ToString(),
Region = Regions[d.Next(0, 6)].ToString() Region = Regions[d.Next(0, 6)].ToString()
}; };
Global.GlobalInstance.DbAccess.Doctors.Add(doctor); //Global.GlobalInstance.DbAccess.Doctors.Add(doctor);
//ctx.Doctors.Add(doctor); ctx.Doctors.Add(doctor);
//ctx.SaveChanges(); ctx.SaveChanges();
} }
//} }
} }

View File

@ -15,7 +15,7 @@ namespace EHEC_Server
clusterPatientList = clusterp.GetClusterPatients(); clusterPatientList = clusterp.GetClusterPatients();
var json = JsonConverter.Serialize(clusterPatientList); var json = JsonConverter.Serialize(clusterPatientList);
System.IO.File.WriteAllText(@"C:\Users\novski\Desktop\Company.json", json); System.IO.File.WriteAllText(@"C:\Users\novski\Desktop\cluster.json", json);
} }
private List<ClusterPatient> GetCluster() private List<ClusterPatient> GetCluster()
{ {

View File

@ -15,7 +15,8 @@ namespace EHEC_Server
public List<ClusterPatient> GetClusterPatients() public List<ClusterPatient> GetClusterPatients()
{ {
Patients = Global.GlobalInstance.DbAccess.Patients.ToList(); Patient p = new Patient();
Patients = p.GetAllPatients();
foreach (Patient element in Patients) foreach (Patient element in Patients)
{ {
@ -24,7 +25,7 @@ namespace EHEC_Server
Id = element.PatientId, Id = element.PatientId,
Name = element.FirstName + " " + element.LastName Name = element.FirstName + " " + element.LastName
}; };
this.ClusterPatients.Add(clusterPatient); ClusterPatients.Add(clusterPatient);
} }
return ClusterPatients; return ClusterPatients;
} }