using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMIS.ViewModel.SelectCourse; using EMIS.DataLogic.Repositories; using System.Linq.Expressions; using EMIS.Entities; using EMIS.ViewModel; namespace EMIS.DataLogic.SelectCourse { public class TypeSettingDAL { public SelectCourseTypeSettingRepository SelectCourseTypeSettingRepository { get; set; } public SchoolyearRepository SchoolyearRepository { get; set; } public DictionaryItemRepository DictionaryItemRepository { get; set; } public IQueryable GetTypeSettingView(Expression> typeSettingExp, Expression> schoolYearExp) { var q = (from scts in SelectCourseTypeSettingRepository.GetList(typeSettingExp) join sy in SchoolyearRepository.GetList(schoolYearExp) on scts.SchoolyearID equals sy.SchoolyearID join disct in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(EM_SelectCourseType).Name) on scts.SelectCourseTypeID equals disct.Value into ddisct from edisct in ddisct.DefaultIfEmpty() join dirs in DictionaryItemRepository.GetList(x => x.DictionaryCode == typeof(SYS_STATUS).Name) on scts.RecordStatus equals dirs.Value into ddirs from edirs in ddirs.DefaultIfEmpty() select new SelectCourseTypeSettingView { SelectCourseTypeSettingID = scts.SelectCourseTypeSettingID, SchoolyearID = scts.SchoolyearID, SchoolyearCode = sy.Code, SelectCourseTypeID = scts.SelectCourseTypeID, SelectCourseTypeDesc = edisct.Name, StartTime = scts.StartTime, EndTime = scts.EndTime, MaxSelectCount = scts.MaxSelectCount, MinSelectCount = scts.MinSelectCount, MaxCredit = scts.MaxCredit, MinCredit = scts.MinCredit, Remark = scts.Remark, RecordStatus = scts.RecordStatus, RecordStatusDesc = edirs.Name, CreateUserID = scts.CreateUserID, CreateTime = scts.CreateTime, ModifyUserID = scts.ModifyUserID, ModifyTime = scts.ModifyTime }); return q; } } }