using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace EHEC_Server { public class Node { public int Id { get; set; } public string Name { get; set; } public string Nodetype { get; set; } public Node() { } public List GetNodes() { List X = new List(); X.AddRange(GetClusterOrigins()); X.AddRange(GetClusterPatients()); X.AddRange(GetClusterResults()); return X; } public List GetClusterOrigins() { Origin origin = new Origin(); List origins = new List(); origins = origin.GetAllOrigins(); List clusterOrigins = new List(); foreach (Origin element in origins) { Node clusterOrigin = new Node { Id = element.OriginId, Nodetype = "origin", Name = element.City }; clusterOrigins.Add(clusterOrigin); }; return clusterOrigins; } public List GetClusterPatients() { Patient patient = new Patient(); List patients = new List(); patients = patient.GetAllPatients(); List clusterPatients = new List(); foreach (Patient element in patients) { Node clusterPatient = new Node { Id = element.PatientId, Nodetype = "patient", Name = element.FirstName + " " + element.LastName }; clusterPatients.Add(clusterPatient); } return clusterPatients; } public List GetClusterResults() { Result result = new Result(); List results = new List(); results = result.GetAllResults(); List clusterResults = new List(); foreach (Result element in results) { Node clusterResult = new Node { Id = element.ResultId, Nodetype = "result", Name = element.Name }; clusterResults.Add(clusterResult); }; return clusterResults; } } }