Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Text;
- namespace Getting_Real
- {
- public class Praticecalender
- {
- private List<Practice> listpractices = new List<Practice>();
- public Practice GetPractice(DateTime date, string ageGroup)
- {
- Practice closestdate = null;
- long min = Math.Abs(date.Ticks - listpractices[0].Date.Ticks);
- long diff;
- foreach (var item in listpractices)
- {
- diff = Math.Abs(date.Ticks - item.Date.Ticks);
- if (diff < min && item.AgeGroup == ageGroup)
- {
- min = diff;
- closestdate = item;
- }
- }
- return closestdate;
- }
- public void MakePractice()
- {
- listpractices.Add(); //funktionen skal modtage en practice, men funktionen er ikke færdig
- }
- public void UpdPractice(DateTime date, string agegroup)
- {
- throw new System.NotImplementedException();
- }
- public void PrintAll()
- {
- foreach (var item in listpractices)
- {
- Console.WriteLine("Aldersgruppe = {0}",item.AgeGroup);
- Console.WriteLine("Træner = {0}",item.CoachName);
- Console.WriteLine("Dato = {0}",item.Date);
- Console.WriteLine("Trænings længde = {0}",item.Duration);
- Console.WriteLine("Træningssted = {0}",item.Location);
- Console.WriteLine("Træningsstart = {0}",item.StartTime);
- Console.WriteLine("Træningsslut = {0}",item.StopTime);
- }
- }
- public void RemPractice(DateTime time, string ageGroup)
- {
- throw new System.NotImplementedException();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement