فهرست منبع

Login

Een loginswitch gemaakt die ook bijhoudt of een docter of een patient is
ingelogd.
Tom Remeeus 10 سال پیش
والد
کامیت
69cabf1727
2فایلهای تغییر یافته به همراه45 افزوده شده و 6 حذف شده
  1. 5 5
      Proftaak Remote Healthcare/Proftaak Remote Healthcare.sln
  2. 40 1
      Proftaak Remote Healthcare/Server/Program.cs

+ 5 - 5
Proftaak Remote Healthcare/Proftaak Remote Healthcare.sln

@@ -7,7 +7,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Fietsclient", "Fietsclient\
 EndProject
 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "FietsSimulator", "FietsSimulator\FietsSimulator.csproj", "{4FF5A179-C048-4833-AD7C-568FF05C66C5}"
 EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Opslag demo", "Opslag demo\Opslag demo.csproj", "{D4D15FC6-D86A-488C-9AEC-A006B98A1D2F}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Server", "Server\Server.csproj", "{06C35F7A-BA2D-4F7D-8F8E-39636027707B}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -23,10 +23,10 @@ Global
 		{4FF5A179-C048-4833-AD7C-568FF05C66C5}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{4FF5A179-C048-4833-AD7C-568FF05C66C5}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{4FF5A179-C048-4833-AD7C-568FF05C66C5}.Release|Any CPU.Build.0 = Release|Any CPU
-		{D4D15FC6-D86A-488C-9AEC-A006B98A1D2F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{D4D15FC6-D86A-488C-9AEC-A006B98A1D2F}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{D4D15FC6-D86A-488C-9AEC-A006B98A1D2F}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{D4D15FC6-D86A-488C-9AEC-A006B98A1D2F}.Release|Any CPU.Build.0 = Release|Any CPU
+		{06C35F7A-BA2D-4F7D-8F8E-39636027707B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{06C35F7A-BA2D-4F7D-8F8E-39636027707B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{06C35F7A-BA2D-4F7D-8F8E-39636027707B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{06C35F7A-BA2D-4F7D-8F8E-39636027707B}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 40 - 1
Proftaak Remote Healthcare/Server/Program.cs

@@ -30,6 +30,8 @@ namespace Server
     {
         TcpClient client;
         NetworkStream networkStream;
+        private String response;
+
         public Client(TcpClient socket)
         {
             client = socket;
@@ -45,7 +47,7 @@ namespace Server
             {
                 byte[] bytesFrom = new byte[(int)client.ReceiveBufferSize];
                 networkStream.Read(bytesFrom, 0, (int)client.ReceiveBufferSize);
-                String response = Encoding.ASCII.GetString(bytesFrom);
+                response = Encoding.ASCII.GetString(bytesFrom);
                 //Hier moet wat met de response gedaan worden.
             }
         }
@@ -55,5 +57,42 @@ namespace Server
             networkStream.Write(b, 0, b.Length);
             networkStream.Flush();
         }
+
+        public Boolean LoginClient(String username, String password, out String GUI_switch)
+        {
+            GUI_switch = null;
+            Boolean signed_in = false;  
+            String ip = "192.168.1.1"; //log maar in op die kutrouter van je HERPADERP
+            int port = 0;
+
+            try
+            {
+               client.Connect(ip, port);
+            } catch (Exception e)
+            {
+                Console.WriteLine("Error: " + e.Message);
+            }
+
+            if (client.Connected)
+            {
+                String sendData = "0|" + username + "|" + password;
+                sendString(sendData);
+
+                receive();
+
+                if (response == "0|1|1")
+                {
+                    signed_in = true;
+                    GUI_switch = "docter";
+                }
+                if (response == "0|1|0")
+                {
+                    signed_in = true;
+                    GUI_switch = "patient";
+                }
+            }
+
+            return signed_in;
+        }
     }
 }