12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- 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 ExamSubjectLimitServices : BaseServices, IExamSubjectLimitServices
- {
- public ExamSubjectLimitDAL ExamSubjectLimitDAL { get; set; }
- public Bowin.Common.Linq.Entity.IGridResultSet<ViewModel.ExamSubjectLimitView> GetListGridView(int pageIndex, int pageSize, params ViewModel.ConfiguretView[] configuretViews)
- {
- System.Linq.Expressions.Expression<Func<EX_ExaminationProjectCountLimit, bool>> expCampus = (x => true);
- var query = ExamSubjectLimitDAL.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.ExaminationTypeName).ThenBy(x => x.StandardName)
- .ToGridResultSet<EMIS.ViewModel.ExamSubjectLimitView>(pageIndex, pageSize);
- }
- public ViewModel.ExamSubjectLimitView GetView(Guid? ViewID)
- {
- var query = ExamSubjectLimitDAL.GetList(x => x.ExaminationSubjectCountLimitID == ViewID).SingleOrDefault();
- return query;
- }
- public void Edit(ViewModel.ExamSubjectLimitView view, List<EMIS.ViewModel.ExamSubjectLimitView> StandardList)
- {
- foreach (var stand in StandardList)
- {
- var entity = ExamSubjectLimitDAL.CountLimitRepository.Entities
- .SingleOrDefault(x => x.ExaminationTypeID == view.ExaminationTypeID && x.SchoolyearNumID == view.SchoolyearNumID && x.StandardID == stand.StandardID);
- if (entity == null)
- {
- entity = new EX_ExaminationProjectCountLimit() { ExaminationSubjectCountLimitID = Guid.NewGuid() };
- this.SetNewStatus(entity);
- ExamSubjectLimitDAL.CountLimitRepository.UnitOfWork.Add(entity);
- }
- entity.ExaminationTypeID = view.ExaminationTypeID;
- entity.SchoolyearNumID = view.SchoolyearNumID;
- entity.StandardID = stand.StandardID;
- entity.SubjectCountLimit = view.SubjectCountLimit;
- this.SetModifyStatus(entity);
- // entity.ExaminationSubjectCountLimitID = view.ExaminationSubjectCountLimitID;
- }
- ExamSubjectLimitDAL.CountLimitRepository.UnitOfWork.Commit();
- }
- public ViewModel.ExamSubjectLimitView GetView(System.Linq.Expressions.Expression<Func<Entities.EX_ExaminationProjectCountLimit, bool>> expCampus)
- {
- var query = ExamSubjectLimitDAL.GetList(expCampus).SingleOrDefault();
- return query;
- }
- public IQueryable<ViewModel.ExamSubjectLimitView> GetList(params ViewModel.ConfiguretView[] configuretViews)
- {
- System.Linq.Expressions.Expression<Func<EX_ExaminationProjectCountLimit, bool>> expCampus = (x => true);
- var query = ExamSubjectLimitDAL.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.ExaminationSubjectCountLimitID);
- }
- public bool Delete(List<Guid?> IDs)
- {
- UnitOfWork.Delete<EX_ExaminationProjectCountLimit>(x => IDs.Contains(x.ExaminationSubjectCountLimitID));
- UnitOfWork.Commit();
- return true;
- }
- }
- }
|