using System; using System.Collections.Generic; using System.Linq; using System.Text; using Bowin.Common.Linq; using Bowin.Common.Linq.Entity; using EMIS.ViewModel.EvaluationManage; using EMIS.ViewModel; using EMIS.DataLogic.Common.EvaluationManage; using System.Linq.Expressions; using EMIS.Entities; namespace EMIS.CommonLogic.EvaluationManage { public class StudentEvaluationCountServices : BaseServices, IStudentEvaluationCountServices { public StudentEvaluationCountDAL StudentEvaluationCountDAL { get; set; } public IGridResultSet GetStudentView(ConfiguretView configuretView, int? schoolyearNumID, Guid? collegeID, Guid? schoolyearID, int? standardID, Guid? classID, int pageIndex, int pageSize) { Expression> filter = x => true; if (schoolyearID.HasValue && schoolyearID != Guid.Empty) { filter = filter.And(x => x.SchoolyearID == schoolyearID); } var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current; var query = StudentEvaluationCountDAL.GetStudentView(filter); query = query.OrderBy(x => x.ClassmajorID).ThenBy(x => x.StudentNo); if (!string.IsNullOrEmpty(configuretView.ConditionValue)) query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue); if (schoolyearNumID.HasValue) { query = query.Where(x => x.SchoolyearNumID == schoolyearNumID); } if (collegeID.HasValue) { query = query.Where(x => x.CollegeID == collegeID); } if (standardID.HasValue&&standardID>0) { query = query.Where(x => x.StandardID == standardID); } if (classID.HasValue) { query = query.Where(x => x.ClassmajorID == classID); } return query.ToGridResultSet(pageIndex, pageSize); } public IList GetStudentView(ConfiguretView configuretView, int? schoolyearNumID, Guid? collegeID, Guid? schoolyearID, int? standardID, Guid? classID) { Expression> filter = x => true; if (schoolyearID.HasValue && schoolyearID != Guid.Empty) { filter = filter.And(x => x.SchoolyearID == schoolyearID); } var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current; var query = StudentEvaluationCountDAL.GetStudentView(filter); if (!string.IsNullOrEmpty(configuretView.ConditionValue)) query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue); if (schoolyearNumID.HasValue) { query = query.Where(x => x.SchoolyearNumID == schoolyearNumID); } if (collegeID.HasValue) { query = query.Where(x => x.CollegeID == collegeID); } //if (schoolyearID.HasValue) //{ // query = query.Where(x => x.SchoolyearID == schoolyearID); //} if (standardID.HasValue) { query = query.Where(x => x.StandardID == standardID); } if (classID.HasValue) { query = query.Where(x => x.ClassmajorID == classID); } query = query.OrderByDescending(o => o.SchoolyearID); return query.ToList(); } } }