public CompanyWindow(Company company) { InitializeComponent(); this.company = company; singleBookingsHandler = new SingleBookingsHandler(); ongoingBookingsHandler = new OngoingBookingsHandler(); activitiesHandler = new ActivitiesHandler(); openingHoursHandler = new OpeningHoursHandler(); cboActivityOngoingBooking.ItemsSource = activitiesHandler.GetAllActivities().Select(a => a.Name); cboActivitySingleBooking.ItemsSource = activitiesHandler.GetAllActivities().Select(a => a.Name); int[] hours = new int[24] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24 }; cboOngoingBookingStartTimeFull.ItemsSource = hours; cboOngoingBookingEndTimeFull.ItemsSource = hours; cboSingleBookingStartTimeFull.ItemsSource = hours; cboSingleBookingEndTimeFull.ItemsSource = hours; String[] halfHours = new String[2] { "00", "30" }; cboOngoingBookingEndTimeHalf.ItemsSource = halfHours; cboOngoingBookingStartTimeHalf.ItemsSource = halfHours; cboSingleBookingEndTimeHalf.ItemsSource = halfHours; cboSingleBookingStartTimeHalf.ItemsSource = halfHours; dpSingleBooking.DisplayDateStart = DateTime.Now; dpOngoingBookingStartDate.DisplayDateStart = DateTime.Now; dpOngoingBookingEndDate.DisplayDateStart = DateTime.Now.AddDays(7); }
static void Main(string[] args) { ActivitiesHandler activitiesHandler = new ActivitiesHandler(); AdminHandler adminHandler = new AdminHandler(); ClosedDaysHandler closedDaysHandler = new ClosedDaysHandler(); CompanyHandler companyHandler = new CompanyHandler(); DBHandler dBHandler = new DBHandler(); HallHandler hallHandler = new HallHandler(); LoginHandler loginHandler = new LoginHandler(); OngoingBookingsHandler ongoingBookingsHandler = new OngoingBookingsHandler(); OpeningHoursHandler openingHoursHandler = new OpeningHoursHandler(); SectionsHandler sectionsHandler = new SectionsHandler(); SingleBookingsHandler singleBookingsHandler = new SingleBookingsHandler(); StatisticsHandler statisticsHandler = new StatisticsHandler(); Hall hall = new Hall() { Name = "Klarup Sportshal", Address = "Gammelvej 23, 6900 Ølby", AmountOfSections = 6 }; hallHandler.AddHall(hall); OpeningHour openingHourMonday = new OpeningHour() { NameOfDay = "Monday", OpeningTime = DateTime.ParseExact("00/01/01 9:00:00 AM", "yy/MM/dd h:mm:ss tt", CultureInfo.InvariantCulture), ClosingTime = DateTime.ParseExact("00/01/01 4:00:00 PM", "yy/MM/dd h:mm:ss tt", CultureInfo.InvariantCulture), HallId = 1 }; OpeningHour openingHourTuesday = new OpeningHour() { NameOfDay = "Tuesday", OpeningTime = DateTime.ParseExact("00/01/01 8:00:00 AM", "yy/MM/dd h:mm:ss tt", CultureInfo.InvariantCulture), ClosingTime = DateTime.ParseExact("00/01/01 4:00:00 PM", "yy/MM/dd h:mm:ss tt", CultureInfo.InvariantCulture), HallId = 1 }; OpeningHour openingHourWednesday = new OpeningHour() { NameOfDay = "Wednesday", OpeningTime = DateTime.ParseExact("00/01/01 5:00:00 AM", "yy/MM/dd h:mm:ss tt", CultureInfo.InvariantCulture), ClosingTime = DateTime.ParseExact("00/01/01 8:30:00 PM", "yy/MM/dd h:mm:ss tt", CultureInfo.InvariantCulture), HallId = 1 }; OpeningHour openingHourThursday = new OpeningHour() { NameOfDay = "Thursday", OpeningTime = DateTime.ParseExact("00/01/01 9:00:00 AM", "yy/MM/dd h:mm:ss tt", CultureInfo.InvariantCulture), ClosingTime = DateTime.ParseExact("00/01/01 4:00:00 PM", "yy/MM/dd h:mm:ss tt", CultureInfo.InvariantCulture), HallId = 1 }; OpeningHour openingHourFriday = new OpeningHour() { NameOfDay = "Friday", OpeningTime = DateTime.ParseExact("00/01/01 6:00:00 AM", "yy/MM/dd h:mm:ss tt", CultureInfo.InvariantCulture), ClosingTime = DateTime.ParseExact("00/01/01 3:00:00 PM", "yy/MM/dd h:mm:ss tt", CultureInfo.InvariantCulture), HallId = 1 }; OpeningHour openingHourSaturday = new OpeningHour() { NameOfDay = "Saturday", OpeningTime = DateTime.ParseExact("00/01/01 1:00:00 PM", "yy/MM/dd h:mm:ss tt", CultureInfo.InvariantCulture), ClosingTime = DateTime.ParseExact("00/01/01 10:00:00 PM", "yy/MM/dd h:mm:ss tt", CultureInfo.InvariantCulture), HallId = 1 }; OpeningHour openingHourSunday = new OpeningHour() { NameOfDay = "Sunday", OpeningTime = DateTime.ParseExact("00/01/01 5:00:00 AM", "yy/MM/dd h:mm:ss tt", CultureInfo.InvariantCulture), ClosingTime = DateTime.ParseExact("00/01/01 1:00:00 PM", "yy/MM/dd h:mm:ss tt", CultureInfo.InvariantCulture), HallId = 1 }; openingHoursHandler.AddOpeningHour(openingHourMonday); openingHoursHandler.AddOpeningHour(openingHourTuesday); openingHoursHandler.AddOpeningHour(openingHourWednesday); openingHoursHandler.AddOpeningHour(openingHourThursday); openingHoursHandler.AddOpeningHour(openingHourFriday); openingHoursHandler.AddOpeningHour(openingHourSaturday); openingHoursHandler.AddOpeningHour(openingHourSunday); Admin admin = new Admin() { Name = "Emil Lynge", Email = "*****@*****.**", Password = "******", HallId = 1 }; adminHandler.AddAdmin(admin); Activity activity = new Activity() { Name = "Håndboldtræning", SectionsRequired = 3, }; Activity activity2 = new Activity() { Name = "Håndboldkamp", SectionsRequired = 6, }; Activity activity3 = new Activity() { Name = "Badmintonbane", SectionsRequired = 1, }; Activity activity4 = new Activity() { Name = "Badmintonkamp", SectionsRequired = 3, }; Activity activity5 = new Activity() { Name = "Volleyballtræning", SectionsRequired = 3, }; Activity activity6 = new Activity() { Name = "Volleyballkamp", SectionsRequired = 3, }; Activity activity7 = new Activity() { Name = "Floorballtræning", SectionsRequired = 1, }; Activity activity8 = new Activity() { Name = "Floorballkamp", SectionsRequired = 3, }; activitiesHandler.AddActivity(activity); activitiesHandler.AddActivity(activity2); activitiesHandler.AddActivity(activity3); activitiesHandler.AddActivity(activity4); activitiesHandler.AddActivity(activity5); activitiesHandler.AddActivity(activity6); activitiesHandler.AddActivity(activity7); activitiesHandler.AddActivity(activity8); Console.ReadLine(); //Company company = new Company() //{ // Name = "AspIT", // Address = "Carl Gustavsgade 2, Høje Taastrup", // PhoneNumber = "22332244", // Email = "*****@*****.**", // Password = "******" //}; //Company company2 = new Company() //{ // Name = "FreelanceLynge", // Address = "Egegade 999, Kbh", // PhoneNumber = "23242526", // Email = "*****@*****.**", // Password = "******" //}; //companyHandler.AddCompany(company); //companyHandler.AddCompany(company2); }
static void Main(string[] args) { IEnumerable <SeasonSpan> seasonalSpans = new List <SeasonSpan>() { new SeasonSpan() { StartOfSeason = new DateTime(1, 1, 1), EndOfSeason = new DateTime(1, 3, 31), OpeningHours = new OpeningHours(new DateTime(1, 1, 1, 9, 0, 0), new DateTime(1, 1, 1, 15, 0, 0), new LunchBreak() { StartOfLunchBreak = new DateTime(1, 1, 1, 11, 0, 0), EndOfLunchBreak = new DateTime(1, 1, 1, 12, 0, 0) }) } , new SeasonSpan() { StartOfSeason = new DateTime(1, 4, 1), EndOfSeason = new DateTime(1, 8, 31), OpeningHours = new OpeningHours(new DateTime(1, 1, 1, 8, 0, 0), new DateTime(1, 1, 1, 17, 0, 0), null) }, new SeasonSpan() { StartOfSeason = new DateTime(1, 9, 1), EndOfSeason = new DateTime(1, 9, 30), OpeningHours = new OpeningHours() }, new SeasonSpan() { StartOfSeason = new DateTime(1, 10, 1), EndOfSeason = new DateTime(1, 12, 31), OpeningHours = new OpeningHours(new DateTime(1, 1, 1, 9, 0, 0), new DateTime(1, 1, 1, 12, 0, 0), null) }, }; IEnumerable <DailyRule> dailyRules = new List <DailyRule>() { new DailyRule() { DayOfRule = new DateTime(1, 1, 1), OpeningHours = new OpeningHours() }, new DailyRule() { DayOfRule = new DateTime(1, 5, 1), OpeningHours = new OpeningHours() }, new DailyRule() { DayOfRule = new DateTime(1, 5, 8), OpeningHours = new OpeningHours() }, new DailyRule() { DayOfRule = new DateTime(1, 7, 5), OpeningHours = new OpeningHours() }, new DailyRule() { DayOfRule = new DateTime(1, 7, 6), OpeningHours = new OpeningHours() }, new DailyRule() { DayOfRule = new DateTime(1, 9, 28), OpeningHours = new OpeningHours() }, new DailyRule() { DayOfRule = new DateTime(1, 10, 28), OpeningHours = new OpeningHours() }, new DailyRule() { DayOfRule = new DateTime(1, 11, 17), OpeningHours = new OpeningHours() }, new DailyRule() { DayOfRule = new DateTime(1, 12, 24), OpeningHours = new OpeningHours() }, new DailyRule() { DayOfRule = new DateTime(1, 12, 25), OpeningHours = new OpeningHours() }, new DailyRule() { DayOfRule = new DateTime(1, 12, 26), OpeningHours = new OpeningHours() } }; IEnumerable <WeekDayRule> weekDayRules = new List <WeekDayRule>() { new WeekDayRule() { DayOfRule = DayOfWeek.Sunday, OpeningHours = new OpeningHours() }, new WeekDayRule() { DayOfRule = DayOfWeek.Saturday, OpeningHours = new OpeningHours(new DateTime(1, 1, 1, 0, 0, 0), new DateTime(1, 1, 1, 12, 0, 0), null) } }; var openingHoursHandler = new OpeningHoursHandler(seasonalSpans, dailyRules, weekDayRules); Console.WriteLine("January to March"); Console.WriteLine(openingHoursHandler.OpeningHoursForGivenDate(new DateTime(1, 1, 1))); Console.WriteLine(openingHoursHandler.OpeningHoursForGivenDate(new DateTime(1, 1, 2))); Console.WriteLine(openingHoursHandler.OpeningHoursForGivenDate(new DateTime(1, 3, 31))); Console.WriteLine("\nApril to August"); Console.WriteLine(openingHoursHandler.OpeningHoursForGivenDate(new DateTime(1, 5, 8))); Console.WriteLine(openingHoursHandler.OpeningHoursForGivenDate(new DateTime(1, 4, 2))); Console.WriteLine("\nSeptember"); Console.WriteLine(openingHoursHandler.OpeningHoursForGivenDate(new DateTime(1, 9, 28))); Console.WriteLine(openingHoursHandler.OpeningHoursForGivenDate(new DateTime(1, 9, 1))); Console.WriteLine("\nOctober to December"); Console.WriteLine(openingHoursHandler.OpeningHoursForGivenDate(new DateTime(1, 10, 28))); Console.WriteLine(openingHoursHandler.OpeningHoursForGivenDate(new DateTime(1, 10, 1))); Console.WriteLine(openingHoursHandler.IsItOpen().ToString()); Console.ReadLine(); }