using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMIS.DataLogic.Common.EvaluationManage; using Bowin.Common.Linq; using Bowin.Common.Linq.Entity; using EMIS.Entities; using EMIS.ViewModel; using System.Linq.Expressions; using EMIS.ViewModel.EvaluationManage; namespace EMIS.CommonLogic.EvaluationManage { public class EvaluationTeacherScoreServices: BaseServices, IEvaluationTeacherScoreServices { public EvaluationTeacherScoreDAL EvaluationTeacherScoreDAL { get; set; } public EvaluationTypeDAL EvaluationTypeDAL { get; set; } public IGridResultSet GetEvaluationTeacherScoreViewGrid(ConfiguretView configuretView, Guid? schoolYearID, Guid? evaluationIntTypeID, Guid? evaluationTableTypeID, Guid? collegeID, Guid? DepartmentID, int pageIndex, int pageSize) { var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current; Expression> expmct = x => true; Expression> expTable = x => true; if (evaluationIntTypeID.HasValue && evaluationIntTypeID != Guid.Empty) { expTable = expTable.And(x => x.EvaluationIntTypeID == evaluationIntTypeID); } if (evaluationTableTypeID.HasValue && evaluationTableTypeID != Guid.Empty) { expTable = expTable.And(x => x.EvaluationTypeID == evaluationTableTypeID); //expTable = expTable.And(x => x.TypeID == evaluationTableTypeID); } if (schoolYearID.HasValue && schoolYearID != Guid.Empty) { expmct = expmct.And(x => x.EM_EducationMissionClass.EM_EducationMission.CF_Schoolyear.SchoolyearID == schoolYearID); } var query = EvaluationTeacherScoreDAL.GetEvaluationTeacherScoreQuery(expmct, expTable, schoolYearID); if (collegeID.HasValue) { query = query.Where(x => x.CollegeID == collegeID); } if (DepartmentID.HasValue) { query = query.Where(x => x.DepartmentID == DepartmentID); } if (!string.IsNullOrEmpty(configuretView.ConditionValue)) query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue); query = this.GetQueryByDataRange(query, (x => x.UserID)); //query2 = query2.OrderByDescending(x => x.TeacherNo); return query.OrderBy(x => x.CollegeRanking).ThenBy(x => x.DepartmentRanking).ToGridResultSet(pageIndex, pageSize); } public IList GetEvaluationTeacherScoreViewList(ConfiguretView configuretView, Guid? schoolYearID, Guid? evaluationIntTypeID, Guid? evaluationTableTypeID, Guid? collegeID, Guid? DepartmentID) { var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current; Expression> expmct = x => true; Expression> expTable = x => true; if (evaluationIntTypeID.HasValue && evaluationIntTypeID != Guid.Empty) { expTable = expTable.And(x => x.EvaluationIntTypeID == evaluationIntTypeID); } if (evaluationTableTypeID.HasValue && evaluationTableTypeID != Guid.Empty) { expTable = expTable.And(x => x.EvaluationTypeID == evaluationTableTypeID); } if (schoolYearID.HasValue && schoolYearID != Guid.Empty) { expmct = expmct.And(x => x.EM_EducationMissionClass.EM_EducationMission.CF_Schoolyear.SchoolyearID == schoolYearID); } var query = EvaluationTeacherScoreDAL.GetEvaluationTeacherScoreQuery(expmct, expTable, schoolYearID); if (collegeID.HasValue) { query = query.Where(x => x.CollegeID == collegeID); } if (DepartmentID.HasValue) { query = query.Where(x => x.DepartmentID == DepartmentID); } if (!string.IsNullOrEmpty(configuretView.ConditionValue)) query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue); //query2 = query2.OrderByDescending(x => x.TeacherNo); return query.OrderBy(x => x.CollegeRanking).ThenBy(x => x.DepartmentRanking).ToList(); } public Guid? GetEvaluaitonTableTypeID() { Expression> expTable = x => true; expTable = expTable.And(x => x.Name.Equals("学生评")); var query = EvaluationTypeDAL.GetEvaluationTypeQueryable(expTable); return query.First().TypeID; } } }