private void btnApplyIncrease_Click(object sender, EventArgs e) { try { //Gets the employee IDs selected in the grid var empIdList = new List <int>(); foreach (DataGridViewRow row in dgvEmployees.Rows) { if (row.Cells["Chk"].Value != null && (bool)row.Cells["Chk"].Value == true) { empIdList.Add(employeeList[row.Index].EmployeeId); } } if (empIdList.Count == 0) { throw new DataException("No employees selected."); } //Validates the entry checkSalaryChange(); //Gets the percent increase amount var increasePercent = nudPercent.Value / 100; //Get the effective date var effectiveDate = cmbEffectiveDate.SelectedItem; //Create Salary Adjustment var salaryAdj = SalaryAdjustment.Create(); salaryAdj.PercentIncrease = increasePercent; salaryAdj.EffectiveDate = Convert.ToDateTime(effectiveDate); //Apply increase if (SalaryAdjustmentCUD.Create(empIdList, salaryAdj)) { MessageBox.Show("Salary adjustment successful."); salaryIncreasePending.Add(salaryAdj); } } catch (Exception ex) { MessageBox.Show(ex.Message); } }