123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.DataLogic.Repositories;
- using EMIS.ViewModel.DQPSystem;
- using System.Linq.Expressions;
- using EMIS.Entities;
- using EMIS.ViewModel;
- using Bowin.Common.Linq;
- namespace EMIS.DataLogic.DQPSystem
- {
- public class SOCDetailDAL
- {
- public SOCRepository SOCRepository { get; set; }
- public SOCDetailRepository SOCDetailRepository { get; set; }
- public SOCDetailAttachmentRepository SOCDetailAttachmentRepository { get; set; }
- public SOCTemplateRepository SOCTemplateRepository { get; set; }
- public SchoolyearRepository schoolyearRepository { get; set; }
- public CoursematerialRepository coursematerialRepository { get; set; }
- public EducationMissionRepository educationMissionRepository { get; set; }
- public EducationMissionClassRepository educationMissionClassRepository { get; set; }
- public SOCDetailStudentRepository SOCDetailStudentRepository { get; set; }
- public SOCDetailStudentScoreRepository SOCDetailStudentScoreRepository { get; set; }
- public IQueryable<SOCDetailView> GetSOCDetailViewQueryable(Expression<Func<DQP_SOCDetail, bool>> exp)
- {
- var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current;
- //exp = exp.And(x => x.CreateUserID == curUser.UserID);
- var query = from detail in SOCDetailRepository.GetList(exp)
- join edu in educationMissionRepository.Entities
- on detail.DQP_SOC.EducationMissionID equals edu.EducationMissionID
- into dedu
- from edu in dedu.DefaultIfEmpty()
- select new SOCDetailView
- {
- SOCDetailID = detail.SOCDetailID,
- EducationMissionID = detail.DQP_SOC.EducationMissionID,
- EducationMissionName = edu.ClassName,
- SOCID = detail.SOCID,
- DepartmentID = detail.DQP_SOC.DepartmentID,
- SchoolyearID = detail.DQP_SOC.SchoolyearID,
- SchoolyearCode = detail.DQP_SOC.CF_Schoolyear.Code,
- CoursematerialID = detail.DQP_SOC.CoursematerialID,
- CourseCode = detail.DQP_SOC.EM_Coursematerial.CourseCode,
- CourseName = detail.DQP_SOC.EM_Coursematerial.CourseName,
- Name = detail.Name,
- Weight = detail.Weight,
- Credit = detail.Credit,
- Description = detail.Description,
- IsGroup = detail.IsGroup,
- IsGroupin = detail.IsGroup.Value,
- StartTime = detail.StartTime,
- EndTime = detail.EndTime,
- Attachment = detail.DQP_SOCDetailAttachment,
- GroupCount = detail.DQP_SOCDetailGroup.Count(),
- StudentCount = detail.DQP_SOC.CF_Student.Count,
- };
- return query;
- }
- public IOrderedQueryable<FileUploadView> GetSOCDetailAttachmentView(Expression<Func<DQP_SOCDetail, bool>> exp)
- {
- var tableName = typeof(DQP_SOCDetailAttachment).Name;
- var sql = (from @group in SOCDetailRepository.GetList(exp)
- from attachment in @group.DQP_SOCDetailAttachment
- orderby attachment.CreateTime descending
- select new FileUploadView
- {
- FileID = attachment.SOCDetailAttachmentID,
- FileName = attachment.Name,
- FileUrl = attachment.Url,
- FormID = attachment.SOCDetailID,
- TableName = tableName
- });
- return (IOrderedQueryable<FileUploadView>)sql;
- }
- }
- }
|