예제 #1
0
 // loading template events for different days
 private void WeekdayCombobox_SelectedIndexChanged(object sender, EventArgs e)
 {
     DisplayData = OrganizerLibrary.GlobalConfig.Connections[0].GetTemplateEvents(WeekdayCombobox.Text);
     DisplayData.Add(new EventModel());
     ScheduleView.DataSource = DisplayData;
     ScheduleView.Refresh();
 }
예제 #2
0
        private void EditEventButton_Click(object sender, EventArgs e)
        {
            // editing the chosen event with new data taken from form controls

            // start time
            DisplayData[activeRow].StartTime = new DateTime(
                ninetyNine.Year,
                ninetyNine.Month,
                ninetyNine.Day,
                StartTimePicker.Value.Hour,
                StartTimePicker.Value.Minute,
                StartTimePicker.Value.Second);
            // end time
            DisplayData[activeRow].EndTime = new DateTime(
                ninetyNine.Year,
                ninetyNine.Month,
                ninetyNine.Day,
                EndTimePicker.Value.Hour,
                EndTimePicker.Value.Minute,
                EndTimePicker.Value.Second);
            // event type name
            DisplayData[activeRow].EventTypeName = EventBox.Text;
            // event type id
            DisplayData[activeRow].EventTypeId = EventDisplayData[EventBox.SelectedIndex].EventTypeId;
            // update event in the database
            OrganizerLibrary.GlobalConfig.Connections[0].UpdateTemplateEvent(DisplayData[activeRow]);

            ScheduleView.Refresh();
        }
예제 #3
0
        // adding new event
        private void AddEventButton_Click(object sender, EventArgs e)
        {
            // initializng var
            var NewEvent = new EventModel();

            // editing the new event with new data taken from form controls

            // commentary
            NewEvent.Comment = CommentaryBox.Text;

            // start time
            NewEvent.StartTime = new DateTime(
                datePicker.Value.Year,
                datePicker.Value.Month,
                datePicker.Value.Day,
                StartTimePicker.Value.Hour,
                StartTimePicker.Value.Minute,
                StartTimePicker.Value.Second);
            // end time
            NewEvent.EndTime = new DateTime(
                datePicker.Value.Year,
                datePicker.Value.Month,
                datePicker.Value.Day,
                EndTimePicker.Value.Hour,
                EndTimePicker.Value.Minute,
                EndTimePicker.Value.Second);
            // event type name
            NewEvent.EventTypeName = EventBox.Text;
            // event type id
            NewEvent.EventTypeId = EventDisplayData[EventBox.SelectedIndex].EventTypeId;
            // create event in the database and return the id assigned to it when inserting
            NewEvent = OrganizerLibrary.GlobalConfig.Connections[0].CreateEvent(NewEvent);
            // removes empty row
            DisplayData.Remove(DisplayData[DisplayData.Count - 1]);
            // add new event to the displayed events
            DisplayData.Add(NewEvent);
            // adds empty row
            DisplayData.Add(new EventModel());
            ScheduleView.Refresh();
            // TODO - add sorting by time, so that the new event takes its place in the table according to the start time
        }
예제 #4
0
        // editing current row
        private void EditEventButton_Click(object sender, EventArgs e)
        {
            // editing the chosen event with new data taken from form controls

            // commentary
            DisplayData[activeRow].Comment = CommentaryBox.Text;

            // start time
            DisplayData[activeRow].StartTime = new DateTime(
                datePicker.Value.Year,
                datePicker.Value.Month,
                datePicker.Value.Day,
                StartTimePicker.Value.Hour,
                StartTimePicker.Value.Minute,
                StartTimePicker.Value.Second);
            // end time
            DisplayData[activeRow].EndTime = new DateTime(
                datePicker.Value.Year,
                datePicker.Value.Month,
                datePicker.Value.Day,
                EndTimePicker.Value.Hour,
                EndTimePicker.Value.Minute,
                EndTimePicker.Value.Second);
            // event type name
            DisplayData[activeRow].EventTypeName = EventBox.Text;
            // event type id
            DisplayData[activeRow].EventTypeId = EventDisplayData[EventBox.SelectedIndex].EventTypeId;
            // update event in the database
            OrganizerLibrary.GlobalConfig.Connections[0].UpdateEvent(DisplayData[activeRow]);

            ScheduleView.Refresh();
            // TODO - add sorting by time, so that the edited event takes its place in the table according to the start time in case starting time was changed

            // TODO - add error handling for when a user tries to edit the empty row

            // TODO - add error handling for when a user tries to set end time before start time
        }
예제 #5
0
 // removing selected event from agenda
 private void DeleteSelectedButton_Click(object sender, EventArgs e)
 {
     OrganizerLibrary.GlobalConfig.Connections[0].DeleteEvent(DisplayData[activeRow]);
     DisplayData.Remove(DisplayData[activeRow]);
     ScheduleView.Refresh();
 }