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

83 lines
2.8 KiB

3 years ago
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> GetList1(string itemId , string keyword, ref Pagination pagination)
  27. {
  28. var expression = ExtLinq.True<ItemsDetailEntity>();
  29. if (!string.IsNullOrEmpty(itemId))
  30. {
  31. expression = expression.And(t => t.F_ItemId == itemId);
  32. }
  33. if (!string.IsNullOrEmpty(keyword))
  34. {
  35. expression = expression.And(t => t.F_ItemName.Contains(keyword));
  36. expression = expression.Or(t => t.F_ItemCode.Contains(keyword));
  37. }
  38. return service.FindList(expression,ref pagination).OrderBy(t => t.F_SortCode).ToList();
  39. }
  40. public List<ItemsDetailEntity> GetItemList(string enCode)
  41. {
  42. return service.GetItemList(enCode);
  43. }
  44. public List<ItemsDetailEntity> GetItemListWH(string itemID)
  45. {
  46. var expression = ExtLinq.True<ItemsDetailEntity>();
  47. if (!string.IsNullOrEmpty(itemID))
  48. {
  49. expression = expression.And(t => t.F_ItemId == itemID);
  50. }
  51. return service.IQueryable(expression).OrderBy(t => t.F_SortCode).ToList();
  52. }
  53. public ItemsDetailEntity GetForm(string keyValue)
  54. {
  55. return service.FindEntity(keyValue);
  56. }
  57. public void DeleteForm(string keyValue)
  58. {
  59. service.Delete(t => t.F_Id == keyValue);
  60. }
  61. public void SubmitForm(ItemsDetailEntity itemsDetailEntity, string keyValue)
  62. {
  63. if (!string.IsNullOrEmpty(keyValue))
  64. {
  65. itemsDetailEntity.Modify(keyValue);
  66. service.Update(itemsDetailEntity);
  67. }
  68. else
  69. {
  70. itemsDetailEntity.Create();
  71. service.Insert(itemsDetailEntity);
  72. }
  73. }
  74. }
  75. }