refactor ClusterConverter and Model
This commit is contained in:
parent
7473c46d73
commit
d835495591
|
@ -10,11 +10,12 @@ namespace EHEC_Server
|
||||||
{
|
{
|
||||||
public void WriteJson()
|
public void WriteJson()
|
||||||
{
|
{
|
||||||
ClusterPatient clusterp = new ClusterPatient();
|
ClusterPatient p = new ClusterPatient();
|
||||||
List<ClusterPatient> clusterPatientList = new List<ClusterPatient>();
|
List<ClusterPatient> clusterPatientsList = new List<ClusterPatient>();
|
||||||
clusterPatientList = clusterp.GetClusterPatients();
|
clusterPatientsList = p.GetClusterPatients();
|
||||||
|
//clusterPatient =
|
||||||
|
|
||||||
var json = JsonConverter.Serialize(clusterPatientList);
|
var json = JsonConverter.Serialize(clusterPatientsList);
|
||||||
System.IO.File.WriteAllText(@"C:\Users\novski\Desktop\cluster.json", json);
|
System.IO.File.WriteAllText(@"C:\Users\novski\Desktop\cluster.json", json);
|
||||||
}
|
}
|
||||||
private List<ClusterPatient> GetCluster()
|
private List<ClusterPatient> GetCluster()
|
||||||
|
|
|
@ -8,28 +8,33 @@ namespace EHEC_Server
|
||||||
|
|
||||||
public class ClusterPatient
|
public class ClusterPatient
|
||||||
{
|
{
|
||||||
public List<Patient> Patients { get; set; }
|
private int Id { get; set; }
|
||||||
public List<ClusterPatient> ClusterPatients { get; set; }
|
private string Name { get; set; }
|
||||||
public int Id { get; set; }
|
private string Nodetype { get; set; }
|
||||||
public string Name { get; set; }
|
|
||||||
|
public ClusterPatient() { }
|
||||||
|
|
||||||
public List<ClusterPatient> GetClusterPatients()
|
public List<ClusterPatient> GetClusterPatients()
|
||||||
{
|
{
|
||||||
Patient p = new Patient();
|
Patient patient = new Patient();
|
||||||
Patients = p.GetAllPatients();
|
List<Patient> patients = new List<Patient>();
|
||||||
|
patients = patient.GetAllPatients();
|
||||||
|
List<ClusterPatient> ClusterPatients = new List<ClusterPatient>();
|
||||||
|
|
||||||
foreach (Patient element in Patients)
|
foreach (Patient element in patients)
|
||||||
{
|
{
|
||||||
ClusterPatient clusterPatient = new ClusterPatient
|
ClusterPatient clusterPatient = new ClusterPatient
|
||||||
{
|
{
|
||||||
Id = element.PatientId,
|
Id = element.PatientId,
|
||||||
|
Nodetype = "patient",
|
||||||
Name = element.FirstName + " " + element.LastName
|
Name = element.FirstName + " " + element.LastName
|
||||||
};
|
};
|
||||||
ClusterPatients.Add(clusterPatient);
|
ClusterPatients.Add(clusterPatient);
|
||||||
}
|
}
|
||||||
return ClusterPatients;
|
return ClusterPatients;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
Loading…
Reference in New Issue