123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.DataLogic.GraduationManage.GraduationRequirement;
- using Bowin.Common.Linq.Entity;
- using EMIS.ViewModel.GraduationManage.GraduationRequirement;
- using EMIS.ViewModel;
- using Bowin.Common.Linq;
- using System.Linq.Expressions;
- using EMIS.Entities;
- namespace EMIS.CommonLogic.GraduationManage.GraduationRequirement
- {
- public class GrademajorRequirementServices:BaseServices,IGrademajorRequirementServices
- {
- public GrademajorRequirementDAL GrademajorRequirementDAL { get; set; }
- /// <summary>
- /// 查询毕业专业学分信息View
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="gradSchoolyearID"></param>
- /// <param name="collegeID"></param>
- /// <param name="yearID"></param>
- /// <param name="standardID"></param>
- /// <param name="educationID"></param>
- /// <param name="learningformID"></param>
- /// <param name="learnSystem"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public IGridResultSet<GrademajorRequirementView> GetGradGrademajorRequirementViewGird(ConfiguretView configuretView,
- Guid? gradSchoolyearID, Guid? collegeID, int? yearID, int? standardID, int? educationID, int? learningformID,
- string learnSystem, int pageIndex, int pageSize)
- {
- //毕业专业学分
- Expression<Func<ER_GraduationRequirement, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- var query = GrademajorRequirementDAL.GetGradGrademajorRequirementQueryable(exp);
- if (gradSchoolyearID.HasValue)
- {
- query = query.Where(x => x.GraduatingSemesterID == gradSchoolyearID);
- }
- if (collegeID.HasValue)
- {
- query = query.Where(x => x.CollegeID == collegeID);
- }
- if (yearID.HasValue)
- {
- query = query.Where(x => x.SchoolyearID == yearID);
- }
- if (standardID.HasValue)
- {
- query = query.Where(x => x.StandardID == standardID);
- }
- if (educationID.HasValue)
- {
- query = query.Where(x => x.EducationID == educationID);
- }
- if (learningformID.HasValue)
- {
- query = query.Where(x => x.LearningformID == learningformID);
- }
- if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1")
- {
- var LearnSystems = Convert.ToDecimal(learnSystem);
- query = query.Where(x => x.LearnSystem == LearnSystems);
- }
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- return this.GetQueryByDataRangeByCollege(query)
- .OrderByDescending(x => x.SchoolyearID).OrderBy(x => x.StandardID)
- .ThenBy(x => x.EducationID).ThenBy(x => x.LearningformID)
- .ThenBy(x => x.CollegeNo.Length).ThenBy(x => x.CollegeNo)
- .ToGridResultSet<GrademajorRequirementView>(pageIndex, pageSize);
- }
- /// <summary>
- /// 查询毕业专业学分信息List
- /// </summary>
- /// <param name="configuretView"></param>
- /// <param name="gradSchoolyearID"></param>
- /// <param name="collegeID"></param>
- /// <param name="yearID"></param>
- /// <param name="standardID"></param>
- /// <param name="educationID"></param>
- /// <param name="learningformID"></param>
- /// <param name="learnSystem"></param>
- /// <returns></returns>
- public IList<GrademajorRequirementView> GetGradGrademajorRequirementViewList(ConfiguretView configuretView, Guid? gradSchoolyearID,
- Guid? collegeID, int? yearID, int? standardID, int? educationID, int? learningformID, string learnSystem)
- {
- //毕业专业学分
- Expression<Func<ER_GraduationRequirement, bool>> exp = (x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- var query = GrademajorRequirementDAL.GetGradGrademajorRequirementQueryable(exp);
- if (gradSchoolyearID.HasValue)
- {
- query = query.Where(x => x.GraduatingSemesterID == gradSchoolyearID);
- }
- if (collegeID.HasValue)
- {
- query = query.Where(x => x.CollegeID == collegeID);
- }
- if (yearID.HasValue)
- {
- query = query.Where(x => x.SchoolyearID == yearID);
- }
- if (standardID.HasValue)
- {
- query = query.Where(x => x.StandardID == standardID);
- }
- if (educationID.HasValue)
- {
- query = query.Where(x => x.EducationID == educationID);
- }
- if (learningformID.HasValue)
- {
- query = query.Where(x => x.LearningformID == learningformID);
- }
- if (!string.IsNullOrEmpty(learnSystem) && learnSystem != "-1")
- {
- var LearnSystems = Convert.ToDecimal(learnSystem);
- query = query.Where(x => x.LearnSystem == LearnSystems);
- }
- //查询条件
- if (!string.IsNullOrEmpty(configuretView.ConditionValue))
- {
- query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
- }
- return this.GetQueryByDataRangeByCollege(query)
- .OrderByDescending(x => x.SchoolyearID).OrderBy(x => x.StandardID)
- .ThenBy(x => x.EducationID).ThenBy(x => x.LearningformID)
- .ThenBy(x => x.CollegeNo.Length).ThenBy(x => x.CollegeNo)
- .ToList();
- }
- /// <summary>
- /// 根据毕业专业学分ID查询对应的毕业专业学分信息GrademajorRequirementView
- /// </summary>
- /// <param name="GraduationRequirementID"></param>
- /// <returns></returns>
- public GrademajorRequirementView GetGradGrademajorRequirementView(Guid? GraduationRequirementID)
- {
- try
- {
- var query = GrademajorRequirementDAL
- .GetGradGrademajorRequirementQueryable(x => x.GraduationRequirementID == GraduationRequirementID)
- .SingleOrDefault();
- return query;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 编辑(新增、修改)
- /// </summary>
- /// <param name="grademajorRequirementView"></param>
- public void GradGrademajorRequirementEdit(GrademajorRequirementView grademajorRequirementView)
- {
- try
- {
- //查询数据库进行验证
- var grademajorRequirementVerification = GrademajorRequirementDAL.GraduationRequirementRepository
- .GetList(x => x.GraduationRequirementID != grademajorRequirementView.GraduationRequirementID
- && x.GrademajorID == grademajorRequirementView.GrademajorID)
- .SingleOrDefault();
- if (grademajorRequirementVerification == null)
- {
- //数据有误验证
- if (grademajorRequirementView.GraduationRequirementID != Guid.Empty)
- {
- var grademajorRequirement = GrademajorRequirementDAL.GraduationRequirementRepository
- .GetList(x => x.GraduationRequirementID == grademajorRequirementView.GraduationRequirementID)
- .SingleOrDefault();
- if (grademajorRequirement == null)
- {
- throw new Exception("数据有误,请核查");
- }
- else
- {
- //表示修改
- grademajorRequirement.GrademajorID = grademajorRequirementView.GrademajorID;
- grademajorRequirement.OptionalCourseCredit = grademajorRequirementView.OptionalCourseCredit;
- grademajorRequirement.RequiredCredit = grademajorRequirementView.RequiredCredit;
- grademajorRequirement.TotalCredit = grademajorRequirementView.TotalCredit;
- SetModifyStatus(grademajorRequirement);
- }
- }
- else
- {
- //表示新增
- ER_GraduationRequirement grademajorRequirement = new ER_GraduationRequirement();
- grademajorRequirement.GraduationRequirementID = Guid.NewGuid();
- grademajorRequirement.GrademajorID = grademajorRequirementView.GrademajorID;
- grademajorRequirement.OptionalCourseCredit = grademajorRequirementView.OptionalCourseCredit;
- grademajorRequirement.RequiredCredit = grademajorRequirementView.RequiredCredit;
- grademajorRequirement.TotalCredit = grademajorRequirementView.TotalCredit;
- SetNewStatus(grademajorRequirement);
- UnitOfWork.Add(grademajorRequirement);
- }
- }
- else
- {
- throw new Exception("已存在相同的专业学分,请核查");
- }
- //事务提交
- UnitOfWork.Commit();
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="graduationRequirementIDList"></param>
- /// <returns></returns>
- public bool GradGrademajorRequirementDelete(IList<Guid?> graduationRequirementIDList)
- {
- try
- {
- UnitOfWork.Delete<ER_GraduationRequirement>(x => graduationRequirementIDList.Contains(x.GraduationRequirementID));
- UnitOfWork.Commit();
- return true;
- }
- catch (Exception ex)
- {
- throw new Exception(ex.Message);
- }
- }
- }
- }
|