Quellcode durchsuchen

JSON Objecten(Measurement, Session, User)

RD125632 vor 10 Jahren
Ursprung
Commit
c2c81f08dc

+ 27 - 0
Proftaak Remote Healthcare/Server/JSONObjecten/Measurement.cs

@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Server.JSONObjecten
+{
+    class Measurement
+    {
+        public int rpm { get; private set; }
+        public int wattage { get; private set; }
+        public int distance { get; private set; }
+        public DateTime date { get; private set; }
+        public int bpm { get; private set; }
+
+        public Measurement (int rpm, int wattage, int distance, int bpm)
+        {
+            this.rpm = rpm;
+            this.wattage = wattage;
+            this.distance = distance;
+            this.bpm = bpm;
+            this.date = DateTime.Now;
+        }
+
+    }
+}

+ 34 - 0
Proftaak Remote Healthcare/Server/JSONObjecten/Session.cs

@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Linq;
+using System.Security.Cryptography.X509Certificates;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Server.JSONObjecten
+{
+    class Session
+    {
+        public int id { get; private set; }
+        public List<Measurement> session { get; private set; }
+        public bool isActive { get; private set; }
+        public int deviceID { get; private set; }
+        public int bikeMode { get; private set; }
+        public DateTime date { get; private set; }
+        public string note { get; private set; }
+
+        public Session( int deviceid, int bikeMode  )
+        {
+            string[] fileEntries = Directory.GetFiles("JSONObjecten/JSON Files/");
+            this.id = int.Parse(fileEntries[fileEntries.Length]);
+            this.session = new List<Measurement>();
+            this.isActive = true;
+            this.deviceID = deviceid;
+            this.bikeMode = bikeMode;
+            this.date = DateTime.Now;
+            this.note = "";
+        }
+
+    }
+}

+ 45 - 0
Proftaak Remote Healthcare/Server/JSONObjecten/User.cs

@@ -0,0 +1,45 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Server.JSONObjecten;
+
+namespace Server
+{
+    class User
+    {
+        public string id { get; private set; }
+        public string password { get; private set; }
+        public List<Session> tests { get; private set; }
+        public int age { get; private set; }
+        public bool gender { get; private set; }
+        public int weight { get; private set; }
+
+        public bool isDoctor { get; private set; }
+
+        //Create Patient
+        public User(string id, string password, int age, bool gender, int weight)
+        {
+            this.id = id;
+            this.password = password;
+            this.tests = new List<Session>();
+            this.age = age;
+            this.gender = gender;
+            this.weight = weight;
+            this.isDoctor = false;
+        }
+
+        //Create Patient or Doctor
+        public User(string id, string password, int age, bool gender, int weight, bool isDoctor)
+        {
+            this.id = id;
+            this.password = password;
+            this.tests = new List<Session>();
+            this.age = age;
+            this.gender = gender;
+            this.weight = weight;
+            this.isDoctor = isDoctor;
+        }
+    }
+}

+ 0 - 24
Proftaak Remote Healthcare/Server/User.cs

@@ -1,24 +0,0 @@
-using System;
-using System.Collections.Generic;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-
-namespace Server
-{
-    class User
-    {
-        public string name { get; private set; }
-        public string username { get; private set; }
-        public string password { get; private set; }
-        public bool admin { get; private set; }
-
-        public User(string name, string username, string password, bool admin)
-        {
-            this.name = name;
-            this.username = username;
-            this.password = password;
-            this.admin = admin;
-        }
-    }
-}