123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using Bowin.Common.Linq.Entity;
- using EMIS.Entities;
- using EMIS.DataLogic.ExamManage;
- using System.Linq.Expressions;
- using EMIS.DataLogic;
- namespace EMIS.CommonLogic.ExamManage
- {
- public class ExamProjectControlServices : BaseServices, IExamProjectControlServices
- {
- public ExamProjectControlDAL ExamProjectControlDAL { get; set; }
- public ProjectFeeDAL ProjectFeeDAL { get; set; }
- public Bowin.Common.Linq.Entity.IGridResultSet<ViewModel.ExamProjectControlView> GetListGridView(int pageIndex, int pageSize, params ViewModel.ConfiguretView[] configuretViews)
- {
- System.Linq.Expressions.Expression<Func<EX_ExaminationBatchProjectControl, bool>> expCampus = (x => true);
- var query = ExamProjectControlDAL.GetList(expCampus);
- //查询条件
- foreach (var configuretView in configuretViews)
- {
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- //排序:按学年学期(倒序)、考试批次、项目名称、年级、院系、专业
- return query.OrderByDescending(x=>x.Schoolyear)
- .ThenBy(x => x.ExaminationBatchID).ThenBy(x => x.ProjectName).ThenBy(x => x.SchoolyearID)
- .ThenBy(x => x.CollegeID).ThenBy(x => x.StandardID)
- .ToGridResultSet<EMIS.ViewModel.ExamProjectControlView>(pageIndex, pageSize);
- }
- public IGridResultSet<EMIS.ViewModel.ExaminationApply.ExaminationTypeView> GetControlExamTypeListViewGrid(int pageIndex, int pageSize, params EMIS.ViewModel.ConfiguretView[] configuretViews)
- {
- System.Linq.Expressions.Expression<Func<EX_ExaminationBatchProjectControl, bool>> expCampus = (x => true);
- var query = ExamProjectControlDAL.GetList(expCampus);
- //查询条件
- foreach (var configuretView in configuretViews)
- {
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- var result = query.OrderBy(x => x.ExaminationBatchProjectID).GroupBy(x => new
- {
- x.ExaminationBatchID,
- x.ExaminationTypeID,
- x.ExaminationType
- }).Select(x => new EMIS.ViewModel.ExaminationApply.ExaminationTypeView()
- {
- ExaminationBatchID = x.Key.ExaminationBatchID.Value,
- ExaminationTypeID = x.Key.ExaminationTypeID.Value,
- Name = x.Key.ExaminationType
- });
- return result
- .OrderBy(x => x.ExaminationBatchID)
- .ToGridResultSet<EMIS.ViewModel.ExaminationApply.ExaminationTypeView>(pageIndex, pageSize);
- }
- public IGridResultSet<EMIS.ViewModel.ExamBatchProjectView> GetControlProjectListViewGrid(int pageIndex, int pageSize, params EMIS.ViewModel.ConfiguretView[] configuretViews)
- {
- System.Linq.Expressions.Expression<Func<EX_ExaminationBatchProjectControl, bool>> expCampus = (x => true);
- var query = ExamProjectControlDAL.GetList(expCampus);
- //查询条件
- foreach (var configuretView in configuretViews)
- {
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- var result = query.OrderBy(x => x.ExaminationBatchProjectID).GroupBy(x => new
- {
- x.ExaminationBatchID,
- x.ExaminationTypeID,
- x.ExaminationBatchProjectID,
- x.ExaminationProjectID,
- x.ProjectName
- }).Select(x => new EMIS.ViewModel.ExamBatchProjectView()
- {
- ExaminationBatchID = x.Key.ExaminationBatchID.Value,
- ExaminationTypeID = x.Key.ExaminationTypeID.Value,
- Name = x.Key.ProjectName,
- ExaminationProjectID = x.Key.ExaminationProjectID,
- ExaminationBatchProjectID = x.Key.ExaminationBatchProjectID.Value,
- });
- return result
- .OrderBy(x => x.ExaminationBatchID)
- .ToGridResultSet<EMIS.ViewModel.ExamBatchProjectView>(pageIndex, pageSize);
- }
- public ViewModel.ExamProjectControlView GetView(Guid? ViewID)
- {
- var query = ExamProjectControlDAL.GetList(x => x.ExaminationBatchProjectControlID == ViewID).SingleOrDefault();
- return query;
- }
- public void Edit(ViewModel.ExamProjectControlView view, List<EMIS.ViewModel.ExamProjectControlView> standardList)
- {
- var examinationBatchProject = ProjectFeeDAL.BatchProjectRepository.Entities.Where(x => x.ExaminationBatchID == view.ExaminationBatchID && x.ExaminationProjectID == view.ExaminationProjectID).FirstOrDefault();
- foreach (var stand in standardList)
- {
- var entity = ExamProjectControlDAL.ProjectControlRepository.Entities
- .SingleOrDefault(x => x.ExaminationBatchProjectID == examinationBatchProject.ExaminationBatchProjectID && x.StandardID == stand.StandardID && x.CollegeID == stand.CollegeID && x.SchoolyearID == stand.SchoolyearID);
- if (entity == null)
- {
- entity = new EX_ExaminationBatchProjectControl();
- entity.ExaminationBatchProjectControlID = Guid.NewGuid();
- this.SetNewStatus(entity);
- ExamProjectControlDAL.ProjectControlRepository.UnitOfWork.Add(entity);
- }
- entity.CollegeID = stand.CollegeID;
- entity.SchoolyearID = stand.SchoolyearID;
- entity.StandardID = stand.StandardID;
- entity.ExaminationBatchProjectID = examinationBatchProject.ExaminationBatchProjectID;
- entity.IsOnlinePay = view.IsOnlinePay;
- entity.ExaminationProjectFeeID = view.ExaminationProjectFeeID;
- this.SetModifyStatus<EX_ExaminationBatchProjectControl>(entity);
- }
- ExamProjectControlDAL.ProjectControlRepository.UnitOfWork.Commit();
- }
- public void Edit(ViewModel.ExamProjectControlView view)
- {
- var examinationBatchProject = ProjectFeeDAL.BatchProjectRepository.Entities.Where(x => x.ExaminationBatchID == view.ExaminationBatchID && x.ExaminationProjectID == view.ExaminationProjectID).FirstOrDefault();
- var entity = ExamProjectControlDAL.ProjectControlRepository.Entities
- .SingleOrDefault(x => x.ExaminationBatchProjectControlID == view.ExaminationBatchProjectControlID);
- if (entity == null)
- {
- entity = new EX_ExaminationBatchProjectControl();
- this.SetNewStatus(entity);
- ExamProjectControlDAL.ProjectControlRepository.UnitOfWork.Add(entity);
- }
- entity.ExaminationBatchProjectControlID = view.ExaminationBatchProjectControlID;
- entity.CollegeID = view.CollegeID;
- entity.SchoolyearID = view.SchoolyearID == -1 ? null : view.SchoolyearID;
- entity.StandardID = view.StandardID == -1 ? null : view.StandardID;
- entity.ExaminationBatchProjectID = examinationBatchProject.ExaminationBatchProjectID;
- entity.IsOnlinePay = view.IsOnlinePay;
- entity.ExaminationProjectFeeID = view.ExaminationProjectFeeID;
- this.SetModifyStatus<EX_ExaminationBatchProjectControl>(entity);
- ExamProjectControlDAL.ProjectControlRepository.UnitOfWork.Commit();
- }
- public ViewModel.ExamProjectControlView GetView(System.Linq.Expressions.Expression<Func<Entities.EX_ExaminationBatchProjectControl, bool>> expCampus)
- {
- var query = ExamProjectControlDAL.GetList(expCampus).SingleOrDefault();
- return query;
- }
- public IQueryable<ViewModel.ExamProjectControlView> GetList(params ViewModel.ConfiguretView[] configuretViews)
- {
- System.Linq.Expressions.Expression<Func<EX_ExaminationBatchProjectControl, bool>> expCampus = (x => true);
- var query = ExamProjectControlDAL.GetList(expCampus);
- //查询条件
- foreach (var configuretView in configuretViews)
- {
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- return query
- .OrderBy(x => x.ExaminationBatchProjectControlID);
- }
- public bool Delete(List<Guid?> IDs)
- {
- UnitOfWork.Delete<EX_ExaminationBatchProjectControl>(x => IDs.Contains(x.ExaminationBatchProjectControlID));
- UnitOfWork.Commit();
- return true;
- }
- }
- }
|