public void SingleYearEvent(Event ev, CalendarEventDisplay calendarEvent, DateTime selectedDate, Label[] labelArray, EventDisplay display) { if (calendarEvent.DoesEventStartThisMonth() && calendarEvent.DoesEventEndThisMonth()) { if (calendarEvent.DoesEventStartAndEndToday()) { labelArray[ev.StartDate.Day - 1].Controls.Add(display.SetEventDisplay(ev)); } else { for (int i = (ev.StartDate.Day - 1); i < (ev.EndDate.Day); i++) { labelArray[i].Controls.Add(display.SetEventDisplay(ev)); } } } else if (calendarEvent.DoesEventStartThisMonth() && !calendarEvent.DoesEventEndThisMonth()) { for (int i = (ev.StartDate.Day - 1); i < labelArray.Length; i++) { labelArray[i].Controls.Add(display.SetEventDisplay(ev)); } } else if (!calendarEvent.DoesEventStartThisMonth() && calendarEvent.DoesEventEndThisMonth()) { for (int i = 0; i < (ev.EndDate.Day); i++) { labelArray[i].Controls.Add(display.SetEventDisplay(ev)); } } else if (calendarEvent.DoesEventLastTheEntireMonth()) { foreach (Label t in labelArray) { t.Controls.Add(display.SetEventDisplay(ev)); } } }
public void DisplayEventsOnHomePage(CalendarImporter calendarImportPage, DateTime date, Label[] homePageLabelArray, EventDisplay display) { calendarImportPage.GetHomePageEvents(date, date.AddDays(7)); _events = calendarImportPage.HomePageEvents; foreach (var ev in _events) { int i = FirstDayOfEvent(ev.StartDate, date); homePageLabelArray[i].Controls.Add(display.SetEventDisplay(ev)); if (ev.EndDate < (date.AddDays(6))) { int span = ev.EndDate.DayOfYear - ev.StartDate.DayOfYear + 2; for (int j = i + 1; j < ((i + span) - 1); j++) { homePageLabelArray[j].Controls.Add(display.SetEventDisplay(ev)); } } else if (ev.EndDate >= (date.AddDays(6))) { for (int j = i + 1; j < (homePageLabelArray.Length); j++) { homePageLabelArray[j].Controls.Add(display.SetEventDisplay(ev)); } } } }
public void DisplayEventsInCalendar(List <Event> events, DateTime selectedDate, Label[] labelArray, EventDisplay display) { foreach (Event ev in events) { CalendarEventDisplay calendarEvent = new CalendarEventDisplay(ev, selectedDate); if ((calendarEvent.DoesEventStartThisYear() && !calendarEvent.DoesEventEndThisYear()) || (!calendarEvent.DoesEventStartThisYear() && calendarEvent.DoesEventEndThisYear())) { MultiYearEvent(ev, calendarEvent, selectedDate, labelArray, display); } else if (calendarEvent.DoesEventStartThisYear() && calendarEvent.DoesEventEndThisYear()) { SingleYearEvent(ev, calendarEvent, selectedDate, labelArray, display); } } }