123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157 |
- 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<EvaluationRecordView> 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<Func<EM_EvaluationSetting, bool>> 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<EvaluationRecordView>(pageIndex, pageSize);
- }
- public IList<EvaluationRecordView> GetEvaluationRecordViewList(ConfiguretView configuretView, Guid? schoolyearID, Guid? collegeID, Guid? evaluationTableID, Guid? typeID, int? learningformID, int? education, string LearnSystem)
- {
- Expression<Func<EM_EvaluationSetting, bool>> 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<Guid> ids)
- {
- try
- {
- //var evaluationEnterList = EvaluationRecordDAL.EvaluationEnterRepository.GetList(x => ids.Contains(x.EvaluationEnterID));
- //evaluationEnterList.ForEach(x => { x.Remark = ""; }); //清除之前操作记录
- //UnitOfWork.Commit();//提交操作!
- UnitOfWork.Delete<EM_EvaluationEnter_EM_EvaluationProject>(w => ids.Contains(w.EvaluationEnterID));
- UnitOfWork.Delete<EM_EvaluationEnter>(w => ids.Contains(w.EvaluationEnterID));
- }
- catch (Exception ex)
- {
- throw;
- }
- }
- //根据评价表名、选中参评类型
- public List<EvaluationTypeView> GetEvaluationTypeByTableIDList(Guid? evaluationTableID)
- {
- var evaluationEnterList = EvaluationRecordDAL.GetEvaluationTypeQueryable(x => true);
- if (evaluationTableID != null)
- {
- evaluationEnterList = EvaluationRecordDAL.GetEvaluationTypeQueryable(x => x.EvaluationTableID == evaluationTableID);
- }
- return evaluationEnterList.Distinct().ToList();
- }
- }
- }
|