namespace PBS.WinFrmUI.Hydro { public partial class PumpCtrl : DevExpress.XtraEditors.XtraUserControl, IPlaceInfo { public PumpCtrl() { InitializeComponent(); } private Model.Pump _model = null; public void Set(string paras) { _model = Model.Pump.ToModel(paras); if (_model == null) _model = new Model.Pump(); this.QrTextEdit.EditValue = _model.Qr; this.HrTextEdit.EditValue = _model.Hr; this.NrTextEdit.EditValue = _model.Nr; this.PrTextEdit.EditValue = _model.Pr; this.ErTextEdit.EditValue = _model.Er; this.NPSHrTextEdit.EditValue = _model.NPSHr; this.StNumrTextEdit.EditValue = _model.StNumr; this.IcTextEdit.EditValue = _model.Ic; this.OcTextEdit.EditValue = _model.Oc; this.IOdTextEdit.EditValue = _model.IOd; this.IeTextEdit.EditValue = _model.Ie; this.OeTextEdit.EditValue = _model.Oe; this.IsBpCheckEdit.Checked = _model.IsBp; this.IsSxpCheckEdit.Checked = _model.IsSxp; } public bool Valid() { return true; } public string Get() { _model.Qr = Convert.ToDouble(this.QrTextEdit.EditValue); _model.Hr = Convert.ToDouble(this.HrTextEdit.EditValue); _model.Nr = Convert.ToDouble(this.NrTextEdit.EditValue); _model.Pr = Convert.ToDouble(this.PrTextEdit.EditValue); _model.Er = Convert.ToDouble(this.ErTextEdit.EditValue); _model.NPSHr = Convert.ToDouble(this.NPSHrTextEdit.EditValue); _model.StNumr = Convert.ToInt32(this.StNumrTextEdit.EditValue); if (this.IcTextEdit.EditValue == null) _model.Ic = null; else _model.Ic = Convert.ToDouble(this.IcTextEdit.EditValue); if (this.OcTextEdit.EditValue == null) _model.Oc = null; else _model.Oc = Convert.ToDouble(this.OcTextEdit.EditValue); if (this.IOdTextEdit.EditValue == null) _model.IOd = null; else _model.IOd = Convert.ToDouble(this.IOdTextEdit.EditValue); if (this.IeTextEdit.EditValue == null) _model.Ie = null; else _model.Ie = Convert.ToDouble(this.IeTextEdit.EditValue); if (this.OeTextEdit.EditValue == null) _model.Oe = null; else _model.Oe = Convert.ToDouble(this.OeTextEdit.EditValue); _model.IsBp = this.IsBpCheckEdit.Checked; _model.IsSxp = this.IsSxpCheckEdit.Checked; return _model.ToJson(); } } }