public Employee saveEmployee(Employee employee) { UserServiceInterface userService = new UserService(); User user = userService.createUser(employee.userAccount); if (user.id > 0) { sqlCon.Open(); sqlCmd.CommandText = "INSERT into [Employee] (employeeId, userAccountId, fullName, " + "birthDate, gender, civilStatus, dependents, address, contactNumber, tin, " + "sssId, philHealthId, pagIbigId, dateEmployed, jobPositionId) " + "values(@employeeId, @userAccountId, @fullName, " + "@birthDate, @gender, @civilStatus, @dependents, " + "@address, @contactNumber, @tin, @sssId, @philHealthId, @pagIbigId, " + "@dateEmployed, @jobPositionId);SELECT CAST(scope_identity() AS int)"; sqlCmd.Parameters.AddWithValue("@employeeId", employee.employeeId); sqlCmd.Parameters.AddWithValue("@userAccountId", user.id); sqlCmd.Parameters.AddWithValue("@fullName", employee.fullName); sqlCmd.Parameters.AddWithValue("@birthDate", employee.birthDate); sqlCmd.Parameters.AddWithValue("@gender", employee.gender); sqlCmd.Parameters.AddWithValue("@civilStatus", employee.civilStatus); sqlCmd.Parameters.AddWithValue("@dependents", employee.dependents); sqlCmd.Parameters.AddWithValue("@address", employee.address); sqlCmd.Parameters.AddWithValue("@contactNumber", employee.contactNumber); sqlCmd.Parameters.AddWithValue("@tin", employee.tin); sqlCmd.Parameters.AddWithValue("@sssId", employee.sssId); sqlCmd.Parameters.AddWithValue("@philHealthId", employee.philHealthId); sqlCmd.Parameters.AddWithValue("@pagIbigId", employee.pagIbigId); sqlCmd.Parameters.AddWithValue("@dateEmployed", employee.dateEmployed); sqlCmd.Parameters.AddWithValue("@jobPositionId", employee.jobPosition.id); employee.id = (int)sqlCmd.ExecuteScalar(); sqlCon.Close(); LeaveCreditServiceInterface leaveCreditsService = new LeaveCreditService(); EmployeeLeaveCredits employeeLeaveCredits = leaveCreditsService.createEmployeeLeaveCredits(employee); MiscellaneousServiceInterface miscellaneousService = new MiscellaneousService(); Miscellaneous thirteenMonthBenefit = miscellaneousService.createThirteenMonthBenefit(employee); return(employee); } return(null); }