RelationshipTools.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*-------------------------------------------------------------------------
  2. * 功能描述:RelationshipTools
  3. * 作者:李勇
  4. * 创建时间: 2018/10/31 17:59:46
  5. * 版本号:v1.0
  6. * -------------------------------------------------------------------------*/
  7. using System;
  8. using System.Collections.Generic;
  9. using System.Linq;
  10. using System.Text;
  11. using System.Threading.Tasks;
  12. using Newtonsoft.Json.Linq;
  13. namespace SAGA.GplotRelationComputerManage
  14. {
  15. public class RelationshipTools
  16. {
  17. /// <summary>
  18. /// 获取属性值
  19. /// </summary>
  20. /// <param name="equip"></param>
  21. /// <param name="propertyName"></param>
  22. /// <returns></returns>
  23. public static string GetValue(JObject equip, string propertyName)
  24. {
  25. // equip.GetValue("infos")
  26. string result = "";
  27. if (equip != null)
  28. {
  29. result = equip["infos"][propertyName] + "";
  30. //本地名称为空显示设备名称
  31. if (propertyName == "EquipLocalName" && result == "")
  32. {
  33. result = equip["infos"]["EquipName"] + "";
  34. }
  35. }
  36. return result;
  37. }
  38. }
  39. }