partial void EmployeeTrainingRecords_Validate(EmployeeTrainingRecord 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"); } } if (entity.DateTrainingCompleted != null & entity.DateTrainingCommenced != null) { if (entity.DateTrainingCompleted < entity.DateTrainingCommenced) { results.AddEntityError("Training cannot be completed before it has commenced"); } } }
public static EmployeeTrainingRecord CreateEmployeeTrainingRecord(int ID, int employeeTrainingRecord_Employee, global::System.DateTime dateAssigned, global::System.DateTime targetCompletionDate, int employeeTrainingRecord_Course, byte[] rowVersion) { EmployeeTrainingRecord employeeTrainingRecord = new EmployeeTrainingRecord(); employeeTrainingRecord.Id = ID; employeeTrainingRecord.EmployeeTrainingRecord_Employee = employeeTrainingRecord_Employee; employeeTrainingRecord.DateAssigned = dateAssigned; employeeTrainingRecord.TargetCompletionDate = targetCompletionDate; employeeTrainingRecord.EmployeeTrainingRecord_Course = employeeTrainingRecord_Course; employeeTrainingRecord.RowVersion = rowVersion; return employeeTrainingRecord; }
private void SendEmployeeTrainingRecordsInsertingEmail(EmployeeTrainingRecord entity) { if (entity.Employee.Email != string.Empty) { string subject = "New Training Assignment!"; string message = string.Format("<html><body>Dear {0} {1}.<br></br><p>You have been assigned to the following training course:<br></br>Courses Reference: {2}.<br></br>Course Title: {3}.<br></br>Course Description: {4}.<br></br>The target date for you to complete this course is: {5}</p></body></html>", entity.Employee.FirstName, entity.Employee.LastName, entity.Course.CourseReference, entity.Course.CourseTitle, entity.Course.CourseDescription, entity.TargetCompletionDate); List<string> mailTos = new List<string>(); mailTos.Add(entity.Employee.Email); SendEmail(mailTos, subject, message); } }
public void AddToEmployeeTrainingRecords(EmployeeTrainingRecord employeeTrainingRecord) { base.AddObject("EmployeeTrainingRecords", employeeTrainingRecord); }