using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMIS.DataLogic.Common.EvaluationManage; using Bowin.Common.Linq.Entity; using EMIS.ViewModel.EvaluationManage; using EMIS.ViewModel; using System.Linq.Expressions; using EMIS.Entities; using Bowin.Common.Linq; using Bowin.Common.Utility; using Bowin.Common.Mapping; using EMIS.CommonLogic.SystemServices; namespace EMIS.CommonLogic.EvaluationManage { public class EvaluationRecordServices : BaseServices, IEvaluationRecordServices { public EvaluationRecordDAL EvaluationRecordDAL { get; set; } public IGridResultSet GetEvaluationRecordViewGrid(ConfiguretView configuretView, Guid? campusID, Guid? collegeID, int? standardID, Guid? classmajorID, int? schoolyearCodeID, Guid? schoolyearID, Guid? evaluationTableID, Guid? typeID, int? learningformID, int? education, string LearnSystem, Guid? staffID, int pageIndex, int pageSize) { Expression> filter = x => true; var curUser = EMIS.Utility.FormValidate.CustomPrincipal.Current; var query = EvaluationRecordDAL.GetEvaluationRecordQuery(); if (curUser.CollegeID != null)//考虑到管理员院系ID为null { query = GetQueryByDataRangeByCollege(query);//以院系 区分 } if (schoolyearID.HasValue && schoolyearID != Guid.Empty) { query = query.Where(w => w.SchoolyearID == schoolyearID); } if (evaluationTableID.HasValue && evaluationTableID != Guid.Empty) { query = query.Where(w => w.EvaluationTableID == evaluationTableID); } if (typeID.HasValue && typeID != Guid.Empty) { query = query.Where(w => w.EvaluationTableTypeID == typeID); } if (staffID.HasValue && staffID != Guid.Empty) { query = query.Where(w => w.Sys_User.Any(x => x.UserID == (Guid)staffID)); } if (campusID.HasValue) { query = query.Where(x => x.CampusID == campusID); } if (standardID.HasValue) { query = query.Where(x => x.StandardID == standardID); } if (collegeID.HasValue) { query = query.Where(x => x.CollegeID == collegeID); } if (classmajorID.HasValue) { query = query.Where(x => x.EducationMissionClassID == classmajorID); } if (schoolyearCodeID.HasValue && schoolyearCodeID > 0) { query = query.Where(x => x.Grade == schoolyearCodeID); } if (learningformID.HasValue) query = query.Where(x => x.LearningformID == learningformID); if (!string.IsNullOrEmpty(LearnSystem) && LearnSystem != "-1") { var LearnSystems = Convert.ToDecimal(LearnSystem); query = query.Where(x => x.LearnSystem == LearnSystems); } if (education.HasValue) { query = query.Where(x => x.EducationID == education.Value); } if (!string.IsNullOrEmpty(configuretView.ConditionValue)) query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue); query = query.OrderByDescending(o => o.SchoolyearCode); return query.ToGridResultSet(pageIndex, pageSize); } public IList GetEvaluationRecordViewList(ConfiguretView configuretView, Guid? schoolyearID, Guid? collegeID, Guid? evaluationTableID, Guid? typeID, int? learningformID, int? education, string LearnSystem) { Expression> filter = x => true; var query = EvaluationRecordDAL.GetEvaluationRecordQuery(); if (schoolyearID.HasValue && schoolyearID != Guid.Empty) { query = query.Where(w => w.SchoolyearID == schoolyearID); } if (collegeID.HasValue) { query = query.Where(x => x.CollegeID == collegeID); } if (evaluationTableID.HasValue && evaluationTableID != Guid.Empty) { query = query.Where(w => w.EvaluationTableID == evaluationTableID); } if (typeID.HasValue && typeID != Guid.Empty) { query = query.Where(w => w.EvaluationTableTypeID == typeID); } if (learningformID.HasValue) query = query.Where(x => x.LearningformID == learningformID); if (!string.IsNullOrEmpty(LearnSystem) && LearnSystem != "-1") { var LearnSystems = Convert.ToDecimal(LearnSystem); query = query.Where(x => x.LearnSystem == LearnSystems); } if (education.HasValue) { query = query.Where(x => x.EducationID == education.Value); } if (!string.IsNullOrEmpty(configuretView.ConditionValue)) query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue); query = query.OrderByDescending(o => o.SchoolyearCode); return query.ToList(); } public void Delete(List ids) { try { //var evaluationEnterList = EvaluationRecordDAL.EvaluationEnterRepository.GetList(x => ids.Contains(x.EvaluationEnterID)); //evaluationEnterList.ForEach(x => { x.Remark = ""; }); //清除之前操作记录 //UnitOfWork.Commit();//提交操作! UnitOfWork.Delete(w => ids.Contains(w.EvaluationEnterID)); UnitOfWork.Delete(w => ids.Contains(w.EvaluationEnterID)); } catch (Exception ex) { throw; } } //根据评价表名、选中参评类型 public List GetEvaluationTypeByTableIDList(Guid? evaluationTableID) { var evaluationEnterList = EvaluationRecordDAL.GetEvaluationTypeQueryable(x => true); if (evaluationTableID != null) { evaluationEnterList = EvaluationRecordDAL.GetEvaluationTypeQueryable(x => x.EvaluationTableID == evaluationTableID); } return evaluationEnterList.Distinct().ToList(); } } }