AppGlobal.cs 1.3 KB

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