Browse Source

Merge branch 'feature/STAY-AWAY' of https://github.com/RD125632/TI-2.1-RemoteHealthCare into RD125632-feature/STAY-AWAY

Conflicts:
	Proftaak Remote Healthcare/FietsClientV2/Forms/PatientForm.Designer.cs
	Proftaak Remote Healthcare/FietsClientV2/Forms/PatientForm.designer.cs
	Proftaak Remote Healthcare/FietsClientV2/Resources/PatientForm.Designer.cs
Bart Reedijk 10 năm trước cách đây
mục cha
commit
81060e72ee

+ 2 - 1
Proftaak Remote Healthcare/FietsClientV2/CurrentData.cs

@@ -8,8 +8,9 @@ using System.Threading.Tasks;
 namespace FietsClient
 {
     public class CurrentData
-    {
+    {//faggsd
         private string userID;
+        public bool isDoctor { set; get; }
         private List<Session> testResult;
 
 

+ 69 - 4
Proftaak Remote Healthcare/FietsClientV2/Forms/PatientForm.cs

@@ -6,8 +6,11 @@ using System.Drawing;
 using System.IO.Ports;
 using System.Linq;
 using System.Text;
+using System.Threading;
 using System.Threading.Tasks;
 using System.Windows.Forms;
+using FietsClient.JSONObjecten;
+using System.Windows.Forms.DataVisualization.Charting;
 
 namespace FietsClient
 {
@@ -15,7 +18,7 @@ namespace FietsClient
     {
         private TcpConnection _connection;
         private PatientModel patienModel;
-        
+
         public PatientForm(TcpConnection connection)
         {
             this._connection = connection;
@@ -52,6 +55,7 @@ namespace FietsClient
         {
             string[] ports = SerialPort.GetPortNames();
             toolStripComboBox1.Items.AddRange(ports);
+            MenuSessionItems();
         }
 
         private void requestDataToolStripMenuItem_Click(object sender, EventArgs e)
@@ -115,7 +119,7 @@ namespace FietsClient
 
         private void sendButton_Click(object sender, EventArgs e)
         {
-            if(messageBox.Text != null)
+            if (messageBox.Text != null)
             {
                 String[] data = new String[2];
                 data[0] = messageBox.Text;
@@ -135,13 +139,74 @@ namespace FietsClient
             
         }
 
+
+        private void MenuSessionItems()
+        {
+            foreach (Session s in _connection.currentData.GetSessions())
+            {
+                selectSessionToolStripMenuItem.DropDownItems.Add(
+                    new ToolStripMenuItem(s.id.ToString(), null, delegate
+                    {
+                        this.sessionBox.Text = s.id.ToString();
+                        this.nameBox.Text = _connection.userID;
+                        //get measurments
+                        List<Measurement> measurments = s.session;
+                        //fill boxes
+
+                        this.pulseBox.Text = measurments[measurments.Count - 1].bpm.ToString();
+                        this.rpmInfoBox.Text = measurments[measurments.Count - 1].rpm.ToString();
+                        this.speedInfoBox.Text = measurments[measurments.Count - 1].speed.ToString();
+                        this.distanceInfoBox.Text = measurments[measurments.Count - 1].distance.ToString();
+                        this.requestedBox.Text = measurments[measurments.Count - 1].requestedPower.ToString();
+                        this.energyInfoBox.Text = measurments[measurments.Count - 1].energy.ToString();
+                        this.timeBox.Text = measurments[measurments.Count - 1].time.ToString();
+                        this.actualBox.Text = measurments[measurments.Count - 1].actualPower.ToString();
+
+                        //fill speedpoints
+                        patienModel.speedPoints = new List<DataPoint>();
+                        for (int i = 0; i < measurments.Count; i++)
+                        {
+                            patienModel.speedPoints.Add(new DataPoint(measurments[i].time, measurments[i].speed));
+                        }
+                        //fill speedgraph
+                        this.speedChart.Series[0].Points.Clear();
+                        for (int i = 0; i < patienModel.speedPoints.Count; i++)
+                            this.speedChart.Series[0].Points.Add(patienModel.speedPoints[i]);
+                        this.speedChart.Update();
+
+                        //fill bpm
+                        patienModel.bpmPoints = new List<DataPoint>();
+                        for (int i = 0; i < measurments.Count; i++)
+                        {
+                            patienModel.bpmPoints.Add(new DataPoint(measurments[i].time, measurments[i].bpm));
+                        }
+                        //fill bpmgraph
+                        this.bpmChart.Series[0].Points.Clear();
+                        for (int i = 0; i < patienModel.bpmPoints.Count; i++)
+                            this.bpmChart.Series[0].Points.Add(patienModel.bpmPoints[i]);
+                        this.bpmChart.Update();
+
+                        //fill rpm
+                        patienModel.rpmPoints = new List<DataPoint>();
+                        for (int i = 0; i < measurments.Count; i++)
+                        {
+                            patienModel.rpmPoints.Add(new DataPoint(measurments[i].time, measurments[i].rpm));
+                        }
+                        //fill rpmgraph
+                        this.rpmChart.Series[0].Points.Clear();
+                        for (int i = 0; i < patienModel.rpmPoints.Count; i++)
+                            this.rpmChart.Series[0].Points.Add(patienModel.rpmPoints[i]);
+                        this.rpmChart.Update();
+                    })
+                );
+
+            }
+        }
         private void printMessage(string[] data)
         {
 
             string finalMessage = data[1] + ":\t\t" + data[3] + "\r\n";
             chatBox.AppendText(finalMessage);
         }
-
-        
     }
 }

+ 42 - 52
Proftaak Remote Healthcare/FietsClientV2/Forms/PatientForm.designer.cs

@@ -30,16 +30,15 @@ namespace FietsClient
         /// </summary>
         private void InitializeComponent()
         {
-            System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea4 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
-            System.Windows.Forms.DataVisualization.Charting.Series series4 = new System.Windows.Forms.DataVisualization.Charting.Series();
-            System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea5 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
-            System.Windows.Forms.DataVisualization.Charting.Series series5 = new System.Windows.Forms.DataVisualization.Charting.Series();
-            System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea6 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
-            System.Windows.Forms.DataVisualization.Charting.Series series6 = new System.Windows.Forms.DataVisualization.Charting.Series();
+            System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea1 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
+            System.Windows.Forms.DataVisualization.Charting.Series series1 = new System.Windows.Forms.DataVisualization.Charting.Series();
+            System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea2 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
+            System.Windows.Forms.DataVisualization.Charting.Series series2 = new System.Windows.Forms.DataVisualization.Charting.Series();
+            System.Windows.Forms.DataVisualization.Charting.ChartArea chartArea3 = new System.Windows.Forms.DataVisualization.Charting.ChartArea();
+            System.Windows.Forms.DataVisualization.Charting.Series series3 = new System.Windows.Forms.DataVisualization.Charting.Series();
             this.menuStrip1 = new System.Windows.Forms.MenuStrip();
             this.archiefToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.selectSessionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
-            this.sESSIONSToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.bicycleToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.selectPortToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
             this.toolStripComboBox1 = new System.Windows.Forms.ToolStripComboBox();
@@ -136,18 +135,10 @@ namespace FietsClient
             // 
             // selectSessionToolStripMenuItem
             // 
-            this.selectSessionToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
-            this.sESSIONSToolStripMenuItem});
             this.selectSessionToolStripMenuItem.Name = "selectSessionToolStripMenuItem";
-            this.selectSessionToolStripMenuItem.Size = new System.Drawing.Size(181, 26);
+            this.selectSessionToolStripMenuItem.Size = new System.Drawing.Size(177, 26);
             this.selectSessionToolStripMenuItem.Text = "Select Session";
             // 
-            // sESSIONSToolStripMenuItem
-            // 
-            this.sESSIONSToolStripMenuItem.Name = "sESSIONSToolStripMenuItem";
-            this.sESSIONSToolStripMenuItem.Size = new System.Drawing.Size(150, 26);
-            this.sESSIONSToolStripMenuItem.Text = "SESSIONS";
-            // 
             // bicycleToolStripMenuItem
             // 
             this.bicycleToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -164,7 +155,7 @@ namespace FietsClient
             this.requestDataToolStripMenuItem,
             this.closePortToolStripMenuItem});
             this.selectPortToolStripMenuItem.Name = "selectPortToolStripMenuItem";
-            this.selectPortToolStripMenuItem.Size = new System.Drawing.Size(181, 26);
+            this.selectPortToolStripMenuItem.Size = new System.Drawing.Size(156, 26);
             this.selectPortToolStripMenuItem.Text = "Select port";
             // 
             // toolStripComboBox1
@@ -213,7 +204,7 @@ namespace FietsClient
             this.distanceTraining,
             this.setTimeToolStripMenuItem});
             this.distanceToolStripMenuItem.Name = "distanceToolStripMenuItem";
-            this.distanceToolStripMenuItem.Size = new System.Drawing.Size(181, 26);
+            this.distanceToolStripMenuItem.Size = new System.Drawing.Size(179, 26);
             this.distanceToolStripMenuItem.Text = "Select training";
             // 
             // distanceTraining
@@ -269,7 +260,7 @@ namespace FietsClient
             // stopTrainingToolStripMenuItem
             // 
             this.stopTrainingToolStripMenuItem.Name = "stopTrainingToolStripMenuItem";
-            this.stopTrainingToolStripMenuItem.Size = new System.Drawing.Size(181, 26);
+            this.stopTrainingToolStripMenuItem.Size = new System.Drawing.Size(179, 26);
             this.stopTrainingToolStripMenuItem.Text = "Reset training";
             this.stopTrainingToolStripMenuItem.Click += new System.EventHandler(this.stopTrainingToolStripMenuItem_Click);
             // 
@@ -279,7 +270,7 @@ namespace FietsClient
             this.powerBox,
             this.setPower});
             this.setToolStripMenuItem.Name = "setToolStripMenuItem";
-            this.setToolStripMenuItem.Size = new System.Drawing.Size(181, 26);
+            this.setToolStripMenuItem.Size = new System.Drawing.Size(179, 26);
             this.setToolStripMenuItem.Text = "Power";
             // 
             // powerBox
@@ -300,7 +291,7 @@ namespace FietsClient
             this.toolStripTextBox3,
             this.toolStripMenuItem1});
             this.energyBox.Name = "energyBox";
-            this.energyBox.Size = new System.Drawing.Size(181, 26);
+            this.energyBox.Size = new System.Drawing.Size(179, 26);
             this.energyBox.Text = "Energy";
             // 
             // toolStripTextBox3
@@ -328,19 +319,19 @@ namespace FietsClient
             // 
             // speedChart
             // 
-            chartArea4.Name = "ChartArea1";
-            this.speedChart.ChartAreas.Add(chartArea4);
+            chartArea1.Name = "ChartArea1";
+            this.speedChart.ChartAreas.Add(chartArea1);
             this.speedChart.Location = new System.Drawing.Point(8, 23);
             this.speedChart.Margin = new System.Windows.Forms.Padding(4);
             this.speedChart.Name = "speedChart";
-            series4.BorderWidth = 10;
-            series4.ChartArea = "ChartArea1";
-            series4.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
-            series4.Name = "Speed";
-            series4.XValueMember = "Time";
-            series4.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Time;
-            series4.YValueMembers = "Speed";
-            this.speedChart.Series.Add(series4);
+            series1.BorderWidth = 10;
+            series1.ChartArea = "ChartArea1";
+            series1.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
+            series1.Name = "Speed";
+            series1.XValueMember = "Time";
+            series1.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Time;
+            series1.YValueMembers = "Speed";
+            this.speedChart.Series.Add(series1);
             this.speedChart.Size = new System.Drawing.Size(517, 351);
             this.speedChart.TabIndex = 0;
             this.speedChart.Text = "Speed chart";
@@ -359,19 +350,19 @@ namespace FietsClient
             // 
             // bpmChart
             // 
-            chartArea5.Name = "ChartArea1";
-            this.bpmChart.ChartAreas.Add(chartArea5);
+            chartArea2.Name = "ChartArea1";
+            this.bpmChart.ChartAreas.Add(chartArea2);
             this.bpmChart.Location = new System.Drawing.Point(8, 23);
             this.bpmChart.Margin = new System.Windows.Forms.Padding(4);
             this.bpmChart.Name = "bpmChart";
-            series5.BorderWidth = 10;
-            series5.ChartArea = "ChartArea1";
-            series5.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
-            series5.Name = "Beats per minute";
-            series5.XValueMember = "Time";
-            series5.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Time;
-            series5.YValueMembers = "Beats per minutes";
-            this.bpmChart.Series.Add(series5);
+            series2.BorderWidth = 10;
+            series2.ChartArea = "ChartArea1";
+            series2.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
+            series2.Name = "Beats per minute";
+            series2.XValueMember = "Time";
+            series2.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Time;
+            series2.YValueMembers = "Beats per minutes";
+            this.bpmChart.Series.Add(series2);
             this.bpmChart.Size = new System.Drawing.Size(517, 351);
             this.bpmChart.TabIndex = 1;
             this.bpmChart.Text = "beats per second";
@@ -699,19 +690,19 @@ namespace FietsClient
             // 
             // rpmChart
             // 
-            chartArea6.Name = "ChartArea1";
-            this.rpmChart.ChartAreas.Add(chartArea6);
+            chartArea3.Name = "ChartArea1";
+            this.rpmChart.ChartAreas.Add(chartArea3);
             this.rpmChart.Location = new System.Drawing.Point(8, 23);
             this.rpmChart.Margin = new System.Windows.Forms.Padding(4);
             this.rpmChart.Name = "rpmChart";
-            series6.BorderWidth = 10;
-            series6.ChartArea = "ChartArea1";
-            series6.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
-            series6.Name = "Rounds per minute";
-            series6.XValueMember = "Time";
-            series6.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Time;
-            series6.YValueMembers = "Rounds per minutes";
-            this.rpmChart.Series.Add(series6);
+            series3.BorderWidth = 10;
+            series3.ChartArea = "ChartArea1";
+            series3.ChartType = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Line;
+            series3.Name = "Rounds per minute";
+            series3.XValueMember = "Time";
+            series3.XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Time;
+            series3.YValueMembers = "Rounds per minutes";
+            this.rpmChart.Series.Add(series3);
             this.rpmChart.Size = new System.Drawing.Size(517, 351);
             this.rpmChart.TabIndex = 2;
             this.rpmChart.Text = "rounds per minute";
@@ -799,7 +790,6 @@ namespace FietsClient
         private System.Windows.Forms.MenuStrip menuStrip1;
         private System.Windows.Forms.ToolStripMenuItem archiefToolStripMenuItem;
         private System.Windows.Forms.ToolStripMenuItem selectSessionToolStripMenuItem;
-        private System.Windows.Forms.ToolStripMenuItem sESSIONSToolStripMenuItem;
         private System.Windows.Forms.GroupBox speedBox;
         private System.Windows.Forms.GroupBox bpmBox;
         private System.Windows.Forms.GroupBox sessionInfoBox;

+ 3 - 3
Proftaak Remote Healthcare/FietsClientV2/PatientModel.cs

@@ -62,9 +62,9 @@ namespace FietsClient
             }
         }
         //event handler
-        private List<DataPoint> speedPoints = new List<DataPoint>();
-        private List<DataPoint> bpmPoints = new List<DataPoint>();
-        private List<DataPoint> rpmPoints = new List<DataPoint>();
+        public List<DataPoint> speedPoints { get; set; } = new List<DataPoint>();
+        public List<DataPoint> bpmPoints { get; set; } = new List<DataPoint>();
+        public List<DataPoint> rpmPoints { set; get; } = new List<DataPoint>();
         private void HandleBikeData(string[] data)
         {
             if (patientform.InvokeRequired)

+ 34 - 23
Proftaak Remote Healthcare/FietsClientV2/TCPConnection.cs

@@ -16,7 +16,7 @@ namespace FietsClient
         public bool isConnectedFlag { private set; get; }
         private NetworkStream serverStream;
         public CurrentData currentData { private set; get; }
-        private string userID;
+        public string userID { private set; get; }
         private Thread receiveThread;
 
         public delegate void ChatmassegeDelegate(string[] data);
@@ -78,29 +78,18 @@ namespace FietsClient
                         case "0":   //login and display correct window after login
                             if (response_parts.Length == 4)
                             {
+                                SendGet(1);
+
                                 if (response_parts[1] == "1" && response_parts[2] == "1")
                                 {
-                                    
-                                    Form activeForm = Form.ActiveForm;
-                                    activeForm.Invoke((MethodInvoker)delegate ()
-                                    {
-                                        DoctorForm doctorForm = new DoctorForm(this);
-					activeForm.Hide();
-                                        doctorForm.Show();
-                                    });
                                     currentData = new CurrentData(userID);
+                                    currentData.isDoctor = true;
                                 }
                                 else if (response_parts[2] == "0" && response_parts[1] == "1")
                                 {
-                                    
-                                    Form activeForm = Form.ActiveForm;
-                                    activeForm.Invoke((MethodInvoker)delegate ()
-                                    {
-                                        PatientForm patientForm = new PatientForm(this);
-                                        activeForm.Hide();
-                                        patientForm.Show();
-                                    });
+
                                     currentData = new CurrentData(userID);
+                                    currentData.isDoctor = false;
                                 }
                                 else
                                     new Login("Geen gebruiker gevonden");
@@ -108,6 +97,28 @@ namespace FietsClient
                             break;
                         case "1":
                             currentData.setSessionList(JsonConvert.DeserializeObject<List<Session>>(response_parts[1]));
+
+                            if (currentData.isDoctor == true)
+                            {
+                                Form activeForm = Form.ActiveForm;
+                                activeForm.Invoke((MethodInvoker) delegate()
+                                {
+                                    DoctorForm doctorForm = new DoctorForm(this);
+                                    activeForm.Hide();
+                                    doctorForm.Show();
+                                });
+                            }
+                            else
+                            {
+                                Form activeForm = Form.ActiveForm;
+                                activeForm.Invoke((MethodInvoker)delegate ()
+                                {
+                                    PatientForm patientForm = new PatientForm(this);
+                                    activeForm.Hide();
+                                    patientForm.Show();
+                                });
+                            }
+
                             break;
                         case "2":
                             currentData.GetSessions().Last().AddMeasurement(JsonConvert.DeserializeObject<Measurement>(response_parts[1]));
@@ -131,19 +142,19 @@ namespace FietsClient
         public void SendGet(int GetWhat)
         {
             // send command ( cmdID | username )
-            SendString(GetWhat + "|" + userID);
+            SendString(GetWhat + "|" + userID + "|");
         }
 
         public void SendNewSession()
         {
             // send command ( cmdID | username )
-            SendString("3|" + userID + lib.JsonConverter.SerializeSession(currentData.GetSessions().Last()));
+            SendString("3|" + userID + lib.JsonConverter.SerializeSession(currentData.GetSessions().Last()) + "|");
         }
 
         public void SendNewMeasurement()
         {
             // send command ( cmdID | username )
-            SendString("5|" + userID + lib.JsonConverter.SerializeLastMeasurement(currentData.GetSessions().Last().GetLastMeasurement()));
+            SendString("5|" + userID + lib.JsonConverter.SerializeLastMeasurement(currentData.GetSessions().Last().GetLastMeasurement()) + "|");
         }
 	
 	public void SendChatMessage(string[] data)
@@ -165,17 +176,17 @@ namespace FietsClient
 
 	public void SendDistance(int distance)
         {
-            SendString("10|" + userID + "|" + distance);
+            SendString("10|" + userID + "|" + distance + "|");
         }
 	
 	public void SendTime(int Minutes, int seconds)
         {
-            SendString("11|" + userID + "|" + Minutes + ":" + seconds);
+            SendString("11|" + userID + "|" + Minutes + ":" + seconds + "|");
         }
 
         public void SendPower(int power)
         {
-            SendString("12|" + userID + "|" + power);
+            SendString("12|" + userID + "|" + power + "|");
         }
 	
 	    public void SendString(string s)

+ 4 - 0
Proftaak Remote Healthcare/FietsSimulator/packages.config

@@ -0,0 +1,4 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="Newtonsoft.Json" version="7.0.1" targetFramework="net452" />
+</packages>

+ 26 - 9
Proftaak Remote Healthcare/Server/AppGlobal.cs

@@ -13,6 +13,8 @@ namespace Server
         private static AppGlobal _instance;
 
         private List<User> users;
+        private List<User> activePatient;
+        private List<User> activeDoctor;
         public List<Client> Clients;
 
         public static AppGlobal Instance
@@ -20,20 +22,30 @@ namespace Server
             get { return _instance ?? (_instance = new AppGlobal()); }
         }
 
-        public AppGlobal() 
+        public AppGlobal()
         {
             users = new List<User>();
             Clients = new List<Client>();
+            TestMethode();
+            Console.WriteLine(JsonConverter.GetUserSessions(users.ElementAt(1)));
+        }
+
+        private void TestMethode()
+        {
             users.Add(new User("no", "no", 0, false, 0));
             users.Add(new User("JK123", "jancoow", 5, true, 100));
             users.Add(new User("TOM", "tommie", 80, false, 77, true));
 
-            users.ElementAt(1).tests.Add(new Session(1, "100"));
-            users.ElementAt(1).tests.Add(new Session(2, "110"));
-            users.ElementAt(0).tests.Add(new Session(3, "230"));
-            users.ElementAt(2).tests.Add(new Session(4, "300"));
+            Random r = new Random();
+            Session session = new Session(1, "100");
+            for (int i = 0; i < 100; i++)
+                session.AddMeasurement(new Measurement(r.Next(100, 200), r.Next(60, 100), r.Next(100, 150), r.Next(0, 100), i, r.Next(100), r.Next(100), r.Next(100), i, r.Next(100)));
+            users.ElementAt(1).tests.Add(session);
 
-            Console.WriteLine(JsonConverter.GetUserSessions(users.ElementAt(1)));
+            Session session2 = new Session(2, "100");
+            for (int i = 0; i < 200; i++)
+                session2.AddMeasurement(new Measurement(r.Next(100, 200), r.Next(60, 100), r.Next(100, 150), r.Next(0, 100), i, r.Next(100), r.Next(100), r.Next(100), i, r.Next(100)));
+            users.ElementAt(1).tests.Add(session2);
         }
 
         public void CheckLogin(string username, string password, out int admin, out int id)
@@ -42,10 +54,15 @@ namespace Server
             admin = 0;
             foreach (User u in users)
             {
-                if(u.id == username && u.password == password)
+                if (u.id == username && u.password == password)
                 {
                     admin = u.isDoctor ? 1 : 0;
                     id = users.IndexOf(u);
+                    /* if (u.isDoctor)
+                     {
+                         activeDoctor.Add(u);
+                     }
+                     activePatient.Add(u);*/
                 }
             }
         }
@@ -53,7 +70,7 @@ namespace Server
         public List<User> GetUsers()
         {
             return users;
-        } 
+        }
 
         public List<Session> GetTests(string patientid)
         {
@@ -74,7 +91,7 @@ namespace Server
             {
                 if (u.id == patientid)
                 {
-                    u.AddSession(new Session( mode, modevalue ));
+                    u.AddSession(new Session(mode, modevalue));
                 }
             }
 

+ 1 - 1
Proftaak Remote Healthcare/Server/FileIO/JsonConverter.cs

@@ -13,7 +13,7 @@ namespace Server.FileIO
     {
         public static void SaveUser(User u)
         {
-            File.WriteAllText(Environment.CurrentDirectory + "\\" + u.id + ".json", GetUser(u));
+            File.WriteAllText(@"../../JSONObjecten/JSON Files/" + u.id + ".json", GetUser(u));
         }
 
         public static string GetUser(User u)

+ 1 - 7
Proftaak Remote Healthcare/Server/JSONObjecten/Session.cs

@@ -21,20 +21,14 @@ namespace Server.JSONObjecten
         public string note { get; private set; }
         public string modevalue { get; private set; }
 
-        public Session( int bikeMode, string modevalue )
+        public Session(int bikeMode, string modevalue)
         {
             string[] fileEntries = Directory.GetFiles(@"../../JSONObjecten/JSON Files/");
 
             if (fileEntries.Length > 0)
-            {
                 this.id = int.Parse(fileEntries[fileEntries.Length]);
-            }
             else
-            {
                 this.id = 1;
-            }
-
-
 
             this.session = new List<Measurement>();
             this.isActive = true;