using System; using System.Collections.Generic; using System.Linq; using System.Text; using EMIS.DataLogic.SystemDAL; using EMIS.ViewModel.SystemView; using EMIS.Entities; namespace EMIS.CommonLogic.SystemServices { public class FunctionCodeServices : BaseServices, IFunctionCodeServices { public RoleDAL RoleDAL { get; set; } public FunctionDAL FunctionDAL { get; set; } public IList GetAllFunctionCodeViewList() { return FunctionDAL.GetAllFunctionCodeView().ToList(); } public IList GetSelectFunctionCodeViewList(Guid roleID) { return FunctionDAL.GetSelectedFunctionCodeViewByRole(x => x.RoleID == roleID).ToList(); } public void SaveAuthenization(Guid roleID, IList functionCodeList) { var role = RoleDAL.RoleRepository.GetSingle(x => x.RoleID == roleID, (x => x.Sys_FunctionCode)); var functionList = FunctionDAL.FunctionCodeRepository.GetList(x => functionCodeList.Contains(x.FunctionCode)).ToList(); role.Sys_FunctionCode = new HashSet(); functionList.ForEach(x => role.Sys_FunctionCode.Add(x)); this.UnitOfWork.Commit(); } } }