qin
2025-03-14 185565a8eb30c0546746aad52aac0926d395a76d
WinFrmUI/PBS.WinFrmUI/02-facility/00-core/FacilitiesCtrl.cs
@@ -43,11 +43,11 @@
                this.dxErrorProvider1.SetError(this.txtConstantP, "必填项");
                isExist = false;
            }
            if (this.comboBoxCompletePlant.Text == "请选择")
            {
                this.dxErrorProvider1.SetError(this.comboBoxCompletePlant, "必填项");
                isExist = false;
            }
            /*  if (this.comboBoxCompletePlant.Text == "请选择")
              {
                  this.dxErrorProvider1.SetError(this.comboBoxCompletePlant, "必填项");
                  isExist = false;
              }*/
            if (this.comboBoxWaterSupply.Text == "请选择")
            {
                this.dxErrorProvider1.SetError(this.comboBoxWaterSupply, "必填项");
@@ -63,38 +63,30 @@
                this.dxErrorProvider1.SetError(this.txtWaterPressure, "必填项");
                return false;
            }
            if (string.IsNullOrEmpty(this.textEdit11.Text.Trim()))
            {
                this.dxErrorProvider1.SetError(this.textEdit11, "必填项");
                return false;
            }
            return isExist;
        }
        private Vmo.FacilityVmo _facilityVmo = new Vmo.FacilityVmo();
        public async void SetBindingData()
        {
            /*            this.txtName.EditValue = model.Name;
                        this.txtFloor.EditValue = model.Floor;
                        this.txtFloorHouseHolds.EditValue = model.Households;
                        this.txtFloorHeight.EditValue = model.FloorHeight;
                        this.txtMaxWaterDemand.EditValue = model.MaxWaterDemand;
                        this.txtWaterPressure.EditValue = model.TerminalPressure;
                        this.comboBoxWaterSupply.EditValue = model.WaterSupply;
                        this.txtConstantP.EditValue = model.ConstantPressure;
                        this.imageComboBoxEdit11.EditValue = model.SupplyMode;
                        *//*            if (_model.ModelConfig.Contains("2d"))
                                        checkedListBoxControl1.Items[0].CheckState = System.Windows.Forms.CheckState.Checked;
                                    if (_model.ModelConfig.Contains("3d"))
                                        checkedListBoxControl1.Items[1].CheckState = System.Windows.Forms.CheckState.Checked;
                        *//*
                        layoutControlItem1.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
                        layoutControlItem2.Visibility = DevExpress.XtraLayout.Utils.LayoutVisibility.Always;
            */
            this.textEditWaterModel.Properties.AddEnum(typeof(HStation.PBS.eSupplyMode));
            this.comboBoxWaterSupply.Properties.AddEnum(typeof(HStation.PBS.eWaterSupply));
            var allPackages = await new HStation.BLL.AssetsPackageMain().GetAll();
        }
        public void SetData(Vmo.FacilityVmo model)
        {
            _facilityVmo = model;
            this.txtName.EditValue = model.Name;
            this.txtFloor.EditValue = model.Floor;
            this.txtFloorHouseHolds.EditValue = model.Households;
            this.txtFloorHeight.EditValue = model.FloorHeight;
            this.txtMaxWaterDemand.EditValue = model.MaxWaterDemand;
            this.txtWaterPressure.EditValue = model.TerminalPressure;
            this.comboBoxWaterSupply.EditValue = model.WaterSupply;
            this.txtConstantP.EditValue = model.ConstantPressure;
            this.textEditWaterModel.EditValue = model.SupplyMode;
        }
        //获取文本信息
@@ -102,27 +94,20 @@
        {
            if (!Valid())
                return null;
            var model = new Vmo.FacilityVmo();
            model.Floor = int.Parse(txtFloor.Text);
            model.Name = txtName.Text;
            // BuildingID = buildid,
            model.SupplyMode = HStation.PBS.eSupplyMode.WaterTank;
            //TemplateID = templateID,
            model.UseStatus = Yw.Vmo.eUseStatus.Disable;
            model.FloorHeight = double.Parse(txtFloorHeight.Text);
            model.Households = int.Parse(txtFloorHouseHolds.Text);
            model.ConstantPressure = double.Parse(txtConstantP.Text);
            //  ModelConfig = mc,
            model.MaxWaterDemand = Convert.ToDouble(txtMaxWaterDemand.EditValue);
            model.TerminalPressure = Convert.ToDouble(txtWaterPressure.EditValue);
            //CompletePlant = comboBoxCompletePlant.EditValue.ToString(),
            _facilityVmo.Floor = int.Parse(txtFloor.Text);
            _facilityVmo.Name = txtName.Text;
            _facilityVmo.SupplyMode = HStation.PBS.eSupplyMode.WaterTank;
            _facilityVmo.UseStatus = Yw.Vmo.eUseStatus.Enable;
            _facilityVmo.FloorHeight = double.Parse(txtFloorHeight.Text);
            _facilityVmo.Households = int.Parse(txtFloorHouseHolds.Text);
            _facilityVmo.ConstantPressure = double.Parse(txtConstantP.Text);
            _facilityVmo.MaxWaterDemand = Convert.ToDouble(txtMaxWaterDemand.EditValue);
            _facilityVmo.TerminalPressure = Convert.ToDouble(txtWaterPressure.EditValue);
            if (comboBoxWaterSupply.EditValue != null)
            {
                model.WaterSupply = (HStation.PBS.eWaterSupply)comboBoxWaterSupply.EditValue;
                _facilityVmo.WaterSupply = (HStation.PBS.eWaterSupply)comboBoxWaterSupply.EditValue;
            }
            return model;
            //= Convert.ToDouble(textEdit11.EditValue),
            // ModelType = imageComboBoxEdit11.EditValue.ToString(),
            return _facilityVmo;
        }
    }
}