oop_II-6/EHEC_Server/EHEC_Server/cluster_dependencies/ClusterConverter.cs

40 lines
1.2 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using EHEC_Server;
using System.Web.Script.Serialization;
namespace EHEC_Server
{
public class ClusterConverter
{
public string WriteJson()
{
ClusterPatient p = new ClusterPatient();
List<ClusterPatient> clusterPatientsList = new List<ClusterPatient>();
clusterPatientsList = p.GetClusterPatients();
ClusterResult r = new ClusterResult();
List<ClusterResult> clusterResultsList = new List<ClusterResult>();
clusterResultsList = r.GetClusterResults();
//var json = JsonConverter.Serialize(clusterPatientsList);
//string path = System.Reflection.Assembly.GetExecutingAssembly().Location;
//string fileName = Path.Combine(path, "ClusterData.json");
//System.IO.File.WriteAllText(fileName, json);
var json = JsonConverter.Serialize(clusterPatientsList);
System.IO.File.WriteAllText(@"C:\Users\Public\Documents\cluster.json", json);
return json;
}
private List<ClusterPatient> GetCluster()
{
return new List<ClusterPatient>();
}
}
}