MBuilding.cs 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. /* ==============================================================================
  2. * 功能描述:建筑体
  3. * 创 建 者:Garrett
  4. * 创建日期:2018/3/8 15:52:54
  5. * ==============================================================================*/
  6. using System;
  7. using System.Collections.Generic;
  8. using System.ComponentModel;
  9. using System.Linq;
  10. using System.Xml.Serialization;
  11. using Newtonsoft.Json.Linq;
  12. using SAGA.DotNetUtils.Serializer;
  13. using SAGA.DotNetUtils.WPF.UserControl.ComboboxTreeView;
  14. using SAGA.MBI.CmbData;
  15. using SAGA.MBI.Common;
  16. using SAGA.MBI.DataArrange;
  17. using SAGA.MBI.FileStream;
  18. using SAGA.MBI.JsonConvert;
  19. using SAGA.MBI.Login;
  20. using SAGA.MBI.Tools;
  21. namespace SAGA.MBI.Model
  22. {
  23. [Serializable]
  24. [XmlRoot("MBuilding")]
  25. public class MBuilding : MFileBase
  26. {
  27. public MBuilding()
  28. {
  29. UserControlUp=new UcMFMBuildingUp();
  30. UserControlDown=new UcMFMBuildingDown();
  31. BuildingCmbVm=new BuildingCmbVm();
  32. }
  33. private string m_BuildAge;
  34. [Description("BuildAge")]
  35. public string BuildAge
  36. {
  37. get { return m_BuildAge; }
  38. set
  39. {
  40. m_BuildAge = value;
  41. NotifyPropertyChanged("BuildAge");
  42. }
  43. }
  44. private string m_BuildFuncType;
  45. [Description("BuildFuncType")]
  46. public string BuildFuncType
  47. {
  48. get { return m_BuildFuncType; }
  49. set
  50. {
  51. m_BuildFuncType = value;
  52. NotifyPropertyChanged("BuildFuncType");
  53. BuildingCmbVm.TreeFuncTypeInfoCur = DalCMBTreeView.GetItemByCode(BuildingCmbVm.TreeFuncTypeInfos, BuildFuncType);
  54. }
  55. }
  56. private string m_ACType;
  57. [Description("ACType")]
  58. public string ACType
  59. {
  60. get { return m_ACType; }
  61. set
  62. {
  63. m_ACType = value;
  64. NotifyPropertyChanged("ACType");
  65. BuildingCmbVm.TreeACTypeInfoCur = DalCMBTreeView.GetItemByCode(BuildingCmbVm.TreeACTypeInfos, ACType);
  66. }
  67. }
  68. private string m_HeatType;
  69. [Description("HeatType")]
  70. public string HeatType
  71. {
  72. get { return m_HeatType; }
  73. set
  74. {
  75. m_HeatType = value;
  76. NotifyPropertyChanged("HeatType");
  77. BuildingCmbVm.TreeHeatTypeInfoCur = DalCMBTreeView.GetItemByCode(BuildingCmbVm.TreeHeatTypeInfos, HeatType);
  78. }
  79. }
  80. private BuildingCmbVm m_BuildingCmbVm;
  81. [XmlIgnore]
  82. public BuildingCmbVm BuildingCmbVm
  83. {
  84. get { return m_BuildingCmbVm; }
  85. set
  86. {
  87. m_BuildingCmbVm = value;
  88. //NotifyPropertyChanged("ProvinceCityVm");
  89. }
  90. }
  91. private string m_Intro;
  92. [Description("Intro")]
  93. public string Intro
  94. {
  95. get { return m_Intro; }
  96. set
  97. {
  98. m_Intro = value;
  99. NotifyPropertyChanged("Intro");
  100. }
  101. }
  102. /// <summary>
  103. /// 类备份,用于取消更改
  104. /// </summary>
  105. /// <returns></returns>
  106. public override void Clone()
  107. {
  108. //FileOperateBase.Serialize(MBIConst.MBITempSettingPath, "CloneFile.xml", this);
  109. //m_MFileBaseBak = FileOperateBase.Deserialize<MBuilding>(MBIConst.MBITempSettingPath, "CloneFile.xml");
  110. m_MFileBaseBak = SerializerByXml.Clone<MBuilding>(this);
  111. }
  112. public override void SetJsonProperty(string json)
  113. {
  114. JObject jObject =JObject.Parse(json);
  115. this.Name = (string)jObject["BuildName"];
  116. this.LocalName = (string)jObject["BuildLocalName"];
  117. this.LocalId = (string)jObject["BuildLocalID"];
  118. base.SetJsonProperty(json);
  119. BuildingCmbVm.NotifyAction = NotifyPropertyChanged;
  120. }
  121. public override JObject GetJsonProperty()
  122. {
  123. BuildFuncType = DalCMBTreeView.GetCodeByItem(BuildingCmbVm.TreeFuncTypeInfoCur);
  124. ACType = DalCMBTreeView.GetCodeByItem(BuildingCmbVm.TreeACTypeInfoCur);
  125. HeatType = DalCMBTreeView.GetCodeByItem(BuildingCmbVm.TreeHeatTypeInfoCur);
  126. JObject jObject = base.GetJsonProperty();
  127. jObject.Add("BuildLocalID", CommonTool.GetPropertyJArray(LocalName));
  128. jObject.Add("BuildLocalName", CommonTool.GetPropertyJArray(LocalName));
  129. return jObject;
  130. }
  131. }
  132. }