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 DutyDAL { public dutyRepository dutyRepository { get; set; } public UserRepository userRepository { get; set; } public DepartmentRepository departmentRepository { get; set; } public DictionaryItemRepository dictionaryItemRepository { get; set; } /// /// 读取值班管理信息 /// /// /// public IQueryable GetDutyQueryable(Expression> exp) { var query = from a in dutyRepository.GetList(exp) join b in userRepository.Entities on a.UserID equals b.UserID join c in departmentRepository.Entities on a.DepartmentID equals c.DepartmentID join d in dictionaryItemRepository.Entities on new { a.TimesSegment, DictionaryCode = "CF_TimesSegment" } equals new { TimesSegment = d.Value.Value, d.DictionaryCode } into gbsta from gicbsta in gbsta.DefaultIfEmpty() select new DutyView { DutyID = a.DutyID, UserID = a.UserID, LoginID = b.LoginID, UserName = b.Name, TimesSegment = a.TimesSegment, TimesSegmentName = gicbsta.Name, DutyTime = a.DutyTime, StartHour = a.StartHour, StartMinutes = a.StartMinutes, StartDate = a.StartHour + ":" + (a.StartMinutes == 0 ? "00" : a.StartMinutes.ToString()), EndHour = a.EndHour, EndMinutes = a.EndMinutes, EndDate = a.EndHour + ":" + (a.EndMinutes == 0 ? "00" : a.EndMinutes.ToString()), Description = a.Description, CollegeID= c.CollegeID, CampusID=c.CF_College.CampusID, DepartmentID = a.DepartmentID, DepartmentName = c.Name, CreateUserID = a.CreateUserID, CreateTime = a.CreateTime }; return query; } } }