Advertisement
Guest User

Untitled

a guest
Nov 14th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Text;
  4.  
  5. namespace Getting_Real
  6. {
  7. public class Praticecalender
  8. {
  9. private List<Practice> listpractices = new List<Practice>();
  10.  
  11. public Practice GetPractice(DateTime date, string ageGroup)
  12. {
  13.  
  14. Practice closestdate = null;
  15. long min = Math.Abs(date.Ticks - listpractices[0].Date.Ticks);
  16. long diff;
  17. foreach (var item in listpractices)
  18. {
  19. diff = Math.Abs(date.Ticks - item.Date.Ticks);
  20. if (diff < min && item.AgeGroup == ageGroup)
  21. {
  22. min = diff;
  23. closestdate = item;
  24. }
  25. }
  26.  
  27. return closestdate;
  28. }
  29.  
  30. public void MakePractice()
  31. {
  32. listpractices.Add(); //funktionen skal modtage en practice, men funktionen er ikke færdig
  33. }
  34.  
  35. public void UpdPractice(DateTime date, string agegroup)
  36. {
  37. throw new System.NotImplementedException();
  38. }
  39.  
  40. public void PrintAll()
  41. {
  42. foreach (var item in listpractices)
  43. {
  44. Console.WriteLine("Aldersgruppe = {0}",item.AgeGroup);
  45. Console.WriteLine("Træner = {0}",item.CoachName);
  46. Console.WriteLine("Dato = {0}",item.Date);
  47. Console.WriteLine("Trænings længde = {0}",item.Duration);
  48. Console.WriteLine("Træningssted = {0}",item.Location);
  49. Console.WriteLine("Træningsstart = {0}",item.StartTime);
  50. Console.WriteLine("Træningsslut = {0}",item.StopTime);
  51.  
  52. }
  53. }
  54.  
  55. public void RemPractice(DateTime time, string ageGroup)
  56. {
  57. throw new System.NotImplementedException();
  58. }
  59. }
  60. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement