Exemplo n.º 1
0
        //It deletes the Appointment
        private void buttonDelete_Click(object sender, EventArgs e)
        {
            if (listViewAppointments.SelectedItems.Count > 0)
            {
                DialogResult clientDecision = MessageBox.Show("Are you sure you want to delete that Appointment?", "Appointment Deletion", MessageBoxButtons.YesNo);
                switch (clientDecision)
                {
                case DialogResult.Yes:
                    var myDate       = listViewAppointments.SelectedItems[0].Text;
                    var myTime       = listViewAppointments.SelectedItems[0].SubItems[1].Text;
                    var myInstructor = listViewAppointments.SelectedItems[0].SubItems[2].Text;
                    //It updates the DB freing the client
                    freeClientAppointment(myDate, myTime, myInstructor);
                    //It loads the Appointments for the Client
                    clientAppointments = getClientAppointments(userName, DateTime.Today);
                    //It refreshes the Appointments ListView
                    listViewAppointments.Items.Clear();
                    createListViewAppointmentsReport();
                    //It refreshes the Appointment Selection ListView
                    ControlFunctions.clearListViewReport(listViewAppointmentSelection);
                    createListViewAppointmentSelectionReport();
                    MessageBox.Show("Appointment deleted successfully.");
                    break;

                case DialogResult.No:
                    break;
                }
            }
            else
            {
                MessageBox.Show("Please select an Appointment first.");
            }
        }
Exemplo n.º 2
0
        //********************************************* Event Methods  *****************************************************************

        //It creates the ListView for the instructor to create his Schedule
        private void dateTimePickerWeek_ValueChanged(object sender, EventArgs e)
        {
            listViewWeek.Visible = true;
            //clearVariables();
            //It loads the Times of the selected Date
            timesOfDate = DBData.getTimesOfDay(dateTimePickerWeek.Value);
            //It creates the Day ListView
            ControlFunctions.clearListViewReport(listViewWeek);
            createlistViewWeekReport(dateTimePickerWeek.Value);
        }
Exemplo n.º 3
0
 private void listViewWeek_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (listViewWeek.SelectedIndices.Count != 0)
     {
         var myIndex      = listViewWeek.SelectedIndices[0];
         var dateSelected = listViewWeek.Items[myIndex].Text;
         if (myIndex < daysOfWeek)
         {
             labelDate.Text = dateSelected;
             ControlFunctions.clearListViewReport(listViewDay);
             createListViewDayReport(DateTime.Parse(dateSelected));
         }
     }
 }
Exemplo n.º 4
0
 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.");
     }
 }
Exemplo n.º 5
0
        //********************************************* Event Methods  *****************************************************************

        private void dateTimePickerDate_ValueChanged(object sender, EventArgs e)
        {
            //It loads the Times of the selected Date
            selectedDate = dateTimePickerDate.Value;
            timesOfDate  = DBData.getTimesOfDay(selectedDate);

            //It makes the ListViews visibles
            listViewAppointmentSelection.Visible = true;
            listViewAppointments.Visible         = true;
            //It creates the Appointment Selection ListView
            ControlFunctions.clearListViewReport(listViewAppointmentSelection);
            createListViewAppointmentSelectionReport();

            //It loads the Appointments for the Client
            clientAppointments = getClientAppointments(userName, DateTime.Today);
        }
Exemplo n.º 6
0
 //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.");
     }
 }
Exemplo n.º 7
0
 private void buttonSaveCar_Click(object sender, EventArgs e)
 {
     if (comboBoxInstructor.SelectedIndex != -1 && comboBoxCar.SelectedIndex != -1)
     {
         if (checkInstructorScheduled(comboBoxInstructor.Text))
         {
             DBData.updateCarAssignation(comboBoxCar.Text, comboBoxInstructor.Text, firstDayOfWeek, lastDayOfWeek);
             ControlFunctions.clearListViewReport(listViewCarsAssigned);
             createListViewAssignedCarsReport();
             populateCarCombo();
         }
         else
         {
             MessageBox.Show($"You have to select a week with scheduled slots for {comboBoxInstructor.Text}.");
         }
     }
     else
     {
         MessageBox.Show("Please select an Instructor and assing a Car with the Comboboxes below.");
     }
 }
Exemplo n.º 8
0
        private void dateTimePickerWeek_ValueChanged(object sender, EventArgs e)
        {
            listViewDay.Visible          = true;
            listViewWeek.Visible         = true;
            listViewCarsAssigned.Visible = true;

            comboBoxInstructor.SelectedItem = -1;
            comboBoxInstructor.Text         = "";
            comboBoxCar.SelectedItem        = -1;
            comboBoxCar.Text = "";
            populateCarCombo();

            timesOfDate = DBData.getTimesOfDay(dateTimePickerWeek.Value);
            ControlFunctions.clearListViewReport(listViewWeek);
            createListViewWeekReport();
            ControlFunctions.clearListViewReport(listViewCarsAssigned);
            createListViewAssignedCarsReport();
            labelDate.Text = dateTimePickerWeek.Value.ToString("d");
            ControlFunctions.clearListViewReport(listViewDay);
            createListViewDayReport(dateTimePickerWeek.Value);
        }
Exemplo n.º 9
0
 //It saves the Appointment
 private void buttonConfirm_Click(object sender, EventArgs e)
 {
     //It updates the DB
     if (instructor != "" && appointmentTime != "")
     {
         bookAppointment();
         //It loads the Appointments for the Client
         clientAppointments = getClientAppointments(userName, DateTime.Today);
         //It refreshes the Appointments ListView
         listViewAppointments.Items.Clear();
         createListViewAppointmentsReport();
         //It refreshes the Appointment Selection ListView
         ControlFunctions.clearListViewReport(listViewAppointmentSelection);
         createListViewAppointmentSelectionReport();
         labelAppointmentSelected.Text = "No appointment selected";
         appointmentTime = "";
         MessageBox.Show("Appointment booked successfully.");
     }
     else
     {
         MessageBox.Show("Please select a slot first.");
     }
 }
Exemplo n.º 10
0
 //It cancels the Schedule for the Week and retrieves the data from the DB
 private void buttonCancelSchedule_Click(object sender, EventArgs e)
 {
     //It actualizes the Week ListView
     ControlFunctions.clearListViewReport(listViewWeek);
     createlistViewWeekReport(dateTimePickerWeek.Value);
 }
Exemplo n.º 11
0
 private void buttonCancelSchedule_Click(object sender, EventArgs e)
 {
     ControlFunctions.clearListViewReport(listViewDay);
     createListViewDayReport(DateTime.Parse(labelDate.Text));
 }