private void VehicleScheduleUI_Load(object sender, EventArgs e)
 {
     List<VehicleInformation> allVehicles = new List<VehicleInformation>();
     VehicleScheduleManager vehicleScheduleManager = new VehicleScheduleManager();
     allVehicles = vehicleScheduleManager.GetAllVehicle();
     selectVehicleComboBox.DataSource = allVehicles;
     selectVehicleComboBox.DisplayMember = "RegNo";
     selectVehicleComboBox.ValueMember = "EngineNo";
 }
 private void singleVehicleScheduleShowButton_Click(object sender, EventArgs e)
 {
     VehicleScheduleManager vehicleScheduleManager = new VehicleScheduleManager();
     VehicleInformation selectedVehicle = new VehicleInformation();
     selectedVehicle = (VehicleInformation) scheduleOfAVehicleComboBox.SelectedItem;
     try
     {
         if(vehicleScheduleManager.GetSchedulesOfASingleVehicle(selectedVehicle)!=null)
         {
             schedulesOfAVehicleGridView.DataSource =
                 vehicleScheduleManager.GetSchedulesOfASingleVehicle(selectedVehicle);
             schedulesOfAVehicleGridView.Show();
         }
         else
         {
             MessageBox.Show("No Schedule is Booked :)");
         }
     }
     catch (Exception exceptionObj)
     {
         MessageBox.Show("Exception occured in UI! "+exceptionObj.Message);
     }
 }
        private void showDateBetweenScheduleButton_Click(object sender, EventArgs e)
        {
            VehicleScheduleManager vehicleScheduleManager = new VehicleScheduleManager();
            try
            {
                DateTime selectedStartDate = startMonthCalendar.SelectionRange.Start;
                DateTime selectedEndDate = endMonthCalendar.SelectionRange.Start;

                if (vehicleScheduleManager.GetDateBetweenSchedule(selectedStartDate, selectedEndDate) != null)
                {
                    dateBetweenDataGridView.DataSource = vehicleScheduleManager.GetDateBetweenSchedule(
                        selectedStartDate, selectedEndDate);
                    dateBetweenDataGridView.Show();
                }
                else
                {
                    MessageBox.Show("No Schedule in this interval.");
                }
            }
            catch (Exception exceptionObj)
            {
                MessageBox.Show(exceptionObj.Message);
            }
        }
 private void Save_Click(object sender, EventArgs e)
 {
     VehicleScheduleManager vehicleScheduleManager = new VehicleScheduleManager();
     string message;
     VehicleInformation selectedVehicleInformation = (VehicleInformation)selectVehicleComboBox.SelectedItem;
     DateTime selectedDateTime = selectDateCalender.SelectionRange.Start;
     if(bookedByTextBox.Text!=string.Empty && addressTextBox.Text!=string.Empty && selectedVehicleInformation!=null && selectedDateTime!=null && shiftComboBox.SelectedItem!=null)
     {
         try
         {
             vehicleScheduleManager.GetVehicleSchedule(selectedVehicleInformation,selectedDateTime,shiftComboBox.SelectedItem.ToString(),bookedByTextBox.Text,addressTextBox.Text,out message);
             MessageBox.Show(message);
             this.Close();
         }
         catch (Exception exceptionObj)
         {
             MessageBox.Show("Exception occured in VehicleScheduleUI: "+exceptionObj.Message);
         }
     }
     else
     {
         MessageBox.Show("Fillup all! ");
     }
 }