Pouvoir.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. using System.Xml.Serialization;
  2. namespace Domain.XML_Model
  3. {
  4. [Serializable]
  5. [XmlRoot(ElementName = "pouvoirs")]
  6. public class Pouvoir : BaseEntity
  7. {
  8. [XmlIgnore]
  9. private string? _opposeAsAString;
  10. [XmlIgnore]
  11. private string? _prolongeableAsAString;
  12. [XmlAttribute(AttributeName = "id")]
  13. public string Id { get; set; }
  14. [XmlAttribute(AttributeName = "nom")]
  15. public string? Nom { get; set; }
  16. [XmlAttribute(AttributeName = "discipline")]
  17. public string? Discipline { get; set; }
  18. [XmlAttribute(AttributeName = "seuil")]
  19. public int Seuil { get; set; }
  20. [XmlAttribute(AttributeName = "action")]
  21. public string? Action { get; set; }
  22. [XmlIgnore]
  23. public bool Opposé { get; set; }
  24. [XmlAttribute(AttributeName = "opposé")]
  25. public string? OpposeAsAString
  26. {
  27. get => _opposeAsAString;
  28. set
  29. {
  30. //this.BadBoolField = Convert.ToBoolean(value);
  31. if (!value.Equals("True") && !value.Equals("true"))
  32. {
  33. if (value.Equals("False") || value.Equals("false"))
  34. Opposé = false;
  35. }
  36. else
  37. Opposé = true;
  38. }
  39. }
  40. [XmlAttribute(AttributeName = "portée")]
  41. public string? Portée { get; set; }
  42. [XmlIgnore]
  43. public bool Prolongeable { get; set; }
  44. [XmlAttribute(AttributeName = "prolongeable")]
  45. public string? ProlongeableAsAString
  46. {
  47. get => _prolongeableAsAString;
  48. set
  49. {
  50. //this.BadBoolField = Convert.ToBoolean(value);
  51. if (!value.Equals("True") && !value.Equals("true"))
  52. {
  53. if (value.Equals("False") || value.Equals("false"))
  54. Prolongeable = false;
  55. }
  56. else
  57. Prolongeable = true;
  58. }
  59. }
  60. [XmlAttribute(AttributeName = "description")]
  61. public string? Description { get; set; }
  62. [XmlIgnore] public int PouvoirId { get; set; }
  63. }
  64. }