示例#1
0
        public EmployeeLeaveCredits updateEmployeeLeaveCredits(Employee employee, LeaveCredits leaveCredits)
        {
            sqlCon.Open();
            sqlCmd.CommandText = "UPDATE LeaveCredits SET vacationLeaveCredit = @vacationLeaveCredit, "
                                 + "sickLeaveCredit =@sickLeaveCredit , paternityLeaveCredit =@paternityLeaveCredit, "
                                 + "emergencyLeaveCredit =@emergencyLeaveCredit , birthdayLeaveCredit =@birthdayLeaveCredit , "
                                 + "bereavementLeaveCredit =@bereavementLeaveCredit FROM EmployeeLeaveCredits INNER JOIN "
                                 + "LeaveCredits ON EmployeeLeaveCredits.leaveCreditsId = LeaveCredits.id "
                                 + "WHERE EmployeeLeaveCredits.employeeId = @employeeNumber";
            sqlCmd.Parameters.AddWithValue("@employeeNumber", employee.id);
            sqlCmd.Parameters.AddWithValue("@vacationLeaveCredit", leaveCredits.vacationLeaveCredits);
            sqlCmd.Parameters.AddWithValue("@sickLeaveCredit", leaveCredits.sickLeaveCredits);
            sqlCmd.Parameters.AddWithValue("@paternityLeaveCredit", leaveCredits.paternityLeaveCredits);
            sqlCmd.Parameters.AddWithValue("@emergencyLeaveCredit", leaveCredits.emergencyLeaveCredits);
            sqlCmd.Parameters.AddWithValue("@birthdayLeaveCredit", leaveCredits.birthdayLeaveCredits);
            sqlCmd.Parameters.AddWithValue("@bereavementLeaveCredit", leaveCredits.bereavementLeaveCredits);
            sqlCmd.ExecuteNonQuery();
            sqlCon.Close();

            EmployeeLeaveCredits employeeLeaveCredits = new EmployeeLeaveCredits();

            employeeLeaveCredits.employee     = employee;
            employeeLeaveCredits.leaveCredits = leaveCredits;
            return(employeeLeaveCredits);
        }
示例#2
0
        public EmployeeLeaveCredits createEmployeeLeaveCredits(Employee employee)
        {
            LeaveCredits leaveCredits = new LeaveCredits();

            leaveCredits.vacationLeaveCredits    = VACATION_LEAVE_CREDITS;
            leaveCredits.sickLeaveCredits        = SICK_LEAVE_CREDITS;
            leaveCredits.paternityLeaveCredits   = PATERNITY_LEAVE_CREDITS;
            leaveCredits.emergencyLeaveCredits   = EMERGENCY_LEAVE_CREDITS;
            leaveCredits.birthdayLeaveCredits    = BIRTHDAY_LEAVE_CREDITS;
            leaveCredits.bereavementLeaveCredits = BEREAVEMENT_LEAVE_CREDITS;
            sqlCon.Open();
            sqlCmd.CommandText = "INSERT INTO LeaveCredits (vacationLeaveCredit, sickLeaveCredit, "
                                 + "paternityLeaveCredit, emergencyLeaveCredit, birthdayLeaveCredit, bereavementLeaveCredit) "
                                 + "VALUES (@vacationLeaveCredit, @sickLeaveCredit, "
                                 + "@paternityLeaveCredit, @emergencyLeaveCredit, @birthdayLeaveCredit, @bereavementLeaveCredit); "
                                 + "SELECT CAST(scope_identity() AS int)";
            sqlCmd.Parameters.AddWithValue("@vacationLeaveCredit", leaveCredits.vacationLeaveCredits);
            sqlCmd.Parameters.AddWithValue("@sickLeaveCredit", leaveCredits.sickLeaveCredits);
            sqlCmd.Parameters.AddWithValue("@paternityLeaveCredit", leaveCredits.paternityLeaveCredits);
            sqlCmd.Parameters.AddWithValue("@emergencyLeaveCredit", leaveCredits.emergencyLeaveCredits);
            sqlCmd.Parameters.AddWithValue("@birthdayLeaveCredit", leaveCredits.birthdayLeaveCredits);
            sqlCmd.Parameters.AddWithValue("@bereavementLeaveCredit", leaveCredits.bereavementLeaveCredits);
            leaveCredits.id = (int)sqlCmd.ExecuteScalar();
            sqlCon.Close();

            EmployeeLeaveCredits employeeLeaveCredits = createEmployeeLeaveCredits(employee, leaveCredits);

            return(null);
        }
        private void btnDelete_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult =
                MessageBox.Show(
                    $"Do you want to delete {dtgRecords.CurrentRow.Cells["LastName"].Value}, {dtgRecords.CurrentRow.Cells["FirstName"].Value} {dtgRecords.CurrentRow.Cells["MiddleName"].Value} profile ?",
                    "Delete", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);

            if (dialogResult == DialogResult.Yes)
            {
                var employee = new Employee
                {
                    EmployeeNo = dtgRecords.CurrentRow.Cells[1].Value.ToString(),
                    IsDeleted  = 1
                };
                DeleteEmployee(employee);
                var leaveCredit = new LeaveCredits
                {
                    EmployeeNo = dtgRecords.CurrentRow.Cells[1].Value.ToString(),
                    IsDeleted  = 1
                };
                DeleteLeaveCredit(leaveCredit);
                var seminar = new Seminar
                {
                    EmployeeNo = dtgRecords.CurrentRow.Cells[1].Value.ToString(),
                    IsDeleted  = 1
                };
                DeleteSeminar(seminar);
                MessageBox.Show("Successfully deleted!", "Successfully deleted!", MessageBoxButtons.OK, MessageBoxIcon.Information);
                LoadDataInGridView();
            }
        }
示例#4
0
        public LeaveCredits fetchLeaveCreditsByEmployee(Employee employee)
        {
            LeaveCredits leaveCredits = new LeaveCredits();

            sqlCon.Open();
            sqlCmd.CommandText = "SELECT EmployeeLeaveCredits.id, EmployeeLeaveCredits.employeeId, EmployeeLeaveCredits.leaveCreditsId, "
                                 + "LeaveCredits.vacationLeaveCredit, LeaveCredits.sickLeaveCredit, LeaveCredits.paternityLeaveCredit, "
                                 + "LeaveCredits.emergencyLeaveCredit, LeaveCredits.birthdayLeaveCredit, LeaveCredits.bereavementLeaveCredit "
                                 + "FROM EmployeeLeaveCredits INNER JOIN LeaveCredits ON "
                                 + "EmployeeLeaveCredits.leaveCreditsId = LeaveCredits.id "
                                 + "WHERE (EmployeeLeaveCredits.employeeId = @employeeId)";
            sqlCmd.Parameters.AddWithValue("@employeeId", employee.id);
            sqlDataReader = sqlCmd.ExecuteReader();
            if (sqlDataReader.HasRows)
            {
                while (sqlDataReader.Read())
                {
                    leaveCredits.id = Int32.Parse(sqlDataReader["leaveCreditsId"].ToString());
                    leaveCredits.vacationLeaveCredits    = Int32.Parse(sqlDataReader["vacationLeaveCredit"].ToString());
                    leaveCredits.sickLeaveCredits        = Int32.Parse(sqlDataReader["sickLeaveCredit"].ToString());
                    leaveCredits.paternityLeaveCredits   = Int32.Parse(sqlDataReader["paternityLeaveCredit"].ToString());
                    leaveCredits.emergencyLeaveCredits   = Int32.Parse(sqlDataReader["emergencyLeaveCredit"].ToString());
                    leaveCredits.birthdayLeaveCredits    = Int32.Parse(sqlDataReader["birthdayLeaveCredit"].ToString());
                    leaveCredits.bereavementLeaveCredits = Int32.Parse(sqlDataReader["bereavementLeaveCredit"].ToString());
                }
            }
            sqlCon.Close();
            return(leaveCredits);
        }
示例#5
0
        public EmployeeLeaveCredits resetEmployeeLeaveCredits(Employee employee)
        {
            LeaveCredits leaveCredits = new LeaveCredits();

            leaveCredits.vacationLeaveCredits    = VACATION_LEAVE_CREDITS;
            leaveCredits.sickLeaveCredits        = SICK_LEAVE_CREDITS;
            leaveCredits.paternityLeaveCredits   = PATERNITY_LEAVE_CREDITS;
            leaveCredits.emergencyLeaveCredits   = EMERGENCY_LEAVE_CREDITS;
            leaveCredits.birthdayLeaveCredits    = BIRTHDAY_LEAVE_CREDITS;
            leaveCredits.bereavementLeaveCredits = BEREAVEMENT_LEAVE_CREDITS;
            return(leaveCreditService.updateEmployeeLeaveCredits(employee, leaveCredits));
        }
示例#6
0
        private void loadEmployeeLeaveCredits()
        {
            EmployeeControllerInterface employeeController = new EmployeeController();
            Employee employee = employeeController.fetchEmployeeByUsername(user.username);
            LeaveCreditsControllerInteface leaveCreditsController = new LeaveCreditsController();
            LeaveCredits leaveCredits = leaveCreditsController.fetchLeaveCreditsByEmployee(employee);

            vacationLeave.Text    = leaveCredits.vacationLeaveCredits.ToString();
            sickLeave.Text        = leaveCredits.sickLeaveCredits.ToString();
            emergencyLeave.Text   = leaveCredits.emergencyLeaveCredits.ToString();
            paternityLeave.Text   = leaveCredits.paternityLeaveCredits.ToString();
            bereavementLeave.Text = leaveCredits.bereavementLeaveCredits.ToString();
            birthdayLeave.Text    = leaveCredits.birthdayLeaveCredits.ToString();
        }
        public void Delete_Leave_Credit_Should_Return_1()
        {
            // Arrange
            var model = new LeaveCredits
            {
                EmployeeNo = "1",
                IsDeleted  = 0
            };
            // Act
            var result = DeleteLeaveCredit(model);

            // Assert
            Assert.AreEqual(1, result);
        }
        public void Update_Leave_Credit_Should_Return_1()
        {
            // Arrange
            var model = new LeaveCredits
            {
                EmployeeNo           = "25",
                LeaveCredit          = 4,
                RemainingLeaveCredit = 4
            };
            // Act
            var result = UpdateLeaveCredit(model);

            // Assert
            Assert.AreEqual(1, result);
        }
示例#9
0
        private EmployeeLeaveCredits createEmployeeLeaveCredits(Employee employee, LeaveCredits leaveCredits)
        {
            EmployeeLeaveCredits employeeLeaveCredits = new EmployeeLeaveCredits();

            sqlCon.Open();
            sqlCmd.CommandText = "INSERT INTO EmployeeLeaveCredits (employeeId, leaveCreditsId) "
                                 + "VALUES (@employeeId, @leaveCreditsId);SELECT CAST(scope_identity() AS int)";
            sqlCmd.Parameters.AddWithValue("@employeeId", employee.id);
            sqlCmd.Parameters.AddWithValue("@leaveCreditsId", leaveCredits.id);
            employeeLeaveCredits.id = (int)sqlCmd.ExecuteScalar();

            employeeLeaveCredits.employee     = employee;
            employeeLeaveCredits.leaveCredits = leaveCredits;
            sqlCon.Close();
            return(employeeLeaveCredits);
        }
示例#10
0
 public static int InsertLeaveCredits(LeaveCredits model)
 {
     using (var connection = new MySqlConnection(GetConnectionString()))
     {
         connection.Open();
         string query = "INSERT INTO tbl_leave_credits (employee_no, leave_credit, remaining_leave_credit, is_deleted) VALUES (@employee_no, @leave_credit, @remaining_leave_credit, @is_deleted);";
         using (var command = new MySqlCommand(query, connection))
         {
             command.Parameters.Add("employee_no", MySqlDbType.VarChar).Value          = model.EmployeeNo;
             command.Parameters.Add("leave_credit", MySqlDbType.Int16).Value           = model.LeaveCredit;
             command.Parameters.Add("remaining_leave_credit", MySqlDbType.Int16).Value = model.RemainingLeaveCredit;
             command.Parameters.Add("is_deleted", MySqlDbType.Int16).Value             = model.IsDeleted;
             return(command.ExecuteNonQuery());
         }
     }
 }
        public void Insert_Leave_Credit_Should_Return_1()
        {
            // Arrange
            var model = new LeaveCredits
            {
                EmployeeNo           = "1",
                LeaveCredit          = 3,
                RemainingLeaveCredit = 3,
                IsDeleted            = 0
            };
            // Act
            int result = InsertLeaveCredits(model);

            // Assert
            Assert.AreEqual(1, result);
        }
示例#12
0
        public Request updateRequestStatusById(int requestId, string status)
        {
            Request request = fetchById(requestId);

            sqlCon.Open();
            sqlCmd.CommandText = "UPDATE Request SET status = @status WHERE (id = @id);";
            sqlCmd.Parameters.AddWithValue("@status", status);
            sqlCmd.Parameters.AddWithValue("@id", requestId);
            sqlCmd.ExecuteNonQuery();
            sqlCon.Close();

            if (status == "approved")
            {
                EmployeeServiceInterface employeeService = new EmployeeService();
                Employee employee = employeeService.fetchEmployeeById(request.employee.id);

                LeaveCreditServiceInterface leaveCreditsService = new LeaveCreditService();
                LeaveCredits leaveCredits = leaveCreditsService.fetchLeaveCreditsByEmployee(employee);
                Console.WriteLine("leave" + request.name);
                if (request.name.Equals("Vacation Leave"))
                {
                    leaveCredits.vacationLeaveCredits -= 1;
                }
                else if (request.name.Equals("Sick Leave"))
                {
                    leaveCredits.sickLeaveCredits -= 1;
                }
                else if (request.name.Equals("Bereavement Leave"))
                {
                    leaveCredits.bereavementLeaveCredits -= 1;
                }
                else if (request.name.Equals("Paternity Leave"))
                {
                    leaveCredits.paternityLeaveCredits -= 1;
                }
                else if (request.name.Equals("Emergency Leave"))
                {
                    leaveCredits.emergencyLeaveCredits -= 1;
                }
                else if (request.name.Equals("Birthday Leave"))
                {
                    leaveCredits.birthdayLeaveCredits -= 1;
                }
                EmployeeLeaveCredits employeeLeaveRequest = leaveCreditsService.updateEmployeeLeaveCredits(employee, leaveCredits);
            }
            return(request);
        }
示例#13
0
 public static int DeleteLeaveCredit(LeaveCredits model)
 {
     try
     {
         using (var connection = new MySqlConnection(GetConnectionString()))
         {
             connection.Open();
             string query = "UPDATE tbl_leave_credits SET is_deleted = @is_deleted WHERE employee_no = @employee_no;";
             using (var command = new MySqlCommand(query, connection))
             {
                 command.Parameters.Add("is_deleted", MySqlDbType.Int16).Value    = model.IsDeleted;
                 command.Parameters.Add("employee_no", MySqlDbType.VarChar).Value = model.EmployeeNo;
                 return(command.ExecuteNonQuery());
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return(0);
     }
 }
示例#14
0
        private void leaveRequestButton_Click(object sender, EventArgs e)
        {
            if (typeOfLeaveComboBox.Text.Equals(""))
            {
                showErrorMessage("Input a valid Request.");
                return;
            }
            EmployeeControllerInterface employeeController = new EmployeeController();
            Employee employee = employeeController.fetchEmployeeByUsername(user.username);

            Request request = new Request();

            request.employee      = employee;
            request.name          = typeOfLeaveComboBox.Text;
            request.requestedDate = Convert.ToDateTime(dateOfLeave.Text);
            request.status        = RequestStatus.Pending;
            request.description   = leaveDescription.Text;
            request.dateFiled     = Convert.ToDateTime(DateTime.Now.ToString("MM/dd/yyyy"));



            LeaveCreditsControllerInteface leaveCreditsService = new LeaveCreditsController();
            LeaveCredits leaveCredits = leaveCreditsService.fetchLeaveCreditsByEmployee(employee);

            if (request.name.Equals("Vacation Leave") && leaveCredits.vacationLeaveCredits < 1)
            {
                showErrorMessage("No available vacation leave credits.");
                request.description += " (Leave Without Pay)";
            }
            else if (request.name.Equals("Sick Leave") && leaveCredits.sickLeaveCredits < 1)
            {
                showErrorMessage("No available sick leave credits.");
                request.description += " (Leave Without Pay)";
            }
            else if (request.name.Equals("Bereavement Leave") && leaveCredits.bereavementLeaveCredits < 1)
            {
                showErrorMessage("No available beraavement leave credits.");
                request.description += " (Leave Without Pay)";
            }
            else if (request.name.Equals("Paternity Leave") && leaveCredits.paternityLeaveCredits < 1)
            {
                showErrorMessage("No available paternity leave credits.");
                request.description += " (Leave Without Pay)";
            }
            else if (request.name.Equals("Emergency Leave") && leaveCredits.emergencyLeaveCredits < 1)
            {
                showErrorMessage("No available emergency leave credits.");
                request.description += " (Leave Without Pay)";
            }
            else if (request.name.Equals("Birthday Leave") && leaveCredits.birthdayLeaveCredits < 1)
            {
                showErrorMessage("No available birthday leave credits.");
                return;
            }

            RequestControllerInterface requestController = new RequestController();

            request = requestController.createRequest(request);
            if (request != null)
            {
                loadPendingRequest();
                homeTabs.SelectedTab = pendingRequestTab;
            }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (ValidateChildren(ValidationConstraints.Enabled) && source != null)
            {
                var model = new Employee
                {
                    EmployeeNo            = txtEmployeeNo.Text,
                    FirstName             = txtFirstName.Text,
                    MiddleName            = txtMiddleName.Text,
                    LastName              = txtLastName.Text,
                    Address               = txtAddress.Text,
                    Gender                = cmbGender.Text,
                    DateOfBirth           = dtpDateofBirth.Value,
                    PlaceOfBirth          = txtPlaceofBirth.Text,
                    ContactNo             = txtContactNo.Text,
                    CivilStatus           = cmbCivilStatus.Text,
                    HighestDegree         = cmbDegree.Text,
                    BsCourse              = txtBSCourse.Text,
                    BsYearGraduated       = txtBSYearGraduated.Text,
                    BsSchool              = txtBSSchool.Text,
                    MasteralCourse        = txtMasteralCourse.Text,
                    MasteralYearGraduated = txtMasteralYearGraduated.Text,
                    MasteralSchool        = txtMasteralSchool.Text,
                    DoctoralCourse        = txtDoctoralCourse.Text,
                    DoctoralYearGraduated = txtDoctoralYearGraduated.Text,
                    DoctoralSchool        = txtDoctoralSchool.Text,
                    Eligibility           = txtEligibility.Text,
                    EmployeeType          = cmbEmployeeType.Text,
                    Position              = cmbPosition.Text,
                    UniqueItemNo          = txtUniqueItemNo.Text,
                    SalaryGrade           = Convert.ToInt32(txtSalaryGrade.Text),
                    Step          = Convert.ToInt32(txtStep.Text),
                    Department    = cmbDepartment.Text,
                    WorkStatus    = cmbWorkStatus.Text,
                    EmployeePhoto = ConvertImageToBinary(pictureBox2.Image),
                    DocumentPath  = destination,
                    HiredDate     = dtpHiredDate.Value,
                    EndOfContract = dtpEndofContract.Value,
                    IsDeleted     = 0
                };

                if (InsertEmployee(model) == 1)
                {
                    worker.RunWorkerAsync();
                    int?leaveCredit = null, remainingLeaveCredit = null;
                    if (cmbEmployeeType.Text == "Academic")
                    {
                        leaveCredit          = Convert.ToInt32(txtLeaveCredits.Text);
                        remainingLeaveCredit = Convert.ToInt32(txtLeaveCredits.Text);
                    }
                    var modelLeaveCredit = new LeaveCredits
                    {
                        EmployeeNo           = txtEmployeeNo.Text,
                        LeaveCredit          = leaveCredit,
                        RemainingLeaveCredit = remainingLeaveCredit,
                        IsDeleted            = 0
                    };
                    InsertLeaveCredits(modelLeaveCredit);

                    if (frmSeminarLocal.LocalSeminarTo.HasValue && frmSeminarLocal.LocalSeminarFrom == frmSeminarLocal.LocalSeminarTo)
                    {
                        frmSeminarLocal.LocalSeminarTo = frmSeminarLocal.LocalSeminarTo.Value.AddDays(1);
                    }

                    if (frmSeminarRegional.RegionalSeminarTo.HasValue && frmSeminarRegional.RegionalSeminarFrom == frmSeminarRegional.RegionalSeminarTo)
                    {
                        frmSeminarRegional.RegionalSeminarTo = frmSeminarRegional.RegionalSeminarTo.Value.AddDays(1);
                    }

                    if (frmSeminarNational.NationalSeminarFrom == frmSeminarNational.NationalSeminarTo && frmSeminarNational.NationalSeminarTo.HasValue)
                    {
                        frmSeminarNational.NationalSeminarTo = frmSeminarNational.NationalSeminarTo.Value.AddDays(1);
                    }

                    if (frmSeminarInternational.InternationalSeminarFrom == frmSeminarInternational.InternationalSeminarTo && frmSeminarInternational.InternationalSeminarTo.HasValue)
                    {
                        frmSeminarInternational.InternationalSeminarTo = frmSeminarInternational.InternationalSeminarTo.Value.AddDays(1);
                    }

                    var modelSeminar = new Seminar
                    {
                        EmployeeNo               = txtEmployeeNo.Text,
                        LocalSeminarName         = frmSeminarLocal.LocalSeminar,
                        LocalSeminarType         = frmSeminarLocal.LocalSeminarType,
                        LocalFrom                = frmSeminarLocal.LocalSeminarFrom,
                        LocalTo                  = frmSeminarLocal.LocalSeminarTo,
                        RegionalSeminarName      = frmSeminarRegional.RegionalSeminar,
                        RegionalSeminarType      = frmSeminarRegional.RegionalSeminarType,
                        RegionalFrom             = frmSeminarRegional.RegionalSeminarFrom,
                        RegionalTo               = frmSeminarRegional.RegionalSeminarTo,
                        NationalSeminarName      = frmSeminarNational.NationalSeminar,
                        NationalSeminarType      = frmSeminarNational.NationalSeminarType,
                        NationalFrom             = frmSeminarNational.NationalSeminarFrom,
                        NationalTo               = frmSeminarNational.NationalSeminarTo,
                        InternationalSeminarName = frmSeminarInternational.InternationalSeminar,
                        InternationalSeminarType = frmSeminarInternational.InternationalSeminarType,
                        InternationalFrom        = frmSeminarInternational.InternationalSeminarFrom,
                        InternationalTo          = frmSeminarInternational.InternationalSeminarTo,
                        IsDeleted                = 0
                    };

                    InsertSeminar(modelSeminar);
                    MessageBox.Show("Employee Information Added!", "Success", MessageBoxButtons.OK,
                                    MessageBoxIcon.None);
                    Close();
                }
                else
                {
                    MessageBox.Show("Failed adding employee.", "Failed!", MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
            }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (ValidateChildren(ValidationConstraints.Enabled))
            {
                var model = new Employee
                {
                    EmployeeNo            = txtEmployeeNo.Text,
                    FirstName             = txtFirstName.Text,
                    MiddleName            = txtMiddleName.Text,
                    LastName              = txtLastName.Text,
                    Address               = txtAddress.Text,
                    Gender                = cmbGender.Text,
                    DateOfBirth           = dtpDateofBirth.Value,
                    PlaceOfBirth          = txtPlaceofBirth.Text,
                    ContactNo             = txtContactNo.Text,
                    CivilStatus           = cmbCivilStatus.Text,
                    HighestDegree         = cmbDegree.Text,
                    BsCourse              = txtBSCourse.Text,
                    BsYearGraduated       = txtBSYearGraduated.Text,
                    BsSchool              = txtBSSchool.Text,
                    MasteralCourse        = txtMasteralCourse.Text,
                    MasteralYearGraduated = txtMasteralYearGraduated.Text,
                    MasteralSchool        = txtMasteralSchool.Text,
                    DoctoralCourse        = txtDoctoralCourse.Text,
                    DoctoralYearGraduated = txtDoctoralYearGraduated.Text,
                    DoctoralSchool        = txtDoctoralSchool.Text,
                    Eligibility           = txtEligibility.Text,
                    EmployeeType          = cmbEmployeeType.Text,
                    Position              = cmbPosition.Text,
                    UniqueItemNo          = txtUniqueItemNo.Text,
                    SalaryGrade           = Convert.ToInt32(txtSalaryGrade.Text),
                    Step          = Convert.ToInt32(txtStep.Text),
                    Department    = cmbDepartment.Text,
                    WorkStatus    = cmbWorkStatus.Text,
                    HiredDate     = dtpHiredDate.Value,
                    EndOfContract = dtpEndofContract.Value
                };
                UpdateEmployee(model);
                int?leaveCredit = null, remainingLeaveCredit = null;

                if (cmbEmployeeType.Text == "Academic")
                {
                    leaveCredit          = Convert.ToInt32(txtLeaveCredits.Text);
                    remainingLeaveCredit = GetRemainingLeaveCredit();
                }
                var modelLeaveCredit = new LeaveCredits
                {
                    EmployeeNo           = txtEmployeeNo.Text,
                    LeaveCredit          = leaveCredit,
                    RemainingLeaveCredit = remainingLeaveCredit
                };
                UpdateLeaveCredit(modelLeaveCredit);

                var seminar = new Seminar
                {
                    EmployeeNo               = txtEmployeeNo.Text,
                    LocalSeminarName         = frmSeminarLocal.LocalSeminar,
                    LocalSeminarType         = frmSeminarLocal.LocalSeminarType,
                    LocalFrom                = frmSeminarLocal.LocalSeminarFrom,
                    LocalTo                  = frmSeminarLocal.LocalSeminarTo,
                    RegionalSeminarName      = frmSeminarRegional.RegionalSeminar,
                    RegionalSeminarType      = frmSeminarRegional.RegionalSeminarType,
                    RegionalFrom             = frmSeminarRegional.RegionalSeminarFrom,
                    RegionalTo               = frmSeminarRegional.RegionalSeminarTo,
                    NationalSeminarName      = frmSeminarNational.NationalSeminar,
                    NationalSeminarType      = frmSeminarNational.NationalSeminarType,
                    NationalFrom             = frmSeminarNational.NationalSeminarFrom,
                    NationalTo               = frmSeminarNational.NationalSeminarTo,
                    InternationalSeminarName = frmSeminarInternational.InternationalSeminar,
                    InternationalSeminarType = frmSeminarInternational.InternationalSeminarType,
                    InternationalFrom        = frmSeminarInternational.InternationalSeminarFrom,
                    InternationalTo          = frmSeminarInternational.InternationalSeminarTo
                };

                if (frmSeminarLocal.LocalSeminar != null)
                {
                    UpdateLocalSeminar(seminar);
                }

                if (frmSeminarRegional.RegionalSeminar != null)
                {
                    UpdateRegionalSeminar(seminar);
                }

                if (frmSeminarNational.NationalSeminar != null)
                {
                    UpdateNationalSeminar(seminar);
                }

                if (frmSeminarInternational.InternationalSeminar != null)
                {
                    UpdateInternationalSeminar(seminar);
                }

                MessageBox.Show("Successfully updated!", "Successful", MessageBoxButtons.OK, MessageBoxIcon.Information);
                ClearSeminars();
                ClearItems(panelFileInformation);
                ClearGroupControls(grpBS);
                ClearGroupControls(grpMasteral);
                ClearGroupControls(grpDoctoral);
                DisableSaveAndCancelButtons();
                LoadDataInGridView();
            }
        }