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 TeacherEvaluationCountServices:BaseServices, ITeacherEvaluationCountServices { public TeacherEvaluationCountDAL TeacherEavluationCountDAL { get; set; } public IGridResultSet GetTeacherView(ViewModel.ConfiguretView configuretView, Guid? collegeID, Guid? schoolyearID, Guid? typeID, Guid? departmentID, int pageIndex, int pageSize) { Expression> filter = x => true; Expression> espset = x => true; if (schoolyearID.HasValue && schoolyearID != Guid.Empty) { filter = filter.And(x => x.SchoolyearID == schoolyearID); } if (typeID.HasValue && typeID != Guid.Empty) { espset = espset.And(x => x.EvaluationTypeID == typeID); } var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current; var query = TeacherEavluationCountDAL.GetTeacherView(filter, espset); query = query.OrderBy(x => x.TeacherNo); if (!string.IsNullOrEmpty(configuretView.ConditionValue)) query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue); if (collegeID.HasValue) { query = query.Where(x => x.CollegeID == collegeID); } //if (typeID.HasValue) //{ // query = query.Where(x => x.EvaluationTypeID == typeID); //} if (departmentID.HasValue) { query = query.Where(x => x.DepartmentID == departmentID); } return query.ToGridResultSet(pageIndex, pageSize); } public IList GetTeacherView(ViewModel.ConfiguretView configuretView, Guid? collegeID, Guid? schoolyearID, Guid? typeID, Guid? departmentID) { Expression> filter = x => true; Expression> espset = x => true; if (schoolyearID.HasValue && schoolyearID != Guid.Empty) { filter = filter.And(x => x.SchoolyearID == schoolyearID); } if (typeID.HasValue && typeID != Guid.Empty) { espset = espset.And(x => x.EvaluationTypeID == typeID); } var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current; var query = TeacherEavluationCountDAL.GetTeacherView(filter, espset); //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 (collegeID.HasValue) { query = query.Where(x => x.CollegeID == collegeID); } //if (typeID.HasValue) //{ // query = query.Where(x => x.EvaluationTypeID == typeID); //} if (departmentID.HasValue) { query = query.Where(x => x.DepartmentID == departmentID); } return query.ToList(); } } }