using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMIS.ViewModel.ScoreManage; using EMIS.DataLogic.ScoreManage; using EMIS.Entities; using EMIS.Utility; using EMIS.ViewModel; namespace EMIS.CommonLogic.ScoreManage { public class ExamsCategorySettingServices : BaseServices, IExamsCategorySettingServices { public ExamsCategorySettingDAL ExamsCategorySettingDAL { get; set; } public List GetExamsCategorySettingViewList() { return ExamsCategorySettingDAL.GetExamsCategorySettingView().ToList(); } public void SaveExamsCategorySetting(IList examsCategoryIDList) { List insertSettingList = new List(); UnitOfWork.Delete(x => true); var examsCategorySettingViewList = (from category in DictionaryHelper.GetDictionaryValue(DictionaryItem.CF_ExamsCategory) select new { ExamsCategoryID = category.Value, IsReadHistory = examsCategoryIDList.Contains(category.Value.Value) }); foreach (var examsCategorySettingView in examsCategorySettingViewList) { ER_ExamsCategorySetting newSetting = new ER_ExamsCategorySetting(); newSetting.ExamsCategorySettingID = Guid.NewGuid(); newSetting.ExamsCategoryID = examsCategorySettingView.ExamsCategoryID; newSetting.IsReadHistory = examsCategorySettingView.IsReadHistory; this.SetNewStatus(newSetting); insertSettingList.Add(newSetting); } UnitOfWork.BulkInsert(insertSettingList); } } }