StudentRecordDAL.cs 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.DataLogic.Repositories;
  6. using EMIS.ViewModel.SystemView;
  7. using System.Linq.Expressions;
  8. using EMIS.Entities;
  9. using EMIS.ViewModel.Students;
  10. namespace EMIS.DataLogic.StudentSystem.StudentMaterial
  11. {
  12. public class StudentRecordDAL
  13. {
  14. public StudentRepository StudentRepository { get; set; }
  15. public StudentProfileRepository ProfileRepository { get; set; }
  16. public StudentContactRepository ContactRepository { get; set; }
  17. public RecruitstudentsRepository RecruitsRepository { get; set; }
  18. public ClassmajorRepository ClassRepository { get; set; }
  19. public GrademajorRepository GradeRepository { get; set; }
  20. public FacultymajorRepository FacultyRepository { get; set; }
  21. public StudentEditControlRepository ControlRepository { get; set; }
  22. public StudentEditObjectsRepository StudentEditObjectsRepository { get; set; }
  23. public StudentContrastRepository StudentContrastRepository { get; set; }
  24. public CollegeRepository CollegeRepository { get; set; }
  25. public SchoolyearRepository SchoolyearRepository { get; set; }
  26. public StudentRecordView GetStudentByStudentNo(Guid StudentID)
  27. {
  28. var query = from student in StudentRepository.Entities
  29. join profile in ProfileRepository.Entities on student.UserID equals profile.UserID
  30. join contact in ContactRepository.Entities on profile.UserID equals contact.UserID
  31. join recruits in RecruitsRepository.Entities on contact.UserID equals recruits.UserID
  32. join cla in ClassRepository.Entities on student.ClassmajorID equals cla.ClassmajorID
  33. join grade in GradeRepository.Entities on cla.GrademajorID equals grade.GrademajorID
  34. join faculty in FacultyRepository.Entities on grade.FacultymajorID equals faculty.FacultymajorID
  35. join college in CollegeRepository.Entities on faculty.CollegeID equals college.CollegeID
  36. join schoolyear in SchoolyearRepository.Entities
  37. on new { Years = grade.GradeID, SchoolcodeID = grade.SemesterID }
  38. equals new { Years = (int?)schoolyear.Years, SchoolcodeID = (int?)schoolyear.SchoolcodeID }
  39. where student.UserID == StudentID
  40. select new StudentRecordView()
  41. {
  42. IsDreamProject = profile.IsDreamProject == true,
  43. Career=student.Career,
  44. CardNo=student.CF_StudentAccount.CardNo,
  45. BankName=student.CF_StudentAccount.BankName,
  46. UserID = student.UserID,
  47. LoginID = student.Sys_User.LoginID,
  48. UserName = student.Sys_User.Name,
  49. PhotoUrl = student.PhotoUrl,
  50. UsedName = profile.UsedName,
  51. SexID = student.SexID.Value,
  52. BirthDate = student.BirthDate,
  53. Nation = student.NationID,
  54. Politics = student.PoliticsID,
  55. CertificatesType = student.CertificatesType,
  56. IDNumber = student.IDNumber,
  57. CultureModel = profile.CultureModelID,
  58. StudentType = student.StudentType,
  59. InSchoolStatusID=student.InSchoolStatusID,
  60. StudentStatus = student.StudentStatus,
  61. EntranceDate = recruits.EntranceDate,
  62. EntranceWay = recruits.EntranceWayID,
  63. ExamineeNum = recruits.ExamineeNum,
  64. ExamineeType = recruits.ExamineeType,
  65. Features = recruits.FeaturesID,
  66. CollegeName = college.Name,
  67. Score = recruits.Score,
  68. Territorial = recruits.TerritorialID,
  69. Area = student.CF_Recruitstudents.Area,
  70. Place = profile.Place,
  71. BornPlace = profile.BornPlace,
  72. Healthy = profile.HealthStateID,
  73. Specialty = profile.Specialty,
  74. Height = profile.Height,
  75. Weight = profile.Weight,
  76. Email = contact.Email,
  77. QQ = contact.QQ,
  78. Dormitory = contact.Dormitory,
  79. Telephone = contact.Telephone,
  80. Mobile = contact.Mobile,
  81. HomeAddress = contact.HomeAddress,
  82. WorkUnit = contact.WorkUnit,
  83. Zipcode = contact.ZIPCode,
  84. Recipient = contact.Recipient,
  85. PlanningGraduateDate = student.PlanningGraduateDate,
  86. GradeName = grade.Name,
  87. GradeCode = grade.Code,
  88. StandardID = grade.CF_Facultymajor.StandardID,
  89. ClassID=cla.ClassmajorID,
  90. ClassName = cla.Name,
  91. LearnSystem = faculty.LearnSystem,
  92. No = cla.No,
  93. EducationID = faculty.EducationID,
  94. LearningformID = faculty.LearningformID,
  95. LearningstyleID = faculty.LearningstyleID,
  96. Remarks = student.Remark,
  97. FacultymajorID = grade.FacultymajorID,
  98. StartSchoolcodeID = grade.SemesterID,
  99. StartSchoolyearValue = schoolyear.Value
  100. };
  101. return query.SingleOrDefault();
  102. }
  103. }
  104. }