79 lines
2.5 KiB
C#
79 lines
2.5 KiB
C#
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<Node> GetNodes()
|
|
{
|
|
List<Node> X = new List<Node>();
|
|
X.AddRange(GetClusterOrigins());
|
|
X.AddRange(GetClusterPatients());
|
|
X.AddRange(GetClusterResults());
|
|
return X;
|
|
}
|
|
public List<Node> GetClusterOrigins()
|
|
{
|
|
Origin origin = new Origin();
|
|
List<Origin> origins = new List<Origin>();
|
|
origins = origin.GetAllOrigins();
|
|
List<Node> clusterOrigins = new List<Node>();
|
|
foreach (Origin element in origins)
|
|
{
|
|
Node clusterOrigin = new Node
|
|
{
|
|
Id = element.OriginId,
|
|
Nodetype = "origin",
|
|
Name = element.City
|
|
};
|
|
clusterOrigins.Add(clusterOrigin);
|
|
};
|
|
return clusterOrigins;
|
|
}
|
|
public List<Node> GetClusterPatients()
|
|
{
|
|
Patient patient = new Patient();
|
|
List<Patient> patients = new List<Patient>();
|
|
patients = patient.GetAllPatients();
|
|
List<Node> clusterPatients = new List<Node>();
|
|
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<Node> GetClusterResults()
|
|
{
|
|
Result result = new Result();
|
|
List<Result> results = new List<Result>();
|
|
results = result.GetAllResults();
|
|
List<Node> clusterResults = new List<Node>();
|
|
foreach (Result element in results)
|
|
{
|
|
Node clusterResult = new Node
|
|
{
|
|
Id = element.ResultId,
|
|
Nodetype = "result",
|
|
Name = element.Name
|
|
};
|
|
clusterResults.Add(clusterResult);
|
|
};
|
|
return clusterResults;
|
|
}
|
|
|
|
}
|
|
}
|