123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155 |
- 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;
- using EMIS.ViewModel.Students;
- namespace EMIS.CommonLogic.ExamManage
- {
- public class ExamPersonControlServices : BaseServices, IExamPersonControlServices
- {
- public ExamPersonControlDAL Logic { get; set; }
- public Bowin.Common.Linq.Entity.IGridResultSet<ViewModel.ExamPersonControlView> GetListGridView(int pageIndex, int pageSize, params ViewModel.ConfiguretView[] configuretViews)
- {
- System.Linq.Expressions.Expression<Func<EX_ExaminationBatchProjectPersonControl, bool>> expCampus = (x => true);
- var query = Logic.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)
- .OrderBy(x => x.ExaminationBatchProjectPersonControlID)
- .ToGridResultSet<EMIS.ViewModel.ExamPersonControlView>(pageIndex, pageSize);
- }
- public IGridResultSet<EMIS.ViewModel.ExaminationApply.ExaminationTypeView> GetControlExamTypeListViewGrid(int pageIndex, int pageSize, params EMIS.ViewModel.ConfiguretView[] configuretViews)
- {
- System.Linq.Expressions.Expression<Func<EX_ExaminationBatchProjectPersonControl, bool>> expCampus = (x => true);
- var query = Logic.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_ExaminationBatchProjectPersonControl, bool>> expCampus = (x => true);
- var query = Logic.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.ProjectName
- }).Select(x => new EMIS.ViewModel.ExamBatchProjectView()
- {
- ExaminationBatchID = x.Key.ExaminationBatchID.Value,
- ExaminationTypeID = x.Key.ExaminationTypeID.Value,
- Name = x.Key.ProjectName,
- ExaminationBatchProjectID = x.Key.ExaminationBatchProjectID.Value,
- });
- return result
- .OrderBy(x => x.ExaminationBatchID)
- .ToGridResultSet<EMIS.ViewModel.ExamBatchProjectView>(pageIndex, pageSize);
- }
- public ViewModel.ExamPersonControlView GetView(Guid? ViewID)
- {
- var query = Logic.GetList(x => x.ExaminationBatchProjectPersonControlID == ViewID).SingleOrDefault();
- return query;
- }
- public void Edit(ViewModel.ExamPersonControlView view, List<StudentsView> studentsViewList)
- {
- //UnitOfWork.Delete<EX_ExaminationBatchProjectPersonControl>(q => q.ExaminationBatchProjectID == view.ExaminationBatchProjectID);
-
- var examinationBatchProject = Logic.BatchProjectRepository.Entities.Where(x => x.ExaminationBatchID == view.ExaminationBatchID && x.ExaminationProjectID == view.ExaminationProjectID).FirstOrDefault();
- var PersonControlList = Logic.PersonControlRepository.Entities.Where(x => x.ExaminationBatchProjectID == examinationBatchProject.ExaminationBatchProjectID).ToList();
- foreach (var student in studentsViewList)
- {
- var entity = PersonControlList.Where(x => x.UserID == student.UserID).FirstOrDefault();
- if (entity == null)
- {
- entity = new EX_ExaminationBatchProjectPersonControl();
- entity.ExaminationBatchProjectPersonControlID = Guid.NewGuid();
- this.SetNewStatus(entity);
- Logic.PersonControlRepository.UnitOfWork.Add(entity);
- }
- entity.ExaminationBatchProjectID = examinationBatchProject.ExaminationBatchProjectID;
- entity.ExaminationProjectFeeID = view.ExaminationProjectFeeID;
- entity.UserID = student.UserID;
- entity.IsOnlinePay = view.IsOnlinePay;
- entity.EndDate = view.EndDate;
- entity.StartDate = view.StartDate;
- this.SetModifyStatus(entity);
- }
- Logic.PersonControlRepository.UnitOfWork.Commit();
- }
- public ViewModel.ExamPersonControlView GetView(System.Linq.Expressions.Expression<Func<Entities.EX_ExaminationBatchProjectPersonControl, bool>> expCampus)
- {
- var query = Logic.GetList(expCampus).SingleOrDefault();
- return query;
- }
- public IQueryable<ViewModel.ExamPersonControlView> GetList(params ViewModel.ConfiguretView[] configuretViews)
- {
- System.Linq.Expressions.Expression<Func<EX_ExaminationBatchProjectPersonControl, bool>> expCampus = (x => true);
- var query = Logic.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.ExaminationBatchProjectPersonControlID);
- }
- public bool Delete(List<Guid?> IDs)
- {
- UnitOfWork.Delete<EX_ExaminationBatchProjectPersonControl>(x => IDs.Contains(x.ExaminationBatchProjectPersonControlID));
- UnitOfWork.Commit();
- return true;
- }
- }
- }
|