123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.DataLogic.Repositories;
- using EMIS.Entities;
- using Bowin.Common.Linq;
- using Bowin.Common.Linq.Entity;
- using EMIS.DataLogic.Common.AdministrativeOrgan;
- using EMIS.Utility;
- using System.Linq.Expressions;
- using EMIS.DataLogic.ExamManage;
- using EMIS.ViewModel.ExamManage;
- using EMIS.ViewModel;
- namespace EMIS.CommonLogic.ExamManage
- {
- public class ProjectFeeServices : BaseServices, IProjectFeeServices
- {
- public ProjectFeeDAL ProjectFeeDAL { get; set; }
- public Bowin.Common.Linq.Entity.IGridResultSet<EMIS.ViewModel.ProjectFeeTypeView> GetProjectFeeTypeGrid(ViewModel.ConfiguretView configuretView, int pageIndex, int pageSize)
- {
- //校区信息
- Expression<Func<Entities.EX_ExaminationProjectFeeType, bool>> expCampus = (x => x.RecordStatus > (int)EMIS.ViewModel.SYS_STATUS.UNUSABLE);
- var query = ProjectFeeDAL.GetProjectFeeTypeGrid(expCampus);
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- return query
- .OrderBy(x => x.ExaminationProjectFeeID)
- .ToGridResultSet<EMIS.ViewModel.ProjectFeeTypeView>(pageIndex, pageSize);
- }
- public IQueryable<EMIS.ViewModel.ProjectFeeTypeView> GetProjectFeeTypeList(Expression<Func<EMIS.Entities.EX_ExaminationProjectFeeType, bool>> expCampus)
- {
- return ProjectFeeDAL.GetProjectFeeTypeGrid(expCampus);
- }
- public IGridResultSet<EX_ExaminationType> GetExaminationTypeList(int pageIndex, int pageSize, params EMIS.ViewModel.ConfiguretView[] configuretViews)
- {
- //校区信息
- Expression<Func<EX_ExaminationType, bool>> expCampus = (x => x.RecordStatus > (int)EMIS.ViewModel.SYS_STATUS.UNUSABLE);
- var query = ProjectFeeDAL.GetExaminationType(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.ExaminationTypeID)
- .ToGridResultSet<EMIS.Entities.EX_ExaminationType>(pageIndex, pageSize);
- }
- public List<EX_ExaminationType> GetExaminationTypeList()
- {
- //校区信息
- Expression<Func<EX_ExaminationType, bool>> exp = (x => x.RecordStatus > (int)EMIS.ViewModel.SYS_STATUS.UNUSABLE);
- var query = ProjectFeeDAL.GetExaminationType(exp);
- return query
- .OrderBy(x => x.Name)
- .ToList();
- }
- public IGridResultSet<EMIS.ViewModel.ExaminationProjectSubjectView> GetProjectSubjectListViewGrid(EMIS.ViewModel.ConfiguretView configuretView, int pageIndex, int pageSize)
- {
- Expression<Func<EX_ExaminationProjectSubject, bool>> expCampus = (x => x.RecordStatus > (int)EMIS.ViewModel.SYS_STATUS.UNUSABLE);
- var query = ProjectFeeDAL.GetProjectSubjectList(expCampus);
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- return query
- .OrderBy(x => x.ExaminationSubjectID)
- .ToGridResultSet<EMIS.ViewModel.ExaminationProjectSubjectView>(pageIndex, pageSize);
- }
- public List<EMIS.ViewModel.ExaminationProjectSubjectView> GetProjectSubjectListViewList(Guid? examinationProjectID)
- {
- Expression<Func<EX_ExaminationProjectSubject, bool>> exp = (x => x.RecordStatus > (int)EMIS.ViewModel.SYS_STATUS.UNUSABLE);
- if (examinationProjectID.HasValue)
- {
- exp = exp.And(x => x.ExaminationProjectID == examinationProjectID);
- }
- var query = ProjectFeeDAL.GetProjectSubjectList(exp).GroupBy(x => x.ExaminationSubjectID).Select(x => x.FirstOrDefault());
- return query
- .OrderBy(x => x.ExaminationSubjectID)
- .ToList();
- }
- public Bowin.Common.Linq.Entity.IGridResultSet<EMIS.ViewModel.ExaminationProjectFeeView> GetProjectFeeGrid(int pageIndex, int pageSize, params ViewModel.ConfiguretView[] configuretViews)
- {
- //校区信息
- Expression<Func<EX_ExaminationProjectFee, bool>> expCampus = (x => x.RecordStatus > (int)EMIS.ViewModel.SYS_STATUS.UNUSABLE);
- var query = ProjectFeeDAL.GetProjectFee(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.ExaminationProjectFeeID)
- .ToGridResultSet<EMIS.ViewModel.ExaminationProjectFeeView>(pageIndex, pageSize);
- }
- public EMIS.ViewModel.ExaminationProjectFeeView GetProjectFeeView(Expression<Func<EX_ExaminationProjectFee, bool>> expCampus)
- {
- var query = ProjectFeeDAL.GetProjectFee(expCampus);
- return query.FirstOrDefault();
- }
- public IQueryable<EMIS.ViewModel.ExaminationProjectFeeView> GetProjectFeeList(params EMIS.ViewModel.ConfiguretView[] configuretViews)
- {
- System.Linq.Expressions.Expression<Func<EX_ExaminationProjectFee, bool>> expCampus = (x => true);
- var query = ProjectFeeDAL.GetProjectFee(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.ExaminationProjectFeeID);
- }
- public Bowin.Common.Linq.Entity.IGridResultSet<EMIS.ViewModel.ExaminationProjectView> GetProjectListViewGrid(int pageIndex, int pageSize, params ViewModel.ConfiguretView[] configuretViews)
- {
- Expression<Func<EX_ExaminationProject, bool>> expCampus = (x => true);
- var query = ProjectFeeDAL.GetProectListViewGrid(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.ExaminationType).ThenBy(x=>x.Name)
- .ToGridResultSet<EMIS.ViewModel.ExaminationProjectView>(pageIndex, pageSize);
- result.rows.ForEach(s =>
- {
- s.ProjectSubjects = s.EX_ExaminationProjectSubject.Select(q => (object)q.ExaminationSubjectID).ToList();
- });
- return result;
- }
- public IQueryable<EMIS.ViewModel.ExaminationProjectView> GetProjectList(params ViewModel.ConfiguretView[] configuretViews)
- {
- Expression<Func<EX_ExaminationProject, bool>> expCampus = (x => true);
- var query = ProjectFeeDAL.GetProectListViewGrid(expCampus);
- //查询条件
- foreach (var configuretView in configuretViews)
- {
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- return query;
- }
- public EMIS.ViewModel.ProjectFeeTypeView GetProjectFeeType(Guid? ProjectFeeTypeID)
- {
- try
- {
- var query = ProjectFeeDAL.GetProjectFeeType(x => x.ExaminationProjectFeeTypeID == ProjectFeeTypeID).SingleOrDefault();
- return query;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- public EMIS.ViewModel.ExaminationProjectFeeView GetProjectFee(Guid? ExaminationProjectFeeID)
- {
- try
- {
- var query = ProjectFeeDAL.GetProjectFee(x => x.ExaminationProjectFeeID == ExaminationProjectFeeID).SingleOrDefault();
- return query;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- public EMIS.ViewModel.ExaminationProjectView GetProjectView(Expression<Func<EX_ExaminationProject, bool>> expCampus)
- {
- try
- {
- var query = ProjectFeeDAL.GetProectListViewGrid(expCampus).FirstOrDefault();
- return query;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- public void ProjectFeeTypeEdit(EMIS.ViewModel.ProjectFeeTypeView view)
- {
- var entity = ProjectFeeDAL.ProjectFeeTypeRepository.Entities
- .SingleOrDefault(x => x.ExaminationProjectFeeTypeID == view.ExaminationProjectFeeTypeID);
- if (entity == null)
- {
- entity = new EMIS.Entities.EX_ExaminationProjectFeeType();
- entity.ExaminationProjectFeeTypeID = Guid.NewGuid();
- this.SetNewStatus(entity);
- ProjectFeeDAL.ProjectFeeTypeRepository.UnitOfWork.Add(entity);
- }
- entity.CreateTime = DateTime.Now;
- entity.ExaminationProjectFeeID = view.ExaminationProjectFeeID;
- entity.FeeTypeID = view.FeeTypeID;
- entity.Fee = view.Fee;
- entity.IsMaterial = view.IsMaterial;
- entity.IsRequiredForNew = view.IsRequiredForNew;
- entity.IsResit = view.IsResit;
- entity.IsTrainingFee = view.IsTrainingFee;
- this.SetModifyStatus(entity);
- ProjectFeeDAL.ProjectFeeTypeRepository.UnitOfWork.Commit();
- }
- public void ProjectFeeEdit(EMIS.ViewModel.ExaminationProjectFeeView view)
- {
- var entity = ProjectFeeDAL.ProjectFeeRepository.Entities
- .SingleOrDefault(x => x.ExaminationProjectFeeID == view.ExaminationProjectFeeID);
- if (entity == null)
- {
- entity = new EX_ExaminationProjectFee();
- this.SetNewStatus(entity);
- ProjectFeeDAL.ProjectFeeTypeRepository.UnitOfWork.Add(entity);
- }
- entity.CreateTime = DateTime.Now;
- entity.ExaminationProjectFeeID = view.ExaminationProjectFeeID;
- entity.Name = view.Name;
- entity.RecordStatus = view.RecordStatus;
- entity.ExaminationProjectID = view.ExaminationProjectID;
- this.SetModifyStatus(entity);
- ProjectFeeDAL.ProjectFeeRepository.UnitOfWork.Commit();
- }
- public bool ProjectFeeDelete(List<Guid?> ExaminationProjectFeeIDs)
- {
- try
- {
- UnitOfWork.Delete<EMIS.Entities.EX_ExaminationProjectFeeType>(x => ExaminationProjectFeeIDs.Contains(x.ExaminationProjectFeeID));
- UnitOfWork.Delete<EX_ExaminationProjectFee>(x => ExaminationProjectFeeIDs.Contains(x.ExaminationProjectFeeID));
- UnitOfWork.Commit();
- return true;
- }
- catch (Exception)
- {
- throw;
- }
- }
- public bool ProjectDelete(List<Guid?> ExaminationProjectIDs)
- {
- try
- {
- UnitOfWork.Delete<EX_ExaminationProjectSubject>(x => ExaminationProjectIDs.Contains(x.ExaminationProjectID));
- UnitOfWork.Delete<EX_ExaminationProject>(x => ExaminationProjectIDs.Contains(x.ExaminationProjectID));
- UnitOfWork.Commit();
- return true;
- }
- catch (Exception)
- {
- throw;
- }
- }
- public bool ProjectFeeTypeDelete(List<Guid?> ExaminationProjectFeeTypeIDs)
- {
- try
- {
- UnitOfWork.Delete<EMIS.Entities.EX_ExaminationProjectFeeType>(x => ExaminationProjectFeeTypeIDs.Contains(x.ExaminationProjectFeeTypeID));
- UnitOfWork.Commit();
- return true;
- }
- catch (Exception)
- {
- throw;
- }
- }
- public EMIS.ViewModel.ExaminationProjectView GetProject(Guid? ExaminationProjectID)
- {
- try
- {
- var query = ProjectFeeDAL.GetProectListViewGrid(x => x.ExaminationProjectID == ExaminationProjectID).SingleOrDefault();
- query.ProjectSubjects = query.EX_ExaminationProjectSubject.Select(q => (object)q.ExaminationSubjectID).ToList();
- return query;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- public void ProjectEdit(EMIS.ViewModel.ExaminationProjectView view, List<ExamSubjectView> subjectList)
- {
- var entity = ProjectFeeDAL.ProjectRepository.Entities
- .SingleOrDefault(x => x.ExaminationProjectID == view.ExaminationProjectID);
- if (entity == null)
- {
- entity = new EX_ExaminationProject();
- this.SetNewStatus(entity);
- ProjectFeeDAL.ProjectFeeTypeRepository.UnitOfWork.Add(entity);
- }
- else {
- this.SetModifyStatus(entity);
- }
- entity.ExaminationProjectID = view.ExaminationProjectID;
- entity.Name = view.Name;
- entity.ExaminationLevelID = view.ExaminationLevelID;
- entity.ExaminationTypeID = view.ExaminationTypeID;
- entity.IssuedByID = view.IssuedByID;
- entity.PreposeProjectID = view.PreposeProjectID;
- entity.Remark = view.Remark;
- //修改科目
- UnitOfWork.Delete<EX_ExaminationProjectSubject>(x => x.ExaminationProjectID == entity.ExaminationProjectID);
- List<EX_ExaminationProjectSubject> projectSubjectList = new List<EX_ExaminationProjectSubject>();
- if (subjectList != null)
- {
- subjectList.ForEach(x =>
- {
- EX_ExaminationProjectSubject projectSubject = new EX_ExaminationProjectSubject();
- projectSubject.ExaminationProjectSubjectID = Guid.NewGuid();
- projectSubject.ExaminationProjectID = entity.ExaminationProjectID;
- projectSubject.ExaminationSubjectID = x.ExaminationSubjectID;
- projectSubject.ResitCount = x.ResitCount;
- this.SetNewStatus(projectSubject);
- projectSubjectList.Add(projectSubject);
- });
- }
- UnitOfWork.BulkInsert(projectSubjectList);
- UnitOfWork.Commit();
- }
- public IGridResultSet<ExamSubjectView> GetSubjectByProjectIDGrid(ConfiguretView configuretView, Guid? projectID)
- {
- Expression<Func<EX_ExaminationProjectSubject, bool>> expeps = (x => x.RecordStatus > (int)EMIS.ViewModel.SYS_STATUS.UNUSABLE);
- expeps = expeps.And(x => x.ExaminationProjectID == projectID);
- var query = ProjectFeeDAL.GetExamSubjectByProjectID(expeps);
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- return query.OrderBy(x => x.ExaminationSubjectID)
- .ToGridResultSet<ExamSubjectView>();
- }
- public IGridResultSet<ExamSubjectView> GetSubjectListGrid(ConfiguretView configuretView, int pageIndex, int pageSize)
- {
- var query = ProjectFeeDAL.GetExamSubject();
- return query.OrderBy(x => x.ExaminationSubjectID)
- .ToGridResultSet<ExamSubjectView>(pageIndex, pageSize);
- }
- }
- }
|