FunctionCodeServices.cs 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using EMIS.DataLogic.SystemDAL;
  6. using EMIS.ViewModel.SystemView;
  7. using EMIS.Entities;
  8. namespace EMIS.CommonLogic.SystemServices
  9. {
  10. public class FunctionCodeServices : BaseServices, IFunctionCodeServices
  11. {
  12. public RoleDAL RoleDAL { get; set; }
  13. public FunctionDAL FunctionDAL { get; set; }
  14. public IList<FunctionCodeView> GetAllFunctionCodeViewList()
  15. {
  16. return FunctionDAL.GetAllFunctionCodeView().ToList();
  17. }
  18. public IList<FunctionCodeView> GetSelectFunctionCodeViewList(Guid roleID)
  19. {
  20. return FunctionDAL.GetSelectedFunctionCodeViewByRole(x => x.RoleID == roleID).ToList();
  21. }
  22. public void SaveAuthenization(Guid roleID, IList<string> functionCodeList)
  23. {
  24. var role = RoleDAL.RoleRepository.GetSingle(x => x.RoleID == roleID, (x => x.Sys_FunctionCode));
  25. var functionList = FunctionDAL.FunctionCodeRepository.GetList(x => functionCodeList.Contains(x.FunctionCode)).ToList();
  26. role.Sys_FunctionCode = new HashSet<Sys_FunctionCode>();
  27. functionList.ForEach(x => role.Sys_FunctionCode.Add(x));
  28. this.UnitOfWork.Commit();
  29. }
  30. }
  31. }