/// <summary> /// Load the table with all events data /// </summary> private void AddDataToTable() { IAgenda agenda = new CAgenda(); DisplayEventsForm displayEvents = new DisplayEventsForm(); DateTime date = DeleteDatePicker.Value; var availableEvents = agenda.GetEvents(date.Date, "all"); if (availableEvents != null) { for (int i = 0; i < availableEvents.Count; i++) { dataGridViewDelete.Rows.Add( new object[] { availableEvents[i].Id, availableEvents[i].Name, displayEvents.ConvertDateFormat(availableEvents[i].Date.Value), displayEvents.ConvertTimeFormat(availableEvents[i].Time.Value), availableEvents[i].Description } ); } } }
/// <summary> /// Display the events from the Database based on a Day/Week/All user choice /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void DisplayButton_Click(object sender, EventArgs e) { IAgenda agenda = new CAgenda(); DateTime date = dateTimePicker.Value; string intervalChoice = GetUserChoice(); var availableEvents = agenda.GetEvents(date.Date, intervalChoice); ReloadWindow(); if (availableEvents != null) { for (int i = 0; i < availableEvents.Count; i++) { dataGridViewDisplay.Rows.Add( new object[] { availableEvents[i].Id, availableEvents[i].Name, ConvertDateFormat(availableEvents[i].Date.Value), ConvertTimeFormat(availableEvents[i].Time.Value), availableEvents[i].Description } ); } } }