123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Linq.Expressions;
- using System.Text;
- using Bowin.Common.Linq.Entity;
- using Bowin.Common.Linq;
- using EMIS.ViewModel;
- using EMIS.ViewModel.DegreeManage.DegreeSetting;
- using EMIS.Entities;
- using EMIS.DataLogic.DegreeManage.DegreeSetting;
- namespace EMIS.CommonLogic.DegreeManage.DegreeSetting
- {
- public class DegreeOpenControlServices : BaseServices, IDegreeOpenControlServices
- {
- public DegreeOpenControlDAL DegreeOpenControlDAL { get; set; }
-
-
-
-
-
-
-
-
-
- public IGridResultSet<DegreeOpenControlView> GetDegreeOpenControlViewGrid(ConfiguretView configuretView, Guid? graduatingSemesterID, int? degreeBatchID, int pageIndex, int pageSize)
- {
-
- Expression<Func<ER_DegreeOpenControl, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (graduatingSemesterID.HasValue)
- {
- exp = exp.And(x => x.GraduatingSemesterID == graduatingSemesterID);
- }
- if (degreeBatchID.HasValue)
- {
- exp = exp.And(x => x.DegreeBatchID == degreeBatchID);
- }
- var query = DegreeOpenControlDAL.GetDegreeOpenControlViewQueryable(exp);
-
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- return query.OrderByDescending(x => x.GraduatingSemesterValue).ToGridResultSet<DegreeOpenControlView>(pageIndex, pageSize);
- }
-
-
-
-
-
-
-
- public IList<DegreeOpenControlView> GetDegreeOpenControlViewList(ConfiguretView configuretView, Guid? graduatingSemesterID, int? degreeBatchID)
- {
-
- Expression<Func<ER_DegreeOpenControl, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (graduatingSemesterID.HasValue)
- {
- exp = exp.And(x => x.GraduatingSemesterID == graduatingSemesterID);
- }
- if (degreeBatchID.HasValue)
- {
- exp = exp.And(x => x.DegreeBatchID == degreeBatchID);
- }
- var query = DegreeOpenControlDAL.GetDegreeOpenControlViewQueryable(exp);
-
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- return query.OrderByDescending(x => x.GraduatingSemesterValue).ToList();
- }
-
-
-
-
-
- public DegreeOpenControlView GetDegreeOpenControlView(Guid? degreeOpenControlID)
- {
- try
- {
- var query = DegreeOpenControlDAL.GetDegreeOpenControlViewQueryable(x => x.DegreeOpenControlID == degreeOpenControlID).SingleOrDefault();
- return query;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
-
-
-
-
- public void DegreeOpenControlViewEdit(DegreeOpenControlView degreeOpenControlView)
- {
- try
- {
- var degreeOpenControlVerify = DegreeOpenControlDAL.DegreeOpenControlRepository.GetList(x => x.DegreeOpenControlID != degreeOpenControlView.DegreeOpenControlID && x.GraduatingSemesterID == degreeOpenControlView.GraduatingSemesterID).SingleOrDefault();
- if (degreeOpenControlVerify == null)
- {
-
- if (degreeOpenControlView.DegreeOpenControlID != Guid.Empty)
- {
- var degreeOpenControl = DegreeOpenControlDAL.DegreeOpenControlRepository.GetList(x => x.DegreeOpenControlID == degreeOpenControlView.DegreeOpenControlID).SingleOrDefault();
- if (degreeOpenControl == null)
- {
- throw new Exception("数据有误,请核查。");
- }
- else
- {
-
- degreeOpenControl.GraduatingSemesterID = degreeOpenControlView.GraduatingSemesterID;
- degreeOpenControl.DegreeBatchID = degreeOpenControlView.DegreeBatchID;
- degreeOpenControl.StartDate = degreeOpenControlView.StartDate;
- degreeOpenControl.EndDate = degreeOpenControlView.EndDate;
- SetModifyStatus(degreeOpenControl);
- }
- }
- else
- {
-
- ER_DegreeOpenControl degreeOpenControl = new ER_DegreeOpenControl();
- degreeOpenControl.DegreeOpenControlID = Guid.NewGuid();
- degreeOpenControl.GraduatingSemesterID = degreeOpenControlView.GraduatingSemesterID;
- degreeOpenControl.DegreeBatchID = degreeOpenControlView.DegreeBatchID;
- degreeOpenControl.StartDate = degreeOpenControlView.StartDate;
- degreeOpenControl.EndDate = degreeOpenControlView.EndDate;
- SetNewStatus(degreeOpenControl);
- UnitOfWork.Add(degreeOpenControl);
- }
- }
- else
- {
- throw new Exception("已存在相同的学位控制信息,请核查。");
- }
-
- UnitOfWork.Commit();
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
-
-
-
-
-
- public bool DegreeOpenControlDelete(IList<Guid?> degreeOpenControlIDList)
- {
- try
- {
- UnitOfWork.Delete<ER_DegreeOpenControl>(x => degreeOpenControlIDList.Contains(x.DegreeOpenControlID));
- return true;
- }
- catch (Exception)
- {
- throw;
- }
- }
- }
- }
|