123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Linq.Expressions;
- using EMIS.DataLogic.ExaminationApply;
- using EMIS.ViewModel.ExaminationApply;
- using EMIS.ViewModel;
- using EMIS.Entities;
- using Bowin.Common.Linq.Entity;
- namespace EMIS.CommonLogic.ExaminationApply
- {
- public class ExaminationTypeServices : BaseServices, IExaminationTypeServices
- {
- public ExaminationTypeDAL ExaminationTypeDAL { get; set; }
- /// <summary>
- /// 考试类型
- /// </summary>
- /// <param name="examinationTypeView">实体</param>
- /// <param name="pageIndex">当前页码</param>
- /// <param name="pageSize">显示页码</param>
- /// <returns></returns>
- public Bowin.Common.Linq.Entity.IGridResultSet<ExaminationTypeView> GetExaminationTypeViewList(ConfiguretView examinationTypeView, int pageIndex, int pageSize)
- {
- Expression<Func<EX_ExaminationType, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- var q = ExaminationTypeDAL.GetExaminationTypeView(exp);
- if (!string.IsNullOrEmpty(examinationTypeView.ConditionValue) && !string.IsNullOrEmpty(examinationTypeView.Attribute))
- q = q.DynamicWhere(examinationTypeView.Attribute, examinationTypeView.Condition, examinationTypeView.ConditionValue);
- return q.OrderBy(x => x.Name).ToGridResultSet<ExaminationTypeView>(pageIndex, pageSize);
- }
- /// <summary>
- /// 考试类型
- /// </summary>
- /// <param name="examinationTypeView">实体</param>
- /// <returns></returns>
- public IList<ExaminationTypeView> GetExaminationTypeViewList(ConfiguretView examinationTypeView)
- {
- Expression<Func<EX_ExaminationType, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- var q = ExaminationTypeDAL.GetExaminationTypeView(exp);
- if (!string.IsNullOrEmpty(examinationTypeView.ConditionValue) && !string.IsNullOrEmpty(examinationTypeView.Attribute))
- q = q.DynamicWhere(examinationTypeView.Attribute, examinationTypeView.Condition, examinationTypeView.ConditionValue);
- return q.OrderBy(x => x.Name).ToList();
- }
- /// <summary>
- /// 根据ID获取考试类型详细信息
- /// </summary>
- /// <param name="examinationTypeID">考试类型ID</param>
- /// <returns></returns>
- public ExaminationTypeView GetExaminationTypeViewInfo(Guid? examinationTypeID)
- {
- return ExaminationTypeDAL.GetExaminationTypeView(x => x.ExaminationTypeID == examinationTypeID).FirstOrDefault();
- }
- /// <summary>
- /// 保存考试类型
- /// </summary>
- /// <param name="examinationTypeView">考试类型实体</param>
- /// <returns></returns>
- public void Save(ExaminationTypeView examinationTypeView)
- {
- var examinationTypeEntity = ExaminationTypeDAL.ExaminationTypeRepository.GetSingle(x => x.ExaminationTypeID == examinationTypeView.ExaminationTypeID);
- if (examinationTypeEntity != null)
- {
- examinationTypeEntity.Name = examinationTypeView.Name;
- examinationTypeEntity.IsTimesLimit = examinationTypeView.IsTimesLimit;
- this.SetModifyStatus(examinationTypeEntity);
- }
- else
- {
- examinationTypeEntity = new EX_ExaminationType();
- examinationTypeEntity.ExaminationTypeID = Guid.NewGuid();
- examinationTypeEntity.Name = examinationTypeView.Name;
- examinationTypeEntity.IsTimesLimit = examinationTypeView.IsTimesLimit;
- this.SetNewStatus(examinationTypeEntity);
- UnitOfWork.Add(examinationTypeEntity);
- }
- UnitOfWork.Commit();
- }
- /// <summary>
- /// 删除考试类型
- /// </summary>
- /// <param name="examinationTypeID">主键ID</param>
- /// <returns></returns>
- public void Delete(IList<Guid?> examinationTypeID)
- {
- if (examinationTypeID.Count > 0)
- {
- UnitOfWork.Delete<EX_ExaminationType>(x => examinationTypeID.Contains(x.ExaminationTypeID));
- }
- }
- public ExaminationTypeView GetView(Expression<Func<EX_ExaminationType, bool>> expCampus)
- {
- try
- {
- var query = ExaminationTypeDAL.GetExaminationTypeView(expCampus).FirstOrDefault();
- return query;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- }
- }
|