using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; using System.Text; using Bowin.Common.Linq; using Bowin.Common.Linq.Entity; using EMIS.Entities; using EMIS.ViewModel; using EMIS.ViewModel.StudentManage.StudentChange; using EMIS.DataLogic.StudentManage.StudentChange; using EMIS.CommonLogic.SystemServices; namespace EMIS.CommonLogic.StudentManage.StudentChange { public class ChangeTotalServices : BaseWorkflowServices, IChangeTotalServices { public Lazy StudentChangeDAL { get; set; } /// /// 查询对应的异动统计信息ChangeTotalView /// /// /// /// /// /// /// /// public IGridResultSet GetChangeTotalViewGrid(ConfiguretView configuretView, Guid? schoolyearID, Guid? campusID, Guid? collegeID, int pageIndex, int pageSize) { var endApproveStatusID = this.GetCorrectEndStatus(); Expression> expStudentChange = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE); expStudentChange = expStudentChange.And(x => x.ApprovalStatus == endApproveStatusID); if (schoolyearID.HasValue) { expStudentChange = expStudentChange.And(x => x.SchoolyearID == schoolyearID); } var query = StudentChangeDAL.Value.GetChangeTotalViewQueryable(expStudentChange); if (campusID.HasValue) { query = query.Where(x => x.CampusID == campusID); } if (collegeID.HasValue) { query = query.Where(x => x.CollegeID == collegeID); } if (!string.IsNullOrEmpty(configuretView.ConditionValue)) { query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim()); } var result = this.GetQueryByDataRangeByCollege(query).OrderBy(x => x.CampusCode).ThenBy(x => x.CollegeNo).ToGridResultSet(pageIndex, pageSize); return result; } /// /// 查询对应的异动统计信息List /// /// /// /// /// /// public IList GetChangeTotalViewList(ConfiguretView configuretView, Guid? schoolyearID, Guid? campusID, Guid? collegeID) { var endApproveStatusID = this.GetCorrectEndStatus(); Expression> expStudentChange = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE); expStudentChange = expStudentChange.And(x => x.ApprovalStatus == endApproveStatusID); if (schoolyearID.HasValue) { expStudentChange = expStudentChange.And(x => x.SchoolyearID == schoolyearID); } var query = StudentChangeDAL.Value.GetChangeTotalViewQueryable(expStudentChange); if (campusID.HasValue) { query = query.Where(x => x.CampusID == campusID); } if (collegeID.HasValue) { query = query.Where(x => x.CollegeID == collegeID); } if (!string.IsNullOrEmpty(configuretView.ConditionValue)) { query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim()); } var result = this.GetQueryByDataRangeByCollege(query).OrderBy(x => x.CampusCode).ThenBy(x => x.CollegeNo).ToList(); return result; } } }