/* ==============================================================================
* 功能描述:建筑体
* 创 建 者:Garrett
* 创建日期:2018/3/8 15:52:54
* ==============================================================================*/
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Xml.Serialization;
using Newtonsoft.Json.Linq;
using SAGA.DotNetUtils.Serializer;
using SAGA.DotNetUtils.WPF.UserControl.ComboboxTreeView;
using SAGA.MBI.CmbData;
using SAGA.MBI.Common;
using SAGA.MBI.DataArrange;
using SAGA.MBI.FileStream;
using SAGA.MBI.JsonConvert;
using SAGA.MBI.Login;
using SAGA.MBI.Tools;
namespace SAGA.MBI.Model
{
[Serializable]
[XmlRoot("MBuilding")]
public class MBuilding : MFileBase
{
public MBuilding()
{
UserControlUp=new UcMFMBuildingUp();
UserControlDown=new UcMFMBuildingDown();
BuildingCmbVm=new BuildingCmbVm();
}
private string m_BuildAge;
[Description("BuildAge")]
public string BuildAge
{
get { return m_BuildAge; }
set
{
m_BuildAge = value;
NotifyPropertyChanged("BuildAge");
}
}
private string m_BuildFuncType;
[Description("BuildFuncType")]
public string BuildFuncType
{
get { return m_BuildFuncType; }
set
{
m_BuildFuncType = value;
NotifyPropertyChanged("BuildFuncType");
BuildingCmbVm.TreeFuncTypeInfoCur = DalCMBTreeView.GetItemByCode(BuildingCmbVm.TreeFuncTypeInfos, BuildFuncType);
}
}
private string m_ACType;
[Description("ACType")]
public string ACType
{
get { return m_ACType; }
set
{
m_ACType = value;
NotifyPropertyChanged("ACType");
BuildingCmbVm.TreeACTypeInfoCur = DalCMBTreeView.GetItemByCode(BuildingCmbVm.TreeACTypeInfos, ACType);
}
}
private string m_HeatType;
[Description("HeatType")]
public string HeatType
{
get { return m_HeatType; }
set
{
m_HeatType = value;
NotifyPropertyChanged("HeatType");
BuildingCmbVm.TreeHeatTypeInfoCur = DalCMBTreeView.GetItemByCode(BuildingCmbVm.TreeHeatTypeInfos, HeatType);
}
}
private BuildingCmbVm m_BuildingCmbVm;
[XmlIgnore]
public BuildingCmbVm BuildingCmbVm
{
get { return m_BuildingCmbVm; }
set
{
m_BuildingCmbVm = value;
//NotifyPropertyChanged("ProvinceCityVm");
}
}
private string m_Intro;
[Description("Intro")]
public string Intro
{
get { return m_Intro; }
set
{
m_Intro = value;
NotifyPropertyChanged("Intro");
}
}
///
/// 类备份,用于取消更改
///
///
public override void Clone()
{
//FileOperateBase.Serialize(MBIConst.MBITempSettingPath, "CloneFile.xml", this);
//m_MFileBaseBak = FileOperateBase.Deserialize(MBIConst.MBITempSettingPath, "CloneFile.xml");
m_MFileBaseBak = SerializerByXml.Clone(this);
}
public override void SetJsonProperty(string json)
{
JObject jObject =JObject.Parse(json);
this.Name = (string)jObject["BuildName"];
this.LocalName = (string)jObject["BuildLocalName"];
this.LocalId = (string)jObject["BuildLocalID"];
base.SetJsonProperty(json);
BuildingCmbVm.NotifyAction = NotifyPropertyChanged;
}
public override JObject GetJsonProperty()
{
BuildFuncType = DalCMBTreeView.GetCodeByItem(BuildingCmbVm.TreeFuncTypeInfoCur);
ACType = DalCMBTreeView.GetCodeByItem(BuildingCmbVm.TreeACTypeInfoCur);
HeatType = DalCMBTreeView.GetCodeByItem(BuildingCmbVm.TreeHeatTypeInfoCur);
JObject jObject = base.GetJsonProperty();
jObject.Add("BuildLocalID", CommonTool.GetPropertyJArray(LocalName));
jObject.Add("BuildLocalName", CommonTool.GetPropertyJArray(LocalName));
return jObject;
}
}
}