using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMIS.DataLogic.Repositories; using System.Linq.Expressions; using EMIS.Entities; using EMIS.ViewModel.CalendarManage; namespace EMIS.DataLogic.Common.CalendarManage { public class ActivitieDAL { public ActivitiesSetsRepository activitiesSetsRepository { get; set; } public DictionaryItemRepository dictionaryItemRepository { get; set; } /// /// 读取固定活动信息 /// /// /// public IQueryable GetActivitiesQueryable(Expression> exp) { var query = from a in activitiesSetsRepository.GetList(exp) join b in dictionaryItemRepository.Entities on new { a.ActivitiesType, DictionaryCode = "CF_ActivitiesType" } equals new { ActivitiesType = b.Value, b.DictionaryCode } into gbty from gicbty in gbty.DefaultIfEmpty() join c in dictionaryItemRepository.Entities on new { a.TimesSegment, DictionaryCode = "CF_TimesSegment" } equals new { TimesSegment = c.Value.Value, c.DictionaryCode } into gbsta from gicbsta in gbsta.DefaultIfEmpty() select new ActivitieView { ActivitiesID = a.ActivitiesID, Name = a.Name, ActivitiesTime = a.ActivitiesTimeMonth+"-"+a.ActivitiesTimeDay, ActivitiesTimeMonth=a.ActivitiesTimeMonth, ActivitiesTimeDay=a.ActivitiesTimeDay, TimesSegment = a.TimesSegment, TimesSegmentName = gicbsta.Name, ActivitiesContent = a.ActivitiesContent, ActivitiesType = a.ActivitiesType, ActivitiesTypeName = gicbty.Name, CreateUserID = a.CreateUserID, CreateTime = a.CreateTime }; return query; } } }