private void btnAddJob_Click(object sender, EventArgs e)
 {
     if (!string.IsNullOrEmpty(txtJobTitle.Text) && !string.IsNullOrEmpty(cmbContractors.Text) && !string.IsNullOrEmpty(cmbConStatus.Text))
     {
         ve = new VehicleManagementEntities();
         if (ve.Jobs.Any(r => r.JobTitle == txtJobTitle.Text))
         {
             MessageBox.Show("This job is already exists!");
         }
         else
         {
             cmbBoxValues selCon             = cmbContractors.SelectedItem as cmbBoxValues;
             int          selectedContractor = selCon.cmbVal;
             Job          job = new Job()
             {
                 JobTitle    = txtJobTitle.Text,
                 VehicleId   = vehicleId,
                 Contractor  = long.Parse(selectedContractor.ToString()),
                 Amount      = float.Parse(txtJobAmount.Value.ToString()),
                 Status      = cmbConStatus.Text,
                 CreatedDate = DateTime.Now
             };
             ve.Jobs.Add(job);
             ve.SaveChanges();
             MessageBox.Show("Contractor successfully added!");
             fetchJobs();
             clearJobFields();
         }
     }
     else
     {
         MessageBox.Show("You must fill all fields!");
     }
 }
        private void btnUpdateJob_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(txtJobTitle.Text) && !string.IsNullOrEmpty(cmbContractors.Text) && !string.IsNullOrEmpty(cmbConStatus.Text))
            {
                ve = new VehicleManagementEntities();
                cmbBoxValues selCon             = cmbContractors.SelectedItem as cmbBoxValues;
                int          selectedContractor = selCon.cmbVal;

                var singleJob = ve.Jobs.Where(r => r.JobId == selectedJobID).First();
                singleJob.JobTitle   = txtJobTitle.Text;
                singleJob.Contractor = long.Parse(selectedContractor.ToString());
                singleJob.Amount     = float.Parse(txtJobAmount.Value.ToString());
                singleJob.Status     = cmbConStatus.Text;
                ve.SaveChanges();
                MessageBox.Show("Job successfully updated!");
                fetchJobs();
                clearJobFields();
                selectedJobID = 0;
            }
            else
            {
                MessageBox.Show("You must fill all fields!");
            }
        }
        private void cmbContractors_SelectedIndexChanged(object sender, EventArgs e)
        {
            cmbBoxValues cmbBoxValues = cmbContractors.SelectedItem as cmbBoxValues;

            lblConType.Text = cmbBoxValues.extraValues.ToString();
        }