RecruitTerritorialReportServices.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.Entities;
  7. namespace EMIS.CommonLogic.Students.HighBaseTable
  8. {
  9. public class RecruitTerritorialReportServices : BaseServices, IRecruitTerritorialReportServices
  10. {
  11. public RecruitTerritorialReportDAL RecruitTerritorialReportDAL { get; set; }
  12. public void GenerateReport(int year)
  13. {
  14. var insertList = new List<HB_RecruitTerritorialReport>();
  15. var recruitTerritorialReportList = RecruitTerritorialReportDAL.GetRecruitTerritorialReportView(year).ToList();
  16. this.UnitOfWork.Delete<HB_RecruitTerritorialReport>(x => x.Year == year);
  17. recruitTerritorialReportList.ForEach(x =>
  18. {
  19. var recruitTerritorialReport = new HB_RecruitTerritorialReport
  20. {
  21. RecruitTerritorialReportID = Guid.NewGuid(),
  22. Year = year,
  23. Territorial = x.Territorial,
  24. EducationTypeID = x.EducationTypeID,
  25. RecruitCategoryID = x.RecruitCategoryID,
  26. IsFreshGraduate = x.IsFreshGraduate,
  27. IsCountry = x.IsCountry,
  28. RecruitCount = x.RecruitCount
  29. };
  30. this.SetNewStatus(recruitTerritorialReport);
  31. insertList.Add(recruitTerritorialReport);
  32. });
  33. this.UnitOfWork.BulkInsert(insertList);
  34. }
  35. }
  36. }