DFLayoutLookupValue.cs 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using System;
  2. using System.Collections.Generic;
  3. using InABox.Core;
  4. namespace PRS.Mobile
  5. {
  6. public class DFLayoutLookupValue
  7. {
  8. public Guid ID { get; set; }
  9. public String Text { get; set; }
  10. public Dictionary<String,object> Values { get; set; }
  11. public DFLayoutLookupValue()
  12. {
  13. ID = Guid.Empty;
  14. Text = "";
  15. Values = new Dictionary<string, object>();
  16. }
  17. public DFLayoutLookupValue(String data = "") : this()
  18. {
  19. if (!String.IsNullOrWhiteSpace(data))
  20. {
  21. try
  22. {
  23. var value = Serialization.Deserialize<DFLayoutLookupValue>(data, true);
  24. ID = value?.ID ?? Guid.Empty;
  25. Text = value?.Text ?? "";
  26. Values = value?.Values ?? new Dictionary<String, Object>();
  27. }
  28. catch (Exception e)
  29. {
  30. ID = Guid.Empty;
  31. Text = data;
  32. Values = new Dictionary<String, Object>();
  33. }
  34. }
  35. }
  36. public override string ToString()
  37. {
  38. return Serialization.Serialize(this);
  39. }
  40. }
  41. }