namespace Yw.WinFrmUI
{
///
/// 水力组件视图
///
[TypeConverter(typeof(PropertySorter))]
public class HydroParterViewModel
{
///
///
///
public HydroParterViewModel() { }
///
///
///
public HydroParterViewModel
(
Yw.Model.HydroParterInfo rhs,
Yw.Model.HydroModelInfo hydroInfo
)
{
this.Code = rhs.Code;
this.Name = rhs.Name;
this.Catalog = HydroParterCatalogHelper.GetName(rhs.Catalog);
this.ModelType = rhs.ModelType;
this.DbId = rhs.DbId;
this.DbLocked = rhs.DbLocked;
this.Flags = Yw.Untity.FlagsHelper.ToString(rhs.Flags);
this.Description = rhs.Description;
this.Vmo = rhs;
this.HydroInfo = hydroInfo;
}
///
/// 编码
///
[Category("基础信息")]
[DisplayName("编码")]
[PropertyOrder(1)]
[ReadOnly(true)]
[Browsable(true)]
public virtual string Code { get; set; }
///
/// 名称
///
[Category("基础信息")]
[DisplayName("名称")]
[PropertyOrder(2)]
[Browsable(true)]
public virtual string Name { get; set; }
///
/// 分类
///
[Category("基础信息")]
[DisplayName("分类")]
[PropertyOrder(3)]
[ReadOnly(true)]
[Browsable(true)]
public virtual string Catalog { get; set; }
///
/// 型号
///
[Category("基础信息")]
[DisplayName("型号")]
[PropertyOrder(4)]
[HydroModelTypePro]
[Browsable(true)]
public virtual string ModelType { get; set; }
///
/// DbId
///
[Browsable(false)]
public virtual string DbId { get; set; }
///
/// 匹配
///
[Category("基础信息")]
[DisplayName("匹配")]
[PropertyOrder(5)]
[ShowEditor(false)]
[Browsable(true)]
public virtual bool HasDb
{
get { return !string.IsNullOrEmpty(this.DbId); }
}
///
/// 标签
///
[Category("基础信息")]
[DisplayName("标签")]
[PropertyOrder(6)]
[HydroFlagsPro]
[Browsable(true)]
public virtual string Flags { get; set; }
///
/// 说明
///
[Category("基础信息")]
[DisplayName("说明")]
[PropertyOrder(7)]
[MultiText]
[Browsable(true)]
public virtual string Description { get; set; }
///
/// 锁定
///
[Category("基础信息")]
[DisplayName("锁定")]
[PropertyOrder(8)]
[Browsable(true)]
public virtual bool DbLocked { get; set; }
///
/// Vmo
///
[Browsable(false)]
public virtual Yw.Model.HydroParterInfo Vmo
{
get
{
return _vmo;
}
set
{
_vmo = value;
}
}
protected Yw.Model.HydroParterInfo _vmo = null;
///
/// HydroInfo
///
[Browsable(false)]
public virtual Yw.Model.HydroModelInfo HydroInfo { get; set; }
///
/// PropStatusHelper
///
[Browsable(false)]
public virtual HydroPropStatusHelper PropStatusHelper { get; set; }
///
/// 更新属性
///
public virtual void UpdateProperty()
{
this.Code = this.Vmo.Code;
this.Name = this.Vmo.Name;
this.Catalog = HydroParterCatalogHelper.GetName(this.Vmo.Catalog);
this.ModelType = this.Vmo.ModelType;
this.DbId = this.Vmo.DbId;
this.Flags = Yw.Untity.FlagsHelper.ToString(this.Vmo.Flags);
this.Description = this.Vmo.Description;
this.DbLocked = this.Vmo.DbLocked;
}
///
/// 更新Vmo属性
///
public virtual void UpdateVmoProperty()
{
this.Vmo.Code = this.Code;
this.Vmo.Name = this.Name;
this.Vmo.Catalog = HydroParterCatalogHelper.GetCode(this.Catalog);
this.Vmo.ModelType = this.ModelType;
this.Vmo.DbId = this.DbId;
this.Vmo.DbLocked = this.DbLocked;
this.Vmo.Flags = Yw.Untity.FlagsHelper.ToList(this.Flags);
this.Vmo.Description = this.Description;
}
}
}