123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- using EMIS.DataLogic.Repositories;
- using EMIS.Entities;
- using EMIS.ViewModel.ProjectShareManage;
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Linq.Expressions;
- using System.Text;
- using System.Threading.Tasks;
- namespace EMIS.DataLogic.ProjectShareManage
- {
- public class ShareRecordDAL
- {
- public ShareRecordRepository shareRecordRepository { get; set; }
- public AnnouncementRepository announcementRepository { get; set; }
- public UserRepository userRepository { get; set; }
- public ClassmajorRepository classmajorRepository { get; set; }
- public StudentRepository studentRepository { get; set; }
- public WechatSubscribeRepository wechatSubscribeRepository { get; set; }
- public IQueryable<ShareRecordView> GetShareRecordView(Expression<Func<Sys_ShareRecord, bool>> shareExp)
- {
- var query = from sr in shareRecordRepository.GetList(shareExp)
- from ann in announcementRepository.Entities.Where(x => x.AnnouncementID == sr.AnnouncementID)
- from user in userRepository.Entities.Where(x => x.UserID == sr.UserID)
- from stu in studentRepository.Entities.Where(x => x.UserID == user.UserID)
- from cla in classmajorRepository.Entities.Where(x => x.ClassmajorID == stu.ClassmajorID).DefaultIfEmpty()
- select new ShareRecordView
- {
- ShareRecordID = sr.ShareRecordID,
- DateTime = sr.DateTime,
- AnnouncementID = sr.AnnouncementID,
- Title = ann.Title,
- UserID = sr.UserID,
- OpenID = sr.OpenID,
- UserName = user.Name,
- ClassmajorID = cla.ClassmajorID,
- ClassmajorName = cla.Name,
- Count = 1,
- RecordStatus = sr.RecordStatus,
- CreateUserID = sr.CreateUserID,
- CreateTime = sr.CreateTime,
- ModifyUserID = sr.ModifyUserID,
- ModifyTime = sr.ModifyTime
- };
- return query;
- }
- }
- }
|