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.

65 lines
2.2 KiB

1 year ago
  1. using Common;
  2. using Common.Model;
  3. using Common.Model.Inbound;
  4. using Repository.Inbound;
  5. using System.Collections.Generic;
  6. namespace Business.Inbound
  7. {
  8. public interface IInboundBusiness
  9. {
  10. JsonRxResponse BankAccounts(string userId);
  11. JsonRxResponse TranactionHistory(DateFilterParams search, string userId);
  12. JsonRxResponse TranactionDetail(string tranId, string userId);
  13. JsonRxResponse DeleteInboundAccount(string account, string userId);
  14. }
  15. public class InboundBusiness : IInboundBusiness
  16. {
  17. public IInboundRepository repository;
  18. public InboundBusiness(IInboundRepository _repository)
  19. {
  20. repository = _repository;
  21. }
  22. public JsonRxResponse BankAccounts(string userId)
  23. {
  24. var ls = repository.GetBankAccounts(userId);
  25. if (ls.Count > 0)
  26. {
  27. return new JsonRxResponse { ErrorCode = "0", Msg = "Success", Data = ls };
  28. }
  29. return new JsonRxResponse { ErrorCode = "1", Msg = "Could not get the banks accounts." };
  30. }
  31. public JsonRxResponse TranactionHistory(DateFilterParams search, string userId)
  32. {
  33. IList<TranHistory> ls = new List<TranHistory>();
  34. ls = repository.GetTransactionHistory(search, userId);
  35. return new JsonRxResponse { ErrorCode = "0", Msg = "Success", Data = ls };
  36. }
  37. public JsonRxResponse TranactionDetail(string tranId, string userId)
  38. {
  39. var ls = repository.GetTransactionDetail(tranId, userId);
  40. if (ls != null)
  41. {
  42. return new JsonRxResponse { ErrorCode = "0", Msg = "Success", Data = ls };
  43. }
  44. return new JsonRxResponse { ErrorCode = "1", Msg = "Could not get the transaction detail." };
  45. }
  46. public JsonRxResponse DeleteInboundAccount(string account, string userId)
  47. {
  48. var ls = repository.DeleteInboundAccount(account, userId);
  49. if (ls != null)
  50. {
  51. return new JsonRxResponse { ErrorCode = ls.ResponseCode, Msg = ls.Msg, Data = ls };
  52. }
  53. return new JsonRxResponse { ErrorCode = "1", Msg = ls.Msg };
  54. }
  55. }
  56. }