using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMIS.ViewModel.EducationManage; using System.Linq.Expressions; using EMIS.Entities; using EMIS.DataLogic.Repositories; using EMIS.ViewModel.EducationManagement; namespace EMIS.DataLogic.EducationManage { public class EducationMissionClassCheckDAL { public EducationMissionClassCheckRepository educationMissionClassCheckRepository { get; set; } public EducationMissionClassRepository educationMissionClassRepository { get; set; } public EducationMissionRepository educationMissionRepository { get; set; } public EducationMissionClassTeachingSettingRepository educationMissionClassTeachingSettingRepository { get; set; } public EducationSchedulingRepository educationSchedulingRepository { get; set; } public EducationSchedulingClassRepository educationSchedulingClassRepository { get; set; } public EducationSchedulingWeekNumRepository educationSchedulingWeekNumRepository { get; set; } public CoursesTimeRepository coursesTimeRepository { get; set; } public ClassroomRepository classroomRepository { get; set; } public SchoolyearRepository schoolyearRepository { get; set; } public MissionClassTeacherRepository missionClassTeacherRepository { get; set; } public CoursematerialRepository coursematerialRepository { get; set; } public StaffRepository staffRepository { get; set; } public UserRepository userRepository { get; set; } public IQueryable GetEducationMissionClassCheckViewQueryble(Expression> emccexp, Expression> emexp, Expression> esexp, Expression> mctexp, Expression> emcexp, Expression> eswnexp) { var query = from edmcc in educationMissionClassCheckRepository.GetList(emccexp) join eswnr in educationSchedulingWeekNumRepository.GetList(eswnexp) on edmcc.EducationSchedulingWeekNumID equals eswnr.EducationSchedulingWeekNumID join esr in educationSchedulingRepository.GetList(esexp) on eswnr.EducationSchedulingID equals esr.EducationSchedulingID join escr in educationSchedulingClassRepository.Entities on esr.EducationSchedulingClassID equals escr.EducationSchedulingClassID join emcr in educationMissionClassRepository.GetList(emcexp) on escr.EducationMissionClassID equals emcr.EducationMissionClassID join cou in coursematerialRepository.Entities on emcr.CoursematerialID equals cou.CoursematerialID join emr in educationMissionRepository.GetList(emexp) on emcr.EducationMissionID equals emr.EducationMissionID join sch in schoolyearRepository.Entities on emr.SchoolyearID equals sch.SchoolyearID join ctr in coursesTimeRepository.Entities on esr.CoursesTimeID equals ctr.CoursesTimeID join cr in classroomRepository.Entities on esr.ClassroomID equals cr.ClassroomID select new EducationMissionClassCheckView { EducationMissionClassCheckID = edmcc.EducationMissionClassCheckID, EducationSchedulingWeekNumID = edmcc.EducationSchedulingWeekNumID, EducationMissionClassID = emcr.EducationMissionClassID, EducationSchedulingID = esr.EducationSchedulingID, EducationMissionClassName = emcr.Name, CoursematerialID = cou.CoursematerialID, CourseName = cou.CourseName, CollegeID = emr.CollegeID, WeekNum = eswnr.WeekNum, Weekday = esr.Weekday, CoursesTimeID = esr.CoursesTimeID, StartTimes = ctr.StartTimes, EndTimes = ctr.EndTimes, ClassroomID = esr.ClassroomID, ClassroomName = cr.Name, ClassroomCode = cr.Code, SchoolyearID = emr.SchoolyearID, SchoolyearCode = sch.Code, StudentComment = edmcc.StudentComment, TeacherComment = edmcc.TeacherComment, DeviceComment = edmcc.DeviceComment, CheckWayID = edmcc.CheckWayID, OpinionID = edmcc.OpinionID, Sys_User = edmcc.Sys_User, Remark = edmcc.Remark }; return query; } public EducationMissionClassCheckView GetEducationMissionClassCheckView(Guid? educationMissionClassCheckID) { var query = from edmcc in educationMissionClassCheckRepository.GetList(x => x.EducationMissionClassCheckID == educationMissionClassCheckID) join eswnr in educationSchedulingWeekNumRepository.Entities on edmcc.EducationSchedulingWeekNumID equals eswnr.EducationSchedulingWeekNumID join esr in educationSchedulingRepository.Entities on eswnr.EducationSchedulingID equals esr.EducationSchedulingID join escr in educationSchedulingClassRepository.Entities on esr.EducationSchedulingClassID equals escr.EducationSchedulingClassID join emcr in educationMissionClassRepository.Entities on escr.EducationMissionClassID equals emcr.EducationMissionClassID join mctr in missionClassTeacherRepository.Entities on emcr.EducationMissionClassID equals mctr.MissionClassID join emr in educationMissionRepository.Entities on emcr.EducationMissionID equals emr.EducationMissionID join sch in schoolyearRepository.Entities on emr.SchoolyearID equals sch.SchoolyearID join ctr in coursesTimeRepository.Entities on esr.CoursesTimeID equals ctr.CoursesTimeID join cr in classroomRepository.Entities on esr.ClassroomID equals cr.ClassroomID select new EducationMissionClassCheckView { EducationMissionClassCheckID = edmcc.EducationMissionClassCheckID, EducationSchedulingWeekNumID = edmcc.EducationSchedulingWeekNumID, EducationMissionClassID = emcr.EducationMissionClassID, EducationSchedulingID = esr.EducationSchedulingID, WeekNum = eswnr.WeekNum, Weekday = esr.Weekday, CoursesTimeID = esr.CoursesTimeID, StartTimes = ctr.StartTimes, EndTimes = ctr.EndTimes, ClassroomID = esr.ClassroomID, ClassroomName = cr.Name, ClassroomCode = cr.Code, SchoolyearID = emr.SchoolyearID, SchoolyearCode = sch.Code, StudentComment = edmcc.StudentComment, TeacherComment = edmcc.TeacherComment, DeviceComment = edmcc.DeviceComment, CheckWayID = edmcc.CheckWayID, OpinionID = edmcc.OpinionID, Remark = edmcc.Remark }; return query.ToList().FirstOrDefault(); } public List GetTeacherByEducationSchedulingID(Expression> exp) { var query = from ec in educationSchedulingRepository.GetList(exp) from tea in ec.ES_EducationSchedulingTeacher select new MissionClassTeacherView { UserID = tea.CF_Staff.UserID, EducationSchedulingID = ec.EducationSchedulingID, EducationMissionClassID = ec.EM_EducationSchedulingClass.EducationMissionClassID, Name = tea.CF_Staff.Sys_User.Name, TeachingMethod = tea.TeachingMethod }; return query.OrderBy(x => x.TeachingMethod).ToList(); } public List GetTeacherNameQuery(Expression> exp, Expression> eswnexp) { var query = from ec in educationSchedulingRepository.GetList(exp) join eswn in educationSchedulingWeekNumRepository.GetList(eswnexp) on ec.EducationSchedulingID equals eswn.EducationSchedulingID from tea in ec.ES_EducationSchedulingTeacher select new MissionClassTeacherView { UserID = tea.CF_Staff.UserID, EducationSchedulingID = ec.EducationSchedulingID, EducationMissionClassID = ec.EM_EducationSchedulingClass.EducationMissionClassID, Name = tea.CF_Staff.Sys_User.Name, TeachingMethod = tea.TeachingMethod }; return query.OrderBy(x => x.TeachingMethod).ToList(); } public List GetMissionClassTeacherQuery(Expression> exp) { var query = (from emc in educationMissionClassRepository.GetList(exp) from tec in emc.EM_MissionClassTeacher select new MissionClassTeacherView { UserID = tec.CF_Staff.UserID, EducationMissionClassID = emc.EducationMissionClassID, Name = tec.CF_Staff.Sys_User.Name, TeachingMethod = tec.TeachType }); return query.OrderBy(x => x.EducationMissionClassID).OrderBy(x => x.TeachingMethod).ToList(); } public IQueryable GetEducationMissionClassViewByConditionQueryble(Expression> emcexp, Expression> emexp, Expression> eswnexp, Expression> esexp) { var query = from emsr in educationMissionClassRepository.GetList(emcexp) join emr in educationMissionRepository.GetList(emexp) on emsr.EducationMissionID equals emr.EducationMissionID join cour in coursematerialRepository.Entities on emsr.CoursematerialID equals cour.CoursematerialID join escr in educationSchedulingClassRepository.Entities on emsr.EducationMissionClassID equals escr.EducationMissionClassID join esr in educationSchedulingRepository.GetList(esexp) on escr.EducationSchedulingClassID equals esr.EducationSchedulingClassID join eswnr in educationSchedulingWeekNumRepository.GetList(eswnexp) on esr.EducationSchedulingID equals eswnr.EducationSchedulingID select new EducationMissionClassView { EducationMissionClassID = emsr.EducationMissionClassID, CoursematerialID = emsr.CoursematerialID, CourseName = cour.CourseName, Name = emsr.Name, }; return query; } public Guid GetEducationSchedulingWeekNumID(int? weekNum, int? weekDay, Guid? coursesTimeID, Guid? classroomID, Guid educationMissionClassID) { var query = from escr in educationSchedulingClassRepository.GetList(x => x.EducationMissionClassID == educationMissionClassID) join esr in educationSchedulingRepository.GetList(x => x.CoursesTimeID == coursesTimeID && x.Weekday == weekDay && x.ClassroomID == classroomID) on escr.EducationSchedulingClassID equals esr.EducationSchedulingClassID join eswnr in educationSchedulingWeekNumRepository.GetList(x => x.WeekNum == weekNum) on esr.EducationSchedulingID equals eswnr.EducationSchedulingID select new { EducationSchedulingWeekNumID = eswnr.EducationSchedulingWeekNumID, }; return query.Select(x => x.EducationSchedulingWeekNumID).FirstOrDefault(); } /// /// 获取教学检查检查人员 /// /// /// public IQueryable GetEducationMissionClassCheckTeacherListViewQueryble(Guid educationMissionClassCheckID) { var query = from emcc in educationMissionClassCheckRepository.GetList(x => x.EducationMissionClassCheckID == educationMissionClassCheckID) from staff in emcc.Sys_User select new EducationMissionClassCheckTeacherView { CheckTeacherID = staff.UserID, EducationMissionClassCheckID = emcc.EducationMissionClassCheckID, UserID = staff.CF_Staff.UserID, LoginID = staff.CF_Staff.Sys_User.LoginID, Name = staff.CF_Staff.Sys_User.Name, CollegeID = staff.CF_Staff.CF_College.CollegeID, CollegeName = staff.CF_Staff.CF_College.Name, Sex = staff.CF_Staff.SexID, DepartmentID = staff.CF_Staff.DepartmentID, DepartmentName = staff.CF_Staff.CF_Department.Name, BirthDate = staff.CF_Staff.BirthDate, TeacherType = staff.CF_Staff.TeacherTypeID, IncumbencyState = staff.CF_Staff.IncumbencyState, Title = staff.CF_Staff.TitleID, }; return query; } } }