lixiaojun
2024-11-06 278e94cb1b045288d1205f36b67f60cb5224754c
WinFrmUI/Yw.WinFrmUI.Hydro.Core/04-viewmodel/01-parter/HydroParterViewModel.cs
@@ -155,6 +155,43 @@
        public virtual Yw.Model.HydroModelInfo HydroInfo { get; set; }
        /// <summary>
        /// 获取属性状态
        /// </summary>
        public HydroParterPropStatusViewModel GetPropStatus(string propName)
        {
            if (this.PropStatusList == null)
            {
                return default;
            }
            var propStatus = this.PropStatusList.Find(x => x.PropName == propName);
            return propStatus;
        }
        /// <summary>
        /// 更新属性状态
        /// </summary>
        public bool UpdatePropStatus(string propName, Yw.Hydro.ePropStatus propStatus, string statusInfo)
        {
            if (string.IsNullOrEmpty(propName))
            {
                return false;
            }
            if (this.PropStatusList == null)
            {
                this.PropStatusList = new List<HydroParterPropStatusViewModel>();
            }
            var propStatusViewModel = GetPropStatus(propName);
            if (propStatusViewModel == null)
            {
                propStatusViewModel = new HydroParterPropStatusViewModel() { PropName = propName };
                this.PropStatusList.Add(propStatusViewModel);
            }
            propStatusViewModel.PropStatus = propStatus;
            propStatusViewModel.StatusInfo = statusInfo;
            return true;
        }
        /// <summary>
        /// 更新属性
        /// </summary>
        public virtual void UpdateProperty()
@@ -187,7 +224,30 @@
        }
        /// <summary>
        /// 更新Vmo属性
        /// </summary>
        public virtual void UpdateVmoProperty()
        {
            this.Vmo.ID = this.ID;
            this.Vmo.UpdatePropStatus(nameof(this.Vmo.ID), this, nameof(this.ID));
            this.Vmo.Catalog = HydroParterCatalogHelper.GetCatalogCode(this.Catalog);
            this.Vmo.UpdatePropStatus(nameof(this.Vmo.Catalog), this, nameof(this.Catalog));
            this.Vmo.Name = this.Name;
            this.Vmo.UpdatePropStatus(nameof(this.Vmo.Name), this, nameof(this.Name));
            this.Vmo.Code = this.Code;
            this.Vmo.UpdatePropStatus(nameof(this.Vmo.Code), this, nameof(this.Code));
            this.Vmo.ModelType = this.ModelType;
            this.Vmo.UpdatePropStatus(nameof(this.Vmo.ModelType), this, nameof(this.ModelType));
            this.Vmo.DbId = this.DbId;
            this.Vmo.UpdatePropStatus(nameof(this.Vmo.DbId), this, nameof(this.DbId));
            this.Vmo.DbLocked = this.DbLocked;
            this.Vmo.UpdatePropStatus(nameof(this.Vmo.DbLocked), this, nameof(this.DbLocked));
            this.Vmo.Flags = Yw.Untity.FlagsHelper.ToList(this.Flags);
            this.Vmo.UpdatePropStatus(nameof(this.Vmo.Flags), this, nameof(this.Flags));
            this.Vmo.Description = this.Description;
            this.Vmo.UpdatePropStatus(nameof(this.Vmo.Description), this, nameof(this.Description));
        }