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; using Bowin.Common.DataTime; namespace EMIS.DataLogic.Common.CalendarManage { public class SchoolYearDAL { public SchoolyearRepository schoolyearRepository { get; set; } public DictionaryItemRepository dictionaryItemRepository { get; set; } /// /// 读取学年学期信息 /// /// /// public IQueryable GetSchoolYearQueryable(Expression> exp) { var query = from a in schoolyearRepository.GetList(exp) join c in dictionaryItemRepository.Entities on new { a.SchoolcodeID, DictionaryCode = "CF_Schoolcode" } equals new { SchoolcodeID = c.Value.Value, c.DictionaryCode } into gbsta from gicbsta in gbsta.DefaultIfEmpty() select new SchoolYearView { SchoolYearID = a.SchoolyearID, Code = a.Code, Years = a.Years, SchoolcodeID = a.SchoolcodeID, SchoolcodeName = gicbsta.Name, FullName = a.Years.ToString() + "学年" + gicbsta.Name, WeeksNum = a.WeeksNum, FirstWeek = (DateTime)a.FirstWeek, IsCurrent = a.IsCurrent, Current = a.IsCurrent == true ? "是" : "否", WeekDays = a.WeekDays, CreateUserID = a.CreateUserID, CreateTime = a.CreateTime, Value = a.Value }; return query; } public IQueryable GetYearsQueryable(Expression> exp) { var query = from a in schoolyearRepository.GetList(exp).Distinct() select new SchoolYearView { Years = a.Years, }; return query; } } }