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.

57 lines
1.6 KiB

  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().Where(a=>a.systems=="WMS" ).OrderBy(t => t.F_SortCode).ToList();
  16. }
  17. public List<ModuleEntity> GetListALL()
  18. {
  19. return service.IQueryable().Where(a => a.systems == "WMS" || a.systems == "SRM").OrderBy(t => t.F_SortCode).ToList();
  20. }
  21. public ModuleEntity GetForm(string keyValue)
  22. {
  23. return service.FindEntity(keyValue);
  24. }
  25. public void DeleteForm(string keyValue)
  26. {
  27. if (service.IQueryable().Count(t => t.F_ParentId.Equals(keyValue)) > 0)
  28. {
  29. throw new Exception("删除失败!操作的对象包含了下级数据。");
  30. }
  31. else
  32. {
  33. service.Delete(t => t.F_Id == keyValue);
  34. }
  35. }
  36. public void SubmitForm(ModuleEntity moduleEntity, string keyValue)
  37. {
  38. if (!string.IsNullOrEmpty(keyValue))
  39. {
  40. moduleEntity.Modify(keyValue);
  41. service.Update(moduleEntity);
  42. }
  43. else
  44. {
  45. moduleEntity.systems = "WMS";
  46. moduleEntity.Create();
  47. service.Insert(moduleEntity);
  48. }
  49. }
  50. }
  51. }