1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- 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; }
- /// <summary>
- /// 读取学年学期信息
- /// </summary>
- /// <param name="exp"></param>
- /// <returns></returns>
- public IQueryable<SchoolYearView> GetSchoolYearQueryable(Expression<Func<CF_Schoolyear, bool>> exp)
- {
- var query = from a in schoolyearRepository.GetList(exp)
- join c in dictionaryItemRepository.Entities on new { a.SchoolcodeID, DictionaryCode = "CF_Semester" }
- 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<SchoolYearView> GetYearsQueryable(Expression<Func<CF_Schoolyear, bool>> exp)
- {
- var query = from a in schoolyearRepository.GetList(exp).Distinct()
-
- select new SchoolYearView
- {
- Years = a.Years,
-
- };
- return query;
- }
- }
- }
|