LevelSettingServices.cs 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. //using System;
  2. //using System.Collections.Generic;
  3. //using System.Linq;
  4. //using System.Text;
  5. //using EMIS.DataLogic.ScoreManage;
  6. //using EMIS.ViewModel;
  7. //using Bowin.Common.Linq.Entity;
  8. //using EMIS.Entities;
  9. //using EMIS.ViewModel.ScoreManage;
  10. //using EMIS.DataLogic.ExaminationApply;
  11. //using System.Linq.Expressions;
  12. //using Bowin.Common.Linq;
  13. //namespace EMIS.CommonLogic.ScoreManage
  14. //{
  15. // public class LevelSettingServices: BaseServices,ILevelSettingServices
  16. // {
  17. // public LevelSettingDAL levelSettingDAL { get; set; }
  18. // public ExaminationSubjectDAL ExaminationSubjectDAL { get; set; }
  19. // public Bowin.Common.Linq.Entity.IGridResultSet<LevelSettingView> GetLevelSettingGrid(ViewModel.ConfiguretView configuretView, Guid? examinationSubjectID, int pageIndex, int pageSize)
  20. // {
  21. // Expression<Func<ER_LevelSetting, bool>> exp = x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE;
  22. // if (examinationSubjectID.HasValue)
  23. // {
  24. // exp = exp.And(x => x.ExaminationSubjectID == examinationSubjectID);
  25. // }
  26. // var query = levelSettingDAL.GetLevelSettingViewQueryable(exp);
  27. // if (!string.IsNullOrEmpty(configuretView.ConditionValue))
  28. // query = query.DynamicWhere(configuretView.Attribute, configuretView.Condition, configuretView.ConditionValue.Trim());
  29. // return query.OrderByDescending(x => x.ExaminationSubjectName).ThenByDescending(x => x.MaxScore).ThenByDescending(x => x.MinScore).ToGridResultSet<LevelSettingView>(pageIndex, pageSize);
  30. // }
  31. // public LevelSettingView GetLevelSettingView(Guid? LevelSettingID)
  32. // {
  33. // var query = levelSettingDAL.GetLevelSettingViewQueryable(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE).Where(x => x.LevelSettingID == LevelSettingID).FirstOrDefault();
  34. // return query;
  35. // }
  36. // public ER_LevelSetting GetLevelSettingEntity(Guid? LevelSettingID)
  37. // {
  38. // return levelSettingDAL.levelSettingRepository.GetSingle(x => x.LevelSettingID == LevelSettingID);
  39. // }
  40. // public void Save(LevelSettingView levelSettingView)
  41. // {
  42. // try
  43. // {
  44. // var query = levelSettingDAL.GetLevelSettingViewQueryable(x => x.RecordStatus > (int)SYS_STATUS.UNUSABLE&&x.ExaminationSubjectID==levelSettingView.ExaminationSubjectID).ToList();
  45. // //修改的时候排除本身
  46. // if (levelSettingView != null)
  47. // {
  48. // query = query.Where(x => x.LevelSettingID != levelSettingView.LevelSettingID).ToList();
  49. // }
  50. // foreach (var LevelSetting in query)
  51. // {
  52. // if ((LevelSetting.MaxScore >= levelSettingView.MaxScore && LevelSetting.MinScore <= levelSettingView.MaxScore)
  53. // || (LevelSetting.MaxScore >= levelSettingView.MinScore && LevelSetting.MinScore <= levelSettingView.MinScore))
  54. // throw new Exception(string.Format("{0}分数段{1}与{2}<=总成绩<={3}分数段有重合。", LevelSetting.LevelName, LevelSetting.ScoreRange.Replace(" ", ""), levelSettingView.MinScore, levelSettingView.MaxScore));
  55. // }
  56. // ER_LevelSetting levelSettingEntity = null;
  57. // if (levelSettingView.LevelSettingID == null || levelSettingView.LevelSettingID == Guid.Empty)
  58. // {
  59. // levelSettingEntity = new ER_LevelSetting();
  60. // levelSettingEntity.LevelSettingID = Guid.NewGuid();
  61. // SetNewStatus(levelSettingEntity);
  62. // UnitOfWork.Add(levelSettingEntity);
  63. // }
  64. // else
  65. // {
  66. // levelSettingEntity = GetLevelSettingEntity(levelSettingView.LevelSettingID);
  67. // if (levelSettingEntity == null)
  68. // throw new Exception("未找到相对应的等级成绩设置!");
  69. // SetModifyStatus(levelSettingEntity);
  70. // }
  71. // //if (levelSettingEntity.ExaminationSubjectID == null)
  72. // //{
  73. // // EX_ExaminationSubject examinationSubject = ExaminationSubjectDAL.ExaminationSubjectRepository.Entities.Where(x => x.Name == levelSettingView.ExaminationSubjectName).OrderByDescending(x=>x.CreateTime).FirstOrDefault();
  74. // // levelSettingEntity.ExaminationSubjectID = levelSettingView.ExaminationSubjectID;
  75. // //}
  76. // //else
  77. // //{
  78. // // levelSettingEntity.ExaminationSubjectID = levelSettingView.ExaminationSubjectID;
  79. // //}
  80. // levelSettingEntity.ExaminationSubjectID = levelSettingView.ExaminationSubjectID;
  81. // levelSettingEntity.LevelName = levelSettingView.LevelName;
  82. // levelSettingEntity.LevelNo = levelSettingView.LevelNo;
  83. // levelSettingEntity.MaxScore = levelSettingView.MaxScore;
  84. // levelSettingEntity.MinScore = levelSettingView.MinScore;
  85. // levelSettingEntity.Remark = levelSettingView.Remark;
  86. // UnitOfWork.Commit();
  87. // }
  88. // catch (Exception)
  89. // {
  90. // throw;
  91. // }
  92. // }
  93. // public void Delete(IList<Guid?> levelSettingID)
  94. // {
  95. // if (levelSettingID.Count > 0)
  96. // {
  97. // UnitOfWork.Delete<ER_LevelSetting>(x => levelSettingID.Contains(x.LevelSettingID));
  98. // }
  99. // }
  100. // }
  101. //}