ExamsCategorySettingServices.cs 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.ViewModel.ScoreManage;
  6. using EMIS.DataLogic.ScoreManage;
  7. using EMIS.Entities;
  8. using EMIS.Utility;
  9. using EMIS.ViewModel;
  10. namespace EMIS.CommonLogic.ScoreManage
  11. {
  12. public class ExamsCategorySettingServices : BaseServices, IExamsCategorySettingServices
  13. {
  14. public ExamsCategorySettingDAL ExamsCategorySettingDAL { get; set; }
  15. public List<ExamsCategorySettingView> GetExamsCategorySettingViewList()
  16. {
  17. return ExamsCategorySettingDAL.GetExamsCategorySettingView().ToList();
  18. }
  19. public void SaveExamsCategorySetting(IList<int> examsCategoryIDList)
  20. {
  21. List<ER_ExamsCategorySetting> insertSettingList = new List<ER_ExamsCategorySetting>();
  22. UnitOfWork.Delete<ER_ExamsCategorySetting>(x => true);
  23. var examsCategorySettingViewList = (from category in DictionaryHelper.GetDictionaryValue(DictionaryItem.CF_ExamsCategory)
  24. select new { ExamsCategoryID = category.Value, IsReadHistory = examsCategoryIDList.Contains(category.Value.Value) });
  25. foreach (var examsCategorySettingView in examsCategorySettingViewList)
  26. {
  27. ER_ExamsCategorySetting newSetting = new ER_ExamsCategorySetting();
  28. newSetting.ExamsCategorySettingID = Guid.NewGuid();
  29. newSetting.ExamsCategoryID = examsCategorySettingView.ExamsCategoryID;
  30. newSetting.IsReadHistory = examsCategorySettingView.IsReadHistory;
  31. this.SetNewStatus(newSetting);
  32. insertSettingList.Add(newSetting);
  33. }
  34. UnitOfWork.BulkInsert(insertSettingList);
  35. }
  36. }
  37. }