爱思开
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.

66 lines
1.9 KiB

2 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;
  6. using System.Collections.Generic;
  7. using System.Linq;
  8. namespace NFine.Application.SystemManage
  9. {
  10. public class CustomerApp
  11. {
  12. private ICustomerRepository service = new CustomerRepository();
  13. public List<CustomerEntity> GetList()
  14. {
  15. return service.IQueryable().OrderBy(t => t.F_CreatorTime).ToList();
  16. }
  17. public List<CustomerEntity> GetList(Pagination pagination, string keyword)
  18. {
  19. var expression = ExtLinq.True<CustomerEntity>();
  20. if (!string.IsNullOrEmpty(keyword))
  21. {
  22. expression = expression.And(t => t.F_CusCode.Contains(keyword));
  23. expression = expression.Or(t => t.F_CusName.Contains(keyword));
  24. }
  25. expression = expression.And(t => t.F_CusCode != "admin");
  26. return service.FindList(expression, pagination);
  27. }
  28. public List<CustomerEntity> GetListCus()
  29. {
  30. var expression = ExtLinq.True<CustomerEntity>();
  31. return service.IQueryable(expression).OrderBy(t => t.F_CusCode).ToList();
  32. }
  33. public CustomerEntity GetForm(string keyValue)
  34. {
  35. return service.FindEntity(keyValue);
  36. }
  37. public void DeleteForm(string keyValue)
  38. {
  39. service.DeleteForm(keyValue);
  40. }
  41. public void SubmitForm(CustomerEntity cusEntity, string keyValue)
  42. {
  43. if (!string.IsNullOrEmpty(keyValue))
  44. {
  45. cusEntity.Modify(keyValue);
  46. }
  47. else
  48. {
  49. cusEntity.Create();
  50. }
  51. service.SubmitForm(cusEntity, keyValue);
  52. }
  53. public void UpdateForm(CustomerEntity cusEntity)
  54. {
  55. service.Update(cusEntity);
  56. }
  57. }
  58. }