纽威
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.

51 lines
1.5 KiB

3 years ago
  1. using NFine.Code;
  2. using NFine.Domain.Entity.SystemManage;
  3. using NFine.Domain.IRepository.SystemManage;
  4. using NFine.Repository.SystemManage;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. namespace NFine.Application.SystemManage
  8. {
  9. public class DutyApp
  10. {
  11. private IRoleRepository service = new RoleRepository();
  12. public List<RoleEntity> GetList(string keyword = "")
  13. {
  14. var expression = ExtLinq.True<RoleEntity>();
  15. if (!string.IsNullOrEmpty(keyword))
  16. {
  17. expression = expression.And(t => t.F_FullName.Contains(keyword));
  18. expression = expression.Or(t => t.F_EnCode.Contains(keyword));
  19. }
  20. expression = expression.And(t => t.F_Category == 2);
  21. return service.IQueryable(expression).OrderBy(t => t.F_SortCode).ToList();
  22. }
  23. public RoleEntity GetForm(string keyValue)
  24. {
  25. return service.FindEntity(keyValue);
  26. }
  27. public void DeleteForm(string keyValue)
  28. {
  29. service.Delete(t => t.F_Id == keyValue);
  30. }
  31. public void SubmitForm(RoleEntity roleEntity, string keyValue)
  32. {
  33. if (!string.IsNullOrEmpty(keyValue))
  34. {
  35. roleEntity.Modify(keyValue);
  36. service.Update(roleEntity);
  37. }
  38. else
  39. {
  40. roleEntity.Create();
  41. roleEntity.F_Category = 2;
  42. service.Insert(roleEntity);
  43. }
  44. }
  45. }
  46. }