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

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