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

68 lines
2.2 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 ItemsDetailApp
  10. {
  11. private IItemsDetailRepository service = new ItemsDetailRepository();
  12. public List<ItemsDetailEntity> GetList(string itemId = "", string keyword = "")
  13. {
  14. var expression = ExtLinq.True<ItemsDetailEntity>();
  15. if (!string.IsNullOrEmpty(itemId))
  16. {
  17. expression = expression.And(t => t.F_ItemId == itemId);
  18. }
  19. if (!string.IsNullOrEmpty(keyword))
  20. {
  21. expression = expression.And(t => t.F_ItemName.Contains(keyword));
  22. expression = expression.Or(t => t.F_ItemCode.Contains(keyword));
  23. }
  24. return service.IQueryable(expression).OrderBy(t => t.F_SortCode).ToList();
  25. }
  26. public List<ItemsDetailEntity> GetItemList(string enCode)
  27. {
  28. return service.GetItemList(enCode);
  29. }
  30. public List<ItemsDetailEntity> GetItemListWH(string itemID)
  31. {
  32. var expression = ExtLinq.True<ItemsDetailEntity>();
  33. if (!string.IsNullOrEmpty(itemID))
  34. {
  35. expression = expression.And(t => t.F_ItemId == itemID);
  36. }
  37. return service.IQueryable(expression).OrderBy(t => t.F_SortCode).ToList();
  38. }
  39. public ItemsDetailEntity GetForm(string keyValue)
  40. {
  41. return service.FindEntity(keyValue);
  42. }
  43. public void DeleteForm(string keyValue)
  44. {
  45. service.Delete(t => t.F_Id == keyValue);
  46. }
  47. public void SubmitForm(ItemsDetailEntity itemsDetailEntity, string keyValue)
  48. {
  49. if (!string.IsNullOrEmpty(keyValue))
  50. {
  51. itemsDetailEntity.Modify(keyValue);
  52. service.Update(itemsDetailEntity);
  53. }
  54. else
  55. {
  56. itemsDetailEntity.Create();
  57. service.Insert(itemsDetailEntity);
  58. }
  59. }
  60. }
  61. }