AppGlobal.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. using System.Collections.Generic;
  2. using System.Threading;
  3. using System.Threading.Tasks;
  4. using System;
  5. using Server.JSONObjecten;
  6. namespace Server
  7. {
  8. public class AppGlobal
  9. {
  10. private static AppGlobal _instance;
  11. private List<User> users;
  12. public static AppGlobal Instance
  13. {
  14. get { return _instance ?? (_instance = new AppGlobal()); }
  15. }
  16. public AppGlobal()
  17. {
  18. users = new List<User>();
  19. users.Add(new User("no", "no", 0, false, 0));
  20. users.Add(new User("JK123", "jancoow", 5, true, 100));
  21. users.Add(new User("TOM", "tommie", 80, false, 77, true));
  22. }
  23. public void CheckLogin(string username, string password, out int admin, out int id)
  24. {
  25. id = -1;
  26. admin = 0;
  27. foreach (User u in users)
  28. {
  29. if(u.id == username && u.password == password)
  30. {
  31. admin = u.isDoctor ? 1 : 0;
  32. id = users.IndexOf(u);
  33. }
  34. }
  35. }
  36. public List<Session> GetTests(string patientid)
  37. {
  38. foreach (User u in users)
  39. {
  40. if (u.id == patientid)
  41. {
  42. return u.tests;
  43. }
  44. }
  45. return null;
  46. }
  47. }
  48. }