123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.CommonLogic.SystemServices;
- using EMIS.Entities;
- using Bowin.Common.Linq.Entity;
- using EMIS.ViewModel.SystemView;
- using EMIS.ViewModel.TeachingMaterial;
- using EMIS.DataLogic.Common.TeachingMaterial;
- using EMIS.ViewModel;
- using Bowin.Common.Linq;
- using System.Linq.Expressions;
- using EMIS.ViewModel.WorkflowManage;
- namespace EMIS.CommonLogic.TeachingMaterial
- {
- public class TeachersOrderExamineServices : BaseWorkflowServices<ET_TeachersOrder>, ITeachersOrderExamineServices
- {
- public TeachersOrderDAL TeachersOrderDAL { get; set; }
- public IGridResultSet<ViewModel.TeachingMaterial.TeachersOrderView> GetTeachersOrderViewGrid(ViewModel.ConfiguretView configuretView, Guid? schoolyearID, Guid? collegeID, Guid? coursematerialID, Guid? publishID, int? ApprovalStatus, int pageIndex, int pageSize)
- {
- var statusList = this.GetStatusViewList();
- var approveStatusList = this.GetApproveStatusViewList().Select(x => x.ID).ToList();
- Expression<Func<ET_TeachersOrder, bool>> exp = (x => approveStatusList.Contains(x.ApprovalStatus));
- if (schoolyearID.HasValue)
- exp = exp.And(x => x.SchoolyearID == schoolyearID);
- if (collegeID.HasValue)
- exp = exp.And(x => x.CollegeID == collegeID);
- if (coursematerialID.HasValue)
- exp = exp.And(x => x.CF_TeachingMaterialPool.EM_Coursematerial.Any(w => w.CoursematerialID == coursematerialID));
- if (publishID.HasValue)
- exp = exp.And(x => x.CF_TeachingMaterialPool.PublishID == publishID);
- if (ApprovalStatus.HasValue)
- exp = exp.And(x => x.ApprovalStatus == ApprovalStatus);
- var query = TeachersOrderDAL.GetTeachingOrderGridView(exp);
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- //return this.GetQueryByDataRangeByCollege(query).DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue).OrderBy(x => x.TeachingMaterialCode.Length).ThenBy(x => x.TeachingMaterialCode).ToGridResultSet<TeachersOrderView>(pageIndex, pageSize);
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue).OrderBy(x => x.CreateTime);
- var result = this.GetQueryByDataRangeByCollege(query).OrderBy(x => x.TeachingMaterialCode.Length).ThenBy(x => x.TeachingMaterialCode).ToGridResultSet<TeachersOrderView>(pageIndex, pageSize);
- result.rows.ForEach(x => x.ApproveStatusName = statusList.Where(w => w.ID == x.ApproveStatus).Select(w => w.Name).FirstOrDefault());
- return result;
- }
- public List<ViewModel.TeachingMaterial.TeachersOrderView> GetTeachersOrderViewList(ViewModel.ConfiguretView configuretView, Guid? schoolyearID, Guid? collegeID, Guid? coursematerialID, Guid? publishID, int? ApprovalStatus)
- {
- throw new NotImplementedException();
- }
- /// <summary>
- /// 提交审核
- /// </summary>
- /// <param name="planApplicationIDs"></param>
- /// <param name="userID"></param>
- /// <param name="comment"></param>
- public void SubmitTeachersOrderExamine(List<Guid> planApplicationIDs, Guid userID, string comment = "")
- {
- try
- {
- StartUp(planApplicationIDs, userID, comment);
- }
- catch (Exception)
- {
- throw;
- }
- }
- public List<ActionView> GetAuditingActionView(Guid formID, Guid userID)
- {
- return GetActionView(formID, userID);
- }
- public IGridResultSet<ViewModel.SystemView.WorkflowApproveHistoryView> GetWorkflowApproveHistoryView(Guid? planApplicationID)
- {
- var query = GetApproveHistoryViewList((Guid)planApplicationID).ToList().OrderBy(x => x.PID);
- return query.AsQueryable<WorkflowApproveHistoryView>().ToGridResultSet<WorkflowApproveHistoryView>(0, 100);
- }
- /// <summary>
- /// 获取征订详细
- /// </summary>
- /// <param name="teachersOrderID"></param>
- /// <returns></returns>
- public TeachersOrderView GetTeachersOrderExamineView(Guid? teachersOrderID)
- {
- var statusList = this.GetStatusViewList();
- var result = TeachersOrderDAL.GetTeachingOrderGridView(x => x.TeachersOrderID == teachersOrderID).FirstOrDefault();
- result.ApproveStatusName = statusList.Where(x => x.ID == result.ApproveStatus).Select(x => x.Name).FirstOrDefault();
- return result;
- }
- /// <summary>
- /// 审核
- /// </summary>
- /// <param name="planApplicationIDs"></param>
- /// <param name="userID"></param>
- /// <param name="actionView"></param>
- /// <param name="comment"></param>
- public void ApproveTeachersOrderExamine(List<Guid> teachersOrderIDs, Guid userID, ActionView actionView, string comment)
- {
- try
- {
- if (teachersOrderIDs.Count > 1 && string.IsNullOrEmpty(comment))
- comment = "同意";
- Approve(teachersOrderIDs, userID, actionView.ActionID, comment);//审核
- }
- catch (Exception ex)
- {
- throw ex;
- }
- }
- /// <summary>
- /// 查询计划申请详细
- /// </summary>
- /// <param name="planApplicationID">主键ID</param>
- /// <returns></returns>
- public Entities.ET_TeachersOrder GetTeachersOrder(Guid? teachersOrderID)
- {
- //查询条件
- System.Linq.Expressions.Expression<Func<ET_TeachersOrder, bool>> expression = (x => x.ApprovalStatus > (int)SYS_STATUS.UNUSABLE);
- expression = (x => x.TeachersOrderID == teachersOrderID);
- return TeachersOrderDAL.TeachersOrderRepository.GetSingle(expression);
- }
- public IList<TeachersOrderView> GetTeachersOrderExamineViewExcel(ConfiguretView configuretView, Guid? schoolyearID, Guid? collegeID, Guid? coursematerialID, Guid? publishID, int? ApprovalStatus)
- {
- var statusList = this.GetStatusViewList();
- var approveStatusList = this.GetApproveStatusViewList().Select(x => x.ID).ToList();
- Expression<Func<ET_TeachersOrder, bool>> exp = (x => approveStatusList.Contains(x.ApprovalStatus));
- if (schoolyearID.HasValue)
- exp = exp.And(x => x.SchoolyearID == schoolyearID);
- if (collegeID.HasValue)
- exp = exp.And(x => x.CollegeID == collegeID);
- if (coursematerialID.HasValue)
- exp = exp.And(x => x.CF_TeachingMaterialPool.EM_Coursematerial.Any(w => w.CoursematerialID == coursematerialID));
- if (publishID.HasValue)
- exp = exp.And(x => x.CF_TeachingMaterialPool.PublishID == publishID);
- if (ApprovalStatus.HasValue)
- exp = exp.And(x => x.ApprovalStatus == ApprovalStatus);
- var query = TeachersOrderDAL.GetTeachingOrderGridView(exp);
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- //return this.GetQueryByDataRangeByCollege(query).DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue).OrderBy(x => x.CreateTime).ToList();
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue).OrderBy(x => x.CreateTime);
- var result = this.GetQueryByDataRangeByCollege(query).OrderBy(x => x.CreateTime).ToList();
- result.ForEach(x => x.ApproveStatusName = statusList.Where(w => w.ID == x.ApproveStatus).Select(w => w.Name).FirstOrDefault());
- return result;
- }
- }
- }
|