You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.3 KiB

  1. using NFine.Data;
  2. using NFine.Domain.Entity.SystemManage;
  3. using NFine.Domain.IRepository.SystemManage;
  4. using NFine.Repository.SystemManage;
  5. using System.Collections.Generic;
  6. namespace NFine.Repository.SystemManage
  7. {
  8. public class RoleRepository : RepositoryBase<RoleEntity>, IRoleRepository
  9. {
  10. public void DeleteForm(string keyValue)
  11. {
  12. using (var db = new RepositoryBase().BeginTrans())
  13. {
  14. db.Delete<RoleEntity>(t => t.F_Id == keyValue);
  15. db.Delete<RoleAuthorizeEntity>(t => t.F_ObjectId == keyValue);
  16. db.Commit();
  17. }
  18. }
  19. public void SubmitForm(RoleEntity roleEntity, List<RoleAuthorizeEntity> roleAuthorizeEntitys, string keyValue)
  20. {
  21. using (var db = new RepositoryBase().BeginTrans())
  22. {
  23. if (!string.IsNullOrEmpty(keyValue))
  24. {
  25. db.Update(roleEntity);
  26. }
  27. else
  28. {
  29. roleEntity.F_Category = 1;
  30. db.Insert(roleEntity);
  31. }
  32. db.Delete<RoleAuthorizeEntity>(t => t.F_ObjectId == roleEntity.F_Id);
  33. db.Insert(roleAuthorizeEntitys);
  34. db.Commit();
  35. }
  36. }
  37. }
  38. }