StudentQuitReasonServices.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.DataLogic.Common.Students.HighBaseTable;
  6. using EMIS.CommonLogic.SystemServices;
  7. using EMIS.Entities;
  8. namespace EMIS.CommonLogic.Students.HighBaseTable
  9. {
  10. public class StudentQuitReasonServices : BaseServices, IStudentQuitReasonServices
  11. {
  12. public StudentQuitReasonDAL StudentQuitReasonDAL { get; set; }
  13. public Lazy<IWorkflowServices> WorkflowServices { get; set; }
  14. public void GenerateReport(int year)
  15. {
  16. var endStatusID = WorkflowServices.Value.GetCorrectEndStatus(typeof(CF_DifferentDynamic).Name);
  17. //获取异动学生数
  18. var studentQuitReasonList = StudentQuitReasonDAL.GetStudentQuitStudentCount(year, endStatusID).ToList();
  19. this.UnitOfWork.Remove<HB_StudentQuitReason>(x => x.Year == year);
  20. studentQuitReasonList.ForEach(x =>
  21. {
  22. var studentQuitReason = new HB_StudentQuitReason
  23. {
  24. StudentQuitReasonID = Guid.NewGuid(),
  25. Year = year,
  26. EducationTypeID = x.EducationTypeID,
  27. StudentChangeReasonTypeID = x.StudentChangeReasonTypeID,
  28. Count = x.StudentCount
  29. };
  30. this.SetNewStatus(studentQuitReason);
  31. this.UnitOfWork.Add(studentQuitReason);
  32. });
  33. this.UnitOfWork.Commit();
  34. }
  35. }
  36. }