RestfulClient2.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. using RestSharp;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Configuration;
  5. using System.Linq;
  6. using System.Text;
  7. using WisdomClient.data;
  8. namespace WisdomClient
  9. {
  10. public class RestfulClient2
  11. {
  12. public static TsData[] findHistorySectionByThingCodes(string thingType, string thingId, string[] uCodes, long ts)
  13. {
  14. int len = uCodes.Length;
  15. TsData[] result = new TsData[len];
  16. Dictionary<string, TsData > respData = RestfulClient.findHistorySectionByThingCodes(thingType, thingId, uCodes, ts);
  17. for (int i=0;i<len;i++)
  18. {
  19. if (respData.ContainsKey(uCodes[i]))
  20. {
  21. result[i] = respData[uCodes[i]];
  22. } else
  23. {
  24. result[i] = null;
  25. }
  26. }
  27. return result;
  28. }
  29. public static TsData[] findLatestByTagNames(string[] tagNames)
  30. {
  31. int len = tagNames.Length;
  32. TsData[] result = new TsData[len];
  33. Dictionary<string, TsData> respData = RestfulClient.findLatestByTagNames(tagNames);
  34. for (int i = 0; i < len; i++)
  35. {
  36. if (respData.ContainsKey(tagNames[i]))
  37. {
  38. result[i] = respData[tagNames[i]];
  39. }
  40. else
  41. {
  42. result[i] = null;
  43. }
  44. }
  45. return result;
  46. }
  47. }
  48. }