123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using EMIS.DataLogic.Repositories;
- using EMIS.ViewModel;
- using Bowin.Common.Linq.Entity;
- using EMIS.Entities;
- using EMIS.ViewModel.ScoreManage;
- namespace EMIS.CommonLogic.ScoreManage
- {
- public class GradePointFormulaServices : BaseServices, IGradePointFormulaServices
- {
- public GradePointFormulaRepository gradePointFormulaRepository { get; set; }
- /// <summary>
- /// 绩点公式设置查询列表
- /// </summary>
- /// <param name="name"></param>
- /// <param name="pageIndex"></param>
- /// <param name="pageSize"></param>
- /// <returns></returns>
- public Bowin.Common.Linq.Entity.IGridResultSet<Entities.ER_GradePointFormula> GetGradePointFormulaGrid(string name, int pageIndex, int pageSize)
- {
- var query = gradePointFormulaRepository.GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (!string.IsNullOrEmpty(name))
- query = query.Where(x => x.Name.Contains(name));
- return query.OrderByDescending(x => x.CreateTime).ToGridResultSet<ER_GradePointFormula>(pageIndex, pageSize);
- }
- /// <summary>
- /// 绩点公式设置查询列表
- /// </summary>
- /// <param name="name"></param>
- /// <returns></returns>
- public List<Entities.ER_GradePointFormula> GetGradePointFormulaList(string name)
- {
- var query = gradePointFormulaRepository.GetList(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE);
- if (!string.IsNullOrEmpty(name))
- query = query.Where(x => x.Name.Contains(name));
- return query.OrderByDescending(x => x.CreateTime).ToList();
- }
- /// <summary>
- /// 绩点公式设置
- /// </summary>
- /// <param name="gradePointFormulaID"></param>
- /// <returns></returns>
- public Entities.ER_GradePointFormula GetGradePointFormula(Guid? gradePointFormulaID)
- {
- return gradePointFormulaRepository.GetSingle(x => x.GradePointFormulaID == gradePointFormulaID);
- }
- /// <summary>
- /// 新增、修改绩点公式设置
- /// </summary>
- /// <param name="gradePointFormulaView"></param>
- public void GradePointFormulaAdd(GradePointFormulaView gradePointFormulaView)
- {
- try
- {
- ER_GradePointFormula gradePointFormula = null;
- if (gradePointFormulaView.GradePointFormulaID == null || gradePointFormulaView.GradePointFormulaID == Guid.Empty)
- {
- gradePointFormula = new ER_GradePointFormula();
- gradePointFormula.GradePointFormulaID = Guid.NewGuid();
- gradePointFormula.Name = gradePointFormulaView.Name;
- gradePointFormula.GradePointlimit = gradePointFormulaView.GradePointlimit;
- gradePointFormula.GradePointFloor = gradePointFormulaView.GradePointFloor;
- SetNewStatus(gradePointFormula);
- UnitOfWork.Add(gradePointFormula);
- }
- else
- {
- gradePointFormula = GetGradePointFormula(gradePointFormulaView.GradePointFormulaID);
- if (gradePointFormula == null)
- throw new Exception("未找到相对应的成绩绩点公式设置!");
- gradePointFormula.Name = gradePointFormulaView.Name;
- gradePointFormula.GradePointlimit = gradePointFormulaView.GradePointlimit;
- gradePointFormula.GradePointFloor = gradePointFormulaView.GradePointFloor;
- SetModifyStatus(gradePointFormula);
- }
- UnitOfWork.Commit();
- }
- catch (Exception)
- {
-
- throw;
- }
- }
- /// <summary>
- /// 删除
- /// </summary>
- /// <param name="gradePointFormulaIDs"></param>
- public void GradePointFormulaDelete(List<Guid> gradePointFormulaIDs)
- {
- try
- {
- if (gradePointFormulaIDs.Count > 0)
- {
- UnitOfWork.Delete<ER_GradePointFormula>(x => gradePointFormulaIDs.Contains(x.GradePointFormulaID));
- }
- }
- catch (Exception)
- {
-
- throw;
- }
- }
- }
- }
|