public void ReadMethodInfo(string _methodName) { BLL.ControlMethod_C bllts_C = new HR_Test.BLL.ControlMethod_C(); Model.ControlMethod_C modelc = bllts_C.GetModel(_methodName); if (modelc != null) { c_testNo.Text = ""; c_testNum.Text = ""; _sendCompany = modelc.sendCompany; _condition = modelc.condition; _controlMode = modelc.controlmode; c_stuffCardNo.Text = modelc.stuffCardNo; c_stuffSpec.Text = modelc.stuffSpec; c_stuffType.Text = modelc.stuffType; _hotStatus = modelc.hotStatus; _temperature = modelc.temperature.ToString(); _humidity = modelc.humidity.ToString(); _sampleCharacter = modelc.sampleCharacter; _testStandard_C.Text = modelc.testStandard; c_sign.Text = modelc.sign; c_L.Text = modelc.L.ToString(); c_L0.Text = modelc.L0.ToString(); c_HH.Text = modelc.H.ToString(); c_h.Text = modelc.hh.ToString(); c_getSample.Text = modelc.getSample; txtn.Text = modelc.a.ToString(); Epc.Text = modelc.b.ToString(); Etc.Text = modelc.d.ToString(); c_S0.Text = ""; c_Ff.Text = modelc.Ff.ToString(); c_mathineType.Text = modelc.mathineType; c_tester.Text = modelc.tester; c_testMethod.Text = modelc.testMethod; } }
private void gBtnAddToMethod2_Click(object sender, EventArgs e) { string strErr = ""; if (this._sendCompany.Trim().Length == 0) { strErr += "送检单位不能为空!\r\n\r\n"; } if (this.c_stuffCardNo.Text.Trim().Length == 0) { strErr += "材料牌号不能为空!\r\n\r\n"; } if (this.c_stuffSpec.Text.Trim().Length == 0) { strErr += "材料规格不能为空!\r\n\r\n"; } if (this.c_stuffType.Text.Trim().Length == 0) { strErr += "试样类型不能为空!\r\n\r\n"; } if (this._temperature.Trim().Length == 0) { strErr += "试验温度不能为空!\r\n\r\n"; } if (this.c_testMethod.Text.Trim().Length == 0) { strErr += "试验方法不能为空!\r\n\r\n"; } if (this._sampleCharacter.Trim().Length == 0) { strErr += "试样标识不能为空!\r\n\r\n"; } if (this._condition.Trim().Length == 0) { strErr += "试验条件不能为空!\r\n\r\n"; } if (this._controlMode.Trim().Length == 0) { strErr += "控制方式不能为空!\r\n\r\n"; } if (this.c_getSample.Text.Trim().Length == 0) { strErr += "试样取样不能为空!\r\n\r\n"; } if (this.c_L0.Text.Trim().Length == 0) { strErr += "'L0'不能为空!\r\n\r\n"; } else { if (double.Parse(this.c_L0.Text.Trim()) == 0d) { strErr += "'L0'不能为0!\r\n\r\n"; } } if (strErr != "") { MessageBox.Show(this, strErr); return; } BLL.ControlMethod_C bllcm_C = new HR_Test.BLL.ControlMethod_C(); HR_Test.Model.ControlMethod_C model = bllcm_C.GetModel(this.c_testMethod.Text); model.sendCompany = this._sendCompany; model.stuffCardNo = this.c_stuffCardNo.Text; model.stuffSpec = c_stuffSpec.Text; model.stuffType = c_stuffType.Text; model.hotStatus = this._hotStatus; model.temperature = double.Parse(this._temperature); model.humidity = double.Parse(this._humidity); model.testStandard = this._testStandard_C.Text; model.testMethod = c_testMethod.Text; model.mathineType = c_mathineType.Text; model.testCondition = "-"; model.sampleCharacter = this._sampleCharacter; model.getSample = c_getSample.Text; model.tester = c_tester.Text; model.condition = this._condition; model.controlmode = this._controlMode; model.assessor = "-"; model.sign = this.c_sign.Text; //model.a = (this.c_a.Text.Trim().Length > 0 ? double.Parse(c_a.Text) : 0); //model.b = (this.c_b.Text.Trim().Length > 0 ? double.Parse(c_b.Text) : 0); //model.d = (this.c_d.Text.Trim().Length > 0 ? double.Parse(c_d.Text) : 0); //修改为放大倍数 model.a = (this.txtn.Text.Trim().Length > 0 ? double.Parse(txtn.Text) : 0); //修改为 Epc model.b = (this.Epc.Text.Trim().Length > 0 ? double.Parse(Epc.Text) : 0); //修改为 Etc model.d = (this.Etc.Text.Trim().Length > 0 ? double.Parse(Etc.Text) : 0); model.L = (this.c_L.Text.Trim().Length > 0 ? double.Parse(c_L.Text) : 0); model.L0 = (this.c_L0.Text.Trim().Length > 0 ? double.Parse(c_L0.Text) : 0); model.H = (this.c_HH.Text.Trim().Length > 0 ? double.Parse(c_HH.Text) : 0); model.hh = (this.c_h.Text.Trim().Length > 0 ? double.Parse(c_h.Text) : 0); //model.S0 = double.Parse(c_S0.Text); model.Ff = (this.c_Ff.Text.Trim().Length > 0 ? double.Parse(c_Ff.Text) : 0); if (bllcm_C.Update(model)) { MessageBox.Show(this, "更新成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } }