using System; using System.Collections.Generic; using System.Linq; using System.Text; using Bowin.Common.Linq.Entity; using EMIS.ViewModel.ExaminationManage; using EMIS.ViewModel; using System.Linq.Expressions; using EMIS.Entities; using Bowin.Common.Linq; using EMIS.DataLogic.ExaminationManage; namespace EMIS.CommonLogic.ExaminationManage { public class StudentExaminationCourseServices : BaseServices,IStudentExaminationCourseServices { public StudentExaminationCourseDAL studentExaminationCourseDAL { get; set; } public IGridResultSet GetStudentExaminationCourseViewList(ConfiguretView configuretView, Guid? schoolyearID, int? examsCategoryID, int? examinationModeID, int? examinationStyleID, Guid userID, int pageIndex, int pageSize) { Expression> exp = (x => x.RecordStatus == (int)EX_ExaminationPlanStatus.Submitted); if (schoolyearID.HasValue) { exp = exp.And(x => x.SchoolyearID == schoolyearID); } if (examsCategoryID.HasValue) { exp = exp.And(x => x.ExamsCategoryID == examsCategoryID); } if (examinationModeID.HasValue) { exp = exp.And(x => x.ExaminationModeID == examinationModeID); } if (examinationStyleID.HasValue) { exp = exp.And(x => x.ExaminationStyleID == examinationStyleID); } var query = studentExaminationCourseDAL.GetExaminationPlanView(exp, userID); if (!string.IsNullOrEmpty(configuretView.ConditionValue) && !string.IsNullOrEmpty(configuretView.Attribute)) query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue); var result = query.OrderBy(x => x.SchoolyearCode).ThenBy(x => x.ExaminationDate).ThenBy(x => x.StartTime).ToGridResultSet(pageIndex, pageSize); return result; } public List GetStudentExaminationCourseViewList(ConfiguretView configuretView, Guid? schoolyearID, int? examsCategoryID, int? examinationModeID, int? examinationStyleID, Guid userID, List selectIDlist) { Expression> exp = (x => x.RecordStatus == (int)EX_ExaminationPlanStatus.Submitted); if (schoolyearID.HasValue) { exp = exp.And(x => x.SchoolyearID == schoolyearID); } if (examsCategoryID.HasValue) { exp = exp.And(x => x.ExamsCategoryID == examsCategoryID); } if (examinationModeID.HasValue) { exp = exp.And(x => x.ExaminationModeID == examinationModeID); } if (examinationStyleID.HasValue) { exp = exp.And(x => x.ExaminationStyleID == examinationStyleID); } if (selectIDlist.Count > 0) { exp = exp.And(x => selectIDlist.Contains(x.ExaminationPlanID)); } var query = studentExaminationCourseDAL.GetExaminationPlanView(exp, userID); if (!string.IsNullOrEmpty(configuretView.ConditionValue) && !string.IsNullOrEmpty(configuretView.Attribute)) query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue); var result = query.OrderBy(x => x.SchoolyearCode).ThenBy(x => x.ExaminationDate).ThenBy(x => x.StartTime).ToList(); return result; } } }