private void gvDeleteJobs_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            int index = e.RowIndex; //Get row index


            if (index >= 0)// Checks if user clicked on top left box
            {
                DataGridViewRow selectedRowToDelete = gvDeleteJobs.Rows[index];
                deleteJob.JobID = Convert.ToInt32(selectedRowToDelete.Cells[1].Value);

                if (MessageBox.Show("Are you sure you want to delete this job?", "Confirm", MessageBoxButtons.YesNo)
                    == DialogResult.Yes)
                {
                    if (ApplicantDB.DeleteJob(deleteJob))
                    {
                        MessageBox.Show("Job deleted", "Success");
                    }
                    else
                    {
                        MessageBox.Show("Job could not be deleted", "Error");
                    }
                    this.Close();
                }
            }
        }
        private void GetApplicantJobHistory(string CustID)
        {
            dt = ApplicantDB.GetApplicantJobHistory(CustID);

            gvJobHistory.DataSource = dt;

            if (gvJobHistory.Columns.Count > 0)// Count will be > 0 if no applicant / job found.
            {
                gvJobHistory.Columns[0].Visible = false;
                gvJobHistory.Columns[1].Visible = false;
            }
        }
        private void GetApplication(string CustID)
        {
            try
            {
                application = ApplicantDB.GetApplication(CustID);

                if (application != null)
                {
                    currentApplicant = application.CustID;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.GetType().ToString());
            }
        }
        private void UpdateApplicant(string CustID)
        {
            Applicant newApplicant = new Applicant();

            this.PutApplicantData(newApplicant);

            try
            {
                if (ApplicantDB.UpdateApplicant(application, newApplicant))
                {
                    MessageBox.Show("Applicant Saved");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, ex.GetType().ToString());
            }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (this.Text == "Modify Job " + suffix) //Update existing job
            {
                Job newJob = new Job();

                newJob.Job_Title  = txtJobTitle.Text;
                newJob.Start_Date = dtpStartDate.Value;
                newJob.End_Date   = dtpEndDate.Value;
                newJob.Salary     = Convert.ToDecimal(txtSalary.Text);

                if (ApplicantDB.UpdateJob(job, newJob))
                {
                    MessageBox.Show("Updated job.");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("The job could not be updated.");
                }
            }
            else if (this.Text == "Create New Job " + suffix)
            {
                Job    newJob = new Job();
                Random rnd    = new Random();

                newJob.JobID      = rnd.Next(20, 10000);
                newJob.CustID     = job.CustID;
                newJob.Job_Title  = txtJobTitle.Text;
                newJob.Start_Date = dtpStartDate.Value;
                newJob.End_Date   = dtpEndDate.Value;
                newJob.Salary     = Convert.ToDecimal(txtSalary.Text);

                if (ApplicantDB.InsertNewJob(newJob))
                {
                    MessageBox.Show("Job added.", "Success");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Job could not be added", "Error");
                }
            }
        }