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

3 years 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 OrganizeApp
  10. {
  11. private IOrganizeRepository service = new OrganizeRepository();
  12. public List<OrganizeEntity> GetList()
  13. {
  14. return service.IQueryable().OrderBy(t => t.F_CreatorTime).ToList();
  15. }
  16. public OrganizeEntity 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(OrganizeEntity organizeEntity, string keyValue)
  32. {
  33. if (!string.IsNullOrEmpty(keyValue))
  34. {
  35. organizeEntity.Modify(keyValue);
  36. service.Update(organizeEntity);
  37. }
  38. else
  39. {
  40. organizeEntity.Create();
  41. service.Insert(organizeEntity);
  42. }
  43. }
  44. }
  45. }