partial void JobRoleCourseAssignments_Inserting(JobRoleCourseAssignment entity)
        {
            var employees = this.DataWorkspace.ApplicationData.Employees.Where(employee => employee.EmployeeJobRoles.Any(employeeJobRole => employeeJobRole.JobRole.Id == entity.JobRole.Id)).Execute();

            foreach (Employee employee in employees)
            {
                if (!employee.EmployeeTrainingRecords.Any(e => e.Course.Id == entity.Course.Id))
                {
                    EmployeeTrainingRecord employeeTrainingRecord = this.DataWorkspace.ApplicationData.EmployeeTrainingRecords.AddNew();
                    employeeTrainingRecord.Employee = employee;
                    employeeTrainingRecord.Course = entity.Course;
                    employeeTrainingRecord.DateAssigned = entity.DateAssigned;
                    employeeTrainingRecord.TargetCompletionDate = entity.TargetCompletionDate;

                    SendEmployeeTrainingRecordsInsertingEmail(employeeTrainingRecord);
                }
            }
        }
 public static JobRoleCourseAssignment CreateJobRoleCourseAssignment(int ID, int jobRoleCourseAssignment_JobRole, int jobRoleCourseAssignment_Course, global::System.DateTime dateAssigned, global::System.DateTime targetCompletionDate, byte[] rowVersion)
 {
     JobRoleCourseAssignment jobRoleCourseAssignment = new JobRoleCourseAssignment();
     jobRoleCourseAssignment.Id = ID;
     jobRoleCourseAssignment.JobRoleCourseAssignment_JobRole = jobRoleCourseAssignment_JobRole;
     jobRoleCourseAssignment.JobRoleCourseAssignment_Course = jobRoleCourseAssignment_Course;
     jobRoleCourseAssignment.DateAssigned = dateAssigned;
     jobRoleCourseAssignment.TargetCompletionDate = targetCompletionDate;
     jobRoleCourseAssignment.RowVersion = rowVersion;
     return jobRoleCourseAssignment;
 }
 partial void JobRoleCourseAssignments_Validate(JobRoleCourseAssignment entity, EntitySetValidationResultsBuilder results)
 {
     if (entity.TargetCompletionDate != null & entity.DateAssigned != null)
     {
         if (entity.TargetCompletionDate < entity.DateAssigned)
         {
             results.AddEntityError("The target date cannot be earlier than the assigned date");
         }
     }
 }
 public void AddToJobRoleCourseAssignments(JobRoleCourseAssignment jobRoleCourseAssignment)
 {
     base.AddObject("JobRoleCourseAssignments", jobRoleCourseAssignment);
 }