private void buttonSaveSchedule_Click(object sender, EventArgs e) { if (listViewWeek.Items.Count > 0) { string[][] LVData = ControlFunctions.obtainDataFromListView(listViewDay); DBData.deleteExistingSchedulesForInstructorsAndDate(labelDate.Text); insertNewSchedules(labelDate.Text, LVData); ControlFunctions.clearListViewReport(listViewWeek); createListViewWeekReport(); } else { MessageBox.Show("Please select first a date and plan a Schedule."); } }
//It saves the Schedule for the Week************************************take care with the confirmed ones from the Admin, dont delete them and dont write them again private void buttonSaveSchedule_Click(object sender, EventArgs e) { if (listViewWeek.Items.Count > 0) { //It obtains the new schedule from the Day ListView string[][] LVData = ControlFunctions.obtainDataFromListView(listViewWeek); //It deletes the schedules for that Date and Instructor in the DB DBData.deleteExistingSchedulesForInstructorAndDates(instructorUserName, firstDayOfWeek.ToString("d"), lastDayOfWeek.ToString("d")); //It inserts the new Schedules for that Date and instructor in the DB insertNewSchedulesForInstructor(instructorUserName, LVData); //It actualizes the Week ListView ControlFunctions.clearListViewReport(listViewWeek); createlistViewWeekReport(dateTimePickerWeek.Value); } else { MessageBox.Show("Please select first a date and plan a Schedule."); } }
//********************************************* Methods ************************************************************************ //It checks if here is any other reserved in the ListView private bool checkReservationDuplicity() { //It obtains the new schedule from the Day ListView string[][] LVData = ControlFunctions.obtainDataFromListView(listViewAppointmentSelection); bool duplicity = false; //It checks the data from the matrix coming from the ListView for (int i = 1; i < LVData.Length; i++) { for (int j = 0; j < LVData[0].Length; j++) { if (LVData[i][j] == slotReserved) { duplicity = true; break; } } } return(duplicity); }