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 SCalendarDAL
{
public SCalendarRepository scalendarRepository { get; set; }
public DictionaryItemRepository dictionaryItemRepository { get; set; }
///
/// 读取校历信息
///
///
///
public IQueryable GetSCalendarQueryable(Expression> exp)
{
var query = from a in scalendarRepository.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 SCalendarView
{
ActivitiesID = a.ActivitiesID,
Name = a.Name,
ActivitiesTime = a.ActivitiesTime,
TimesSegment = a.TimesSegment,
TimesSegmentName = gicbsta.Name,
ActivitiesContent = a.ActivitiesContent,
ActivitiesType = a.ActivitiesType,
ActivitiesTypeName = gicbty.Name,
CreateUserID = a.CreateUserID,
CreateTime = a.CreateTime
};
return query;
}
}
}