| | |
| | | /// <summary> |
| | | /// æ·»å |
| | | /// </summary> |
| | | public void SetBindingData(long benchID) |
| | | public void SetBindingData( ) |
| | | { |
| | | _model = new Model.WorkBenchMonitorPoint(); |
| | | _model.CreateTime = DateTime.Now; |
| | | _model.CreateUserID = TProduct.WinFrmUI.GlobeParas.CurrentLoginUser.ID; |
| | | _model.UpdateTime = DateTime.Now; |
| | | _model.BenchID = benchID; |
| | | _model.UseStatus = Model.eUseStatus.Enable; |
| | | var sortCode = new BLL.WorkBenchMonitorPoint().GetMaxSortCode(benchID); |
| | | this.txtSortCode.EditValue = ++sortCode; |
| | | this.imgComUserStatus.EditValue = Model.eUseStatus.Enable; |
| | | this.checkEditDispInPanel.Checked = true; |
| | | //_model = new Model.WorkBenchMonitorPoint(); |
| | | //_model.CreateTime = DateTime.Now; |
| | | //_model.CreateUserID = TProduct.WinFrmUI.GlobeParas.CurrentLoginUser.ID; |
| | | //_model.UpdateTime = DateTime.Now; |
| | | //_model.BenchID = benchID; |
| | | //_model.UseStatus = Model.eUseStatus.Enable; |
| | | //var sortCode = new BLL.WorkBenchMonitorPoint().GetMaxSortCode(benchID); |
| | | //this.txtSortCode.EditValue = ++sortCode; |
| | | //this.imgComUserStatus.EditValue = Model.eUseStatus.Enable; |
| | | //this.checkEditDispInPanel.Checked = true; |
| | | } |
| | | |
| | | public void SetBindingData(Model.WorkBenchMonitorPoint model) |
| | |
| | | _oldName = _model.Name; |
| | | this.txtName.EditValue = _model.Name; |
| | | this.textEditTag.Text = _model.Tag; |
| | | this.txtPipeDia.EditValue = _model.PipeDia; |
| | | // this.txtPipeDia.EditValue = _model.PipeDia; |
| | | this.imgComMonitorType.EditValue = _model.MonitorType; |
| | | this.txtElevation.EditValue = _model.Elevation; |
| | | // this.txtElevation.EditValue = _model.Elevation; |
| | | |
| | | this.txtSortCode.EditValue = _model.SortCode; |
| | | this.imgComUserStatus.EditValue = _model.UseStatus; |
| | |
| | | { |
| | | if (model.DigitalParas != null) |
| | | { |
| | | textEditRegisterAddress.Text = model.DigitalParas.RegisterAddress.ToString(); |
| | | spinEditDataLength.Text = model.DigitalParas.DataLength.ToString(); |
| | | spinEditDecimalPointPosition.Text = model.DigitalParas.DecimalPointPosition.ToString(); |
| | | //textEditRegisterAddress.Text = model.DigitalParas.RegisterAddress.ToString(); |
| | | //spinEditDataLength.Text = model.DigitalParas.DataLength.ToString(); |
| | | //spinEditDecimalPointPosition.Text = model.DigitalParas.DecimalPointPosition.ToString(); |
| | | |
| | | if (model.DigitalParas.ValueType == 0) |
| | | { |
| | | imageComboBoxDtype.SelectedIndex = 0; |
| | | layoutControlGroup模æé.Enabled = false; |
| | | } |
| | | else if (model.DigitalParas.ValueType == 1) |
| | | { |
| | | imageComboBoxDtype.SelectedIndex = 1; |
| | | layoutControlGroup模æé.Enabled = true; |
| | | if (model.AnalogParas != null) |
| | | { |
| | | spinEditRangeMax.Text = model.AnalogParas.RangeMax.ToString(); |
| | | spinEditRangeMin.Text = model.AnalogParas.RangeMin.ToString(); |
| | | } |
| | | } |
| | | |
| | | //if (model.DigitalParas.ValueType == 0) |
| | | //{ |
| | | // imageComboBoxDtype.SelectedIndex = 0; |
| | | // layoutControlGroup模æé.Enabled = false; |
| | | //} |
| | | //else if (model.DigitalParas.ValueType == 1) |
| | | //{ |
| | | // imageComboBoxDtype.SelectedIndex = 1; |
| | | // layoutControlGroup模æé.Enabled = true; |
| | | // if (model.AnalogParas != null) |
| | | // { |
| | | // spinEditRangeMax.Text = model.AnalogParas.RangeMax.ToString(); |
| | | // spinEditRangeMin.Text = model.AnalogParas.RangeMin.ToString(); |
| | | // } |
| | | //} |
| | | } |
| | | } |
| | | else if (model.SourceType == Model.eMonitorPointSourceType.模æé) |
| | | { |
| | | if (model.AnalogParas != null) |
| | | { |
| | | spinEditRangeMax.Text = model.AnalogParas.RangeMax.ToString(); |
| | | spinEditRangeMin.Text = model.AnalogParas.RangeMin.ToString(); |
| | | } |
| | | //if (model.AnalogParas != null) |
| | | //{ |
| | | // spinEditRangeMax.Text = model.AnalogParas.RangeMax.ToString(); |
| | | // spinEditRangeMin.Text = model.AnalogParas.RangeMin.ToString(); |
| | | //} |
| | | |
| | | } |
| | | |
| | |
| | | _model.Property = this.txtProperty.Text.Trim(); |
| | | _model.Tag = this.textEditTag.Text; |
| | | _model.MonitorType = (Model.eMonitorType)this.imgComMonitorType.EditValue; |
| | | if (!string.IsNullOrEmpty(this.txtPipeDia.Text)) |
| | | _model.PipeDia = double.Parse(this.txtPipeDia.Text.Trim()); |
| | | else |
| | | _model.PipeDia = null; |
| | | if (!string.IsNullOrEmpty(this.txtElevation.Text)) |
| | | _model.Elevation = double.Parse(this.txtElevation.Text.Trim()); |
| | | else |
| | | _model.Elevation = null; |
| | | //if (!string.IsNullOrEmpty(this.txtPipeDia.Text)) |
| | | // _model.PipeDia = double.Parse(this.txtPipeDia.Text.Trim()); |
| | | //else |
| | | // _model.PipeDia = null; |
| | | //if (!string.IsNullOrEmpty(this.txtElevation.Text)) |
| | | // _model.Elevation = double.Parse(this.txtElevation.Text.Trim()); |
| | | //else |
| | | // _model.Elevation = null; |
| | | //if (!string.IsNullOrEmpty(this.txtValueCoefficient.Text)) |
| | | // _model.ValueCoefficient = double.Parse(this.txtValueCoefficient.Text.Trim()); |
| | | //if (!string.IsNullOrEmpty(this.txtValueAdditional.Text)) |
| | |
| | | { |
| | | _model.DigitalParas = null; |
| | | _model.SourceType = Model.eMonitorPointSourceType.模æé; |
| | | _model.AnalogParas = new Model.AnalogMonitorPointParas(); |
| | | _model.AnalogParas.RangeMax = Convert.ToDouble(spinEditRangeMax.Text); |
| | | _model.AnalogParas.RangeMin = Convert.ToDouble(spinEditRangeMin.Text); |
| | | //_model.AnalogParas = new Model.AnalogMonitorPointParas(); |
| | | //_model.AnalogParas.RangeMax = Convert.ToDouble(spinEditRangeMax.Text); |
| | | //_model.AnalogParas.RangeMin = Convert.ToDouble(spinEditRangeMin.Text); |
| | | } |
| | | else if (this.comboBoxSource.SelectedIndex == 2) |
| | | { |
| | | |
| | | { |
| | | _model.SourceType = Model.eMonitorPointSourceType.æ°åé; |
| | | _model.DigitalParas = new Model.DigitalMonitorPointParas(); |
| | | if (string.IsNullOrEmpty(textEditRegisterAddress.Text)) |
| | | { |
| | | _model.DigitalParas.RegisterAddress = 0; |
| | | } |
| | | else if (textEditRegisterAddress.Text.ToLower().Contains("0x")) |
| | | { |
| | | _model.DigitalParas.RegisterAddress = Convert.ToByte(textEditRegisterAddress.Text, 16); |
| | | } |
| | | else |
| | | { |
| | | _model.DigitalParas.RegisterAddress = Convert.ToInt32(textEditRegisterAddress.Text); |
| | | } |
| | | _model.DigitalParas.DataLength = Convert.ToInt32(spinEditDataLength.Text); |
| | | _model.DigitalParas.DecimalPointPosition = Convert.ToInt32(spinEditDecimalPointPosition.Text); |
| | | //if (string.IsNullOrEmpty(textEditRegisterAddress.Text)) |
| | | //{ |
| | | // _model.DigitalParas.RegisterAddress = 0; |
| | | //} |
| | | //else if (textEditRegisterAddress.Text.ToLower().Contains("0x")) |
| | | //{ |
| | | // _model.DigitalParas.RegisterAddress = Convert.ToByte(textEditRegisterAddress.Text, 16); |
| | | //} |
| | | //else |
| | | //{ |
| | | // _model.DigitalParas.RegisterAddress = Convert.ToInt32(textEditRegisterAddress.Text); |
| | | //} |
| | | //_model.DigitalParas.DataLength = Convert.ToInt32(spinEditDataLength.Text); |
| | | //_model.DigitalParas.DecimalPointPosition = Convert.ToInt32(spinEditDecimalPointPosition.Text); |
| | | |
| | | _model.DigitalParas.ValueType = Convert.ToInt32(imageComboBoxDtype.EditValue); |
| | | if (_model.DigitalParas.ValueType == 0) |
| | |
| | | } |
| | | else |
| | | { |
| | | _model.AnalogParas = new Model.AnalogMonitorPointParas(); |
| | | _model.AnalogParas.RangeMax = Convert.ToDouble(spinEditRangeMax.Text); |
| | | _model.AnalogParas.RangeMin = Convert.ToDouble(spinEditRangeMin.Text); |
| | | //_model.AnalogParas = new Model.AnalogMonitorPointParas(); |
| | | //_model.AnalogParas.RangeMax = Convert.ToDouble(spinEditRangeMax.Text); |
| | | //_model.AnalogParas.RangeMin = Convert.ToDouble(spinEditRangeMin.Text); |
| | | } |
| | | } |
| | | else if (this.comboBoxSource.SelectedIndex == 3) |
| | |
| | | } |
| | | if (string.IsNullOrEmpty(_oldName) || _oldName != this.txtName.Text.Trim()) |
| | | { |
| | | if (new BLL.WorkBenchMonitorPoint().IsExistName(this._model.ID, this.txtName.Text.Trim())) |
| | | if (new BLL.WorkBenchMonitorPoint().IsExistName( this.txtName.Text.Trim())) |
| | | { |
| | | this.dxErrorProvider1.SetError(this.txtName, "该åç§°å·²åå¨ï¼"); |
| | | return false; |
| | |
| | | { |
| | | if (comboBoxSource.SelectedIndex == 0) |
| | | { |
| | | layoutControlGroup模æé.Enabled = false; |
| | | //layoutControlGroup模æé.Enabled = false; |
| | | layoutControlGroupæ°åé.Enabled = false; |
| | | } |
| | | if (comboBoxSource.SelectedIndex == 1) |
| | | { |
| | | layoutControlGroup模æé.Enabled = true; |
| | | //layoutControlGroup模æé.Enabled = true; |
| | | layoutControlGroupæ°åé.Enabled = false; |
| | | } |
| | | if (comboBoxSource.SelectedIndex == 2) |
| | | { |
| | | |
| | | { |
| | | layoutControlGroupæ°åé.Enabled = true; |
| | | if (Convert.ToInt32(imageComboBoxDtype.EditValue) == 0) |
| | | { |
| | | layoutControlGroup模æé.Enabled = false; |
| | | } |
| | | else |
| | | { |
| | | layoutControlGroup模æé.Enabled = true; |
| | | } |
| | | //if (Convert.ToInt32(imageComboBoxDtype.EditValue) == 0) |
| | | //{ |
| | | // // layoutControlGroup模æé.Enabled = false; |
| | | //} |
| | | //else |
| | | //{ |
| | | // // layoutControlGroup模æé.Enabled = true; |
| | | //} |
| | | } |
| | | } |
| | | |
| | | private void imageComboBoxDtype_SelectedIndexChanged(object sender, EventArgs e) |
| | | { |
| | | if (Convert.ToInt32(imageComboBoxDtype.EditValue) == 0) |
| | | { |
| | | layoutControlGroup模æé.Enabled = false; |
| | | } |
| | | else |
| | | { |
| | | layoutControlGroup模æé.Enabled = true; |
| | | } |
| | | //if (Convert.ToInt32(imageComboBoxDtype.EditValue) == 0) |
| | | //{ |
| | | // layoutControlGroup模æé.Enabled = false; |
| | | //} |
| | | //else |
| | | //{ |
| | | // layoutControlGroup模æé.Enabled = true; |
| | | //} |
| | | } |
| | | |
| | | private void simpleLabelItemæ°æ®ä¿®æ£_Click(object sender, EventArgs e) |