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

50 lines
1.3 KiB

1 year ago
  1. using NFine.Domain.Entity.SystemManage;
  2. using NFine.Domain.IRepository.SystemManage;
  3. using NFine.Repository.SystemManage;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Linq;
  7. namespace NFine.Application.SystemManage
  8. {
  9. public class AreaApp
  10. {
  11. private IAreaRepository service = new AreaRepository();
  12. public List<AreaEntity> GetList()
  13. {
  14. return service.IQueryable().ToList();
  15. }
  16. public AreaEntity GetForm(string keyValue)
  17. {
  18. return service.FindEntity(keyValue);
  19. }
  20. public void DeleteForm(string keyValue)
  21. {
  22. if (service.IQueryable().Count(t => t.F_ParentId.Equals(keyValue)) > 0)
  23. {
  24. throw new Exception("删除失败!操作的对象包含了下级数据。");
  25. }
  26. else
  27. {
  28. service.Delete(t => t.F_Id == keyValue);
  29. }
  30. }
  31. public void SubmitForm(AreaEntity areaEntity, string keyValue)
  32. {
  33. if (!string.IsNullOrEmpty(keyValue))
  34. {
  35. areaEntity.Modify(keyValue);
  36. service.Update(areaEntity);
  37. }
  38. else
  39. {
  40. areaEntity.Create();
  41. service.Insert(areaEntity);
  42. }
  43. }
  44. }
  45. }