CommonResponse.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. using System;
  2. using Common;
  3. using Newtonsoft.Json;
  4. using Newtonsoft.Json.Linq;
  5. namespace Common
  6. {
  7. public abstract class CommonResponse
  8. {
  9. public string? requestId { get; set; }
  10. public string? errorCode { get; set; }
  11. public string? message { get; set; }
  12. public string? responseTime { get; set; }
  13. public string? totalRow { get; set; }
  14. public string? totalPage { get; set; }
  15. public string? pageNumber { get; set; }
  16. public string? pageSIze { get; set; }
  17. public void BuildCommonResponse(String data)
  18. {
  19. JObject jObject = JObject.Parse(data);
  20. if (jObject != null)
  21. {
  22. requestId = (string)jObject[nameof(requestId)];
  23. responseTime = (string)jObject[nameof(responseTime)];
  24. totalRow = (string)jObject[nameof(totalRow)];
  25. totalPage = (string)jObject[nameof(totalPage)];
  26. pageNumber = (string)jObject[nameof(pageNumber)];
  27. pageSIze = (string)jObject[nameof(pageSIze)];
  28. errorCode = (string)jObject[nameof(errorCode)];
  29. message = (string)jObject[nameof(message)];
  30. }
  31. }
  32. }
  33. }