//保存修改结果 private void gBtnSaveResult_Click(object sender, EventArgs e) { switch (this._TestType) { case "GBT3354-2014": BLL.GBT3354_Samples bllTs = new HR_Test.BLL.GBT3354_Samples(); Model.GBT3354_Samples modelTs = bllTs.GetModel(this.tslblSampleNo.Text); foreach (UC.Result ucR in this.flowLayoutPanel1.Controls) { switch (ucR.Name) { //case "Pmax": // modelTs.Pmax = double.Parse(ucR.Tag.ToString()) * 1000.0; // break; //case "σt": // modelTs.σt = double.Parse(ucR.Tag.ToString()); // break; //case "ε1t": // modelTs.ε1t = double.Parse(ucR.Tag.ToString()); // break; //case "μ12": // modelTs.μ12 = double.Parse(ucR.Tag.ToString()); // break; case "ε1t": modelTs.ε1t = double.Parse(ucR.Tag.ToString()); break; } } if (bllTs.Update(modelTs)) { MessageBox.Show(this, "更新成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } break; } }
public static void CreateCurveFile(string _testpath, Model.GBT3354_Samples modelTensile) { FileStream fs = new FileStream(_testpath, FileMode.Create, FileAccess.ReadWrite); utils.AddText(fs, "testType,testSampleNo,S0,lL,lT,εz1,εz2"); utils.AddText(fs, "\r\n"); utils.AddText(fs, "tensile," + modelTensile.testSampleNo + "," + modelTensile.S0 + "," + modelTensile.lL + "," + modelTensile.lT + "," + modelTensile.εz1 + "," + modelTensile.εz2); utils.AddText(fs, "\r\n"); fs.Flush(); fs.Close(); fs.Dispose(); }
private void frmAnalysiseCurve_Load(object sender, EventArgs e) { //m_SR = GetSR((ushort)_fmMain.m_SensorArray[_fmMain.m_LSensorArray[0].SensorIndex].scale); _ResultPanel = this.zedGraphControl.GraphPane; initResultCurve(this.zedGraphControl); this.zedGraphControl.Invalidated += new InvalidateEventHandler(zedGraphControl_Invalidated); this.cmbYr.SelectedIndex = int.Parse(RWconfig.GetAppSettings("ShowY")); this.cmbXr.SelectedIndex = int.Parse(RWconfig.GetAppSettings("ShowX")); this.zedGraphControl.RestoreScale(this.zedGraphControl.GraphPane); m_zedGraphSyb = new Symbol(); m_zedGraphSyb.IsAntiAlias = true; m_zedGraphSyb.Type = SymbolType.Circle; m_zedGraphSyb.Size = 4; m_zedGraphSyb.Border.Width = 2; m_zedGraphSyb.Fill.Color = Color.DarkRed; m_zedGraphSyb.IsVisible = true; if (this._List_Data == null) { MessageBox.Show(this, "曲线数据不存在!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); this.Close(); this.Dispose(); } //将计算后的值呈现在Label上 m_t = new HR_Test.BLL.GBT3354_Samples(); m_m = m_t.GetModel(_TestSampleNo); if (m_m != null) { m_S0 = (double)m_m.S0; m_Ll = (double)m_m.lL; m_Lt = (double)m_m.lT; m_Ez1 = (double)m_m.εz1; m_Ez2 = (double)m_m.εz1; } }
private void gBtnAddTestSample_Click(object sender, EventArgs e) { string strErr = ""; if (this._testNo.Text.Trim().Length == 0) { strErr += "'试验编号'不能为空!\r\n\r\n"; } if (this._testSampleNo.Text.Trim().Length == 0) { strErr += "'试样编号'不能为空!\r\n\r\n"; } if (string.IsNullOrEmpty(this._sendCompany.Text)) { strErr += "'送检单位'不能为空!\r\n\r\n"; } if (this._adhesive.Text.Trim().Length == 0) { strErr += "'胶粘剂信息'不能为空!\r\n\r\n"; } if (this._stuffSpec.Text.Trim().Length == 0) { strErr += "'材料规格'不能为空!\r\n\r\n"; } if (this._strengthPlate.Text.Trim().Length == 0) { strErr += "'加强片信息'不能为空!\r\n\r\n"; } if (string.IsNullOrEmpty(this._temperature.Text)) { strErr += "'试验温度'不能为空!\r\n\r\n"; } if (string.IsNullOrEmpty(this._condition)) { strErr += "'试验条件'不能为空!\r\n\r\n"; } if (string.IsNullOrEmpty(this._controlMode)) { strErr += "'控制方式'不能为空!\r\n\r\n"; } if (this._testMethod.Text.Trim().Length == 0) { strErr += "'试验方法'不能为空!\r\n\r\n"; } if (this._sampleState.Text.Trim().Length == 0) { strErr += "'试样状态'不能为空!\r\n\r\n"; } if (this._getSample.Text.Trim().Length == 0) { strErr += "'试样来源'不能为空!\r\n\r\n"; } if (this._tester.Text.Trim().Length == 0) { strErr += "'试验员'不能为空!\r\n\r\n"; } if (rdoRect.Checked) { if (this._w.Text.Trim().Length == 0) { strErr += "'a0'不能为空!\r\n\r\n"; } if (this._h.Text.Trim().Length == 0) { strErr += "'b0'不能为空!\r\n\r\n"; } } if (rdoCircle.Checked) { if (this._d0.Text.Trim().Length == 0) { strErr += "'d0'不能为空!\r\n\r\n"; } } if (rdoPipe.Checked) { if (this._w.Text.Trim().Length == 0) { strErr += "'a0'不能为空!\r\n\r\n"; } if (this._Do.Text.Trim().Length == 0) { strErr += "'Do'不能为空!\r\n\r\n"; } } if (this._S0.Text.Trim().Length == 0) { strErr += "'S0'不能为空!\r\n\r\n"; } else { if (double.Parse(this._S0.Text.Trim()) == 0d) { strErr += "'S0'不能为0!\r\n\r\n"; } } if (this._lL.Text.Trim().Length == 0) { strErr += "'纵向引伸计标距'不能为空!\r\n\r\n"; } else { if (double.Parse(this._lL.Text.Trim()) == 0d) { strErr += "'纵向引伸计标距'不能为0!\r\n\r\n"; } } if (this._lT.Text.Trim().Length == 0) { strErr += "'横向引伸计标距'不能为空!\r\n\r\n"; } else { if (double.Parse(this._lT.Text.Trim()) == 0d) { strErr += "'横向引伸计标距'不能为0!\r\n\r\n"; } } if (this._εz1.Text.Trim().Length == 0) { strErr += "'纵向应变范围起始值'不能为空!\r\n\r\n"; } else { if (double.Parse(this._εz1.Text.Trim()) == 0d) { strErr += "'纵向应变范围起始值'不能为0!\r\n\r\n"; } } if (this._εz2.Text.Trim().Length == 0) { strErr += "'纵向应变范围终点值'不能为空!\r\n\r\n"; } else { if (double.Parse(this._εz2.Text.Trim()) == 0d) { strErr += "'纵向应变范围终点值'不能为0!\r\n\r\n"; } } if (strErr != "") { MessageBox.Show(this, strErr); return; } string testNo = this._testNo.Text; string testSampleNo = this._testSampleNo.Text; string sendCompany = this._sendCompany.Text; string stuffCardNo = this._adhesive.Text; string stuffSpec = this._stuffSpec.Text; string stuffType = this._strengthPlate.Text; string temperature = this._temperature.Text; string humidity = this._humidity.Text; string testStandard = this._testStandard.Text; string testMethod = this._testMethod.Text; string mathineType = this._mathineType.Text; string getSample = this._getSample.Text; string tester = this._tester.Text; string w = (!string.IsNullOrEmpty(this._w.Text) ? this._w.Text : "0"); string h = (!string.IsNullOrEmpty(this._h.Text) ? this._h.Text : "0"); string d0 = (!string.IsNullOrEmpty(this._d0.Text) ? this._d0.Text : "0"); string Do = (!string.IsNullOrEmpty(this._Do.Text) ? this._Do.Text : "0"); string lL = (!string.IsNullOrEmpty(this._lL.Text) ? this._lL.Text : "0"); string lT = (!string.IsNullOrEmpty(this._lT.Text) ? this._lT.Text : "0"); string S0 = this._S0.Text; double εz1 = double.Parse(this._εz1.Text); double εz2 = double.Parse(this._εz2.Text); Model.GBT3354_Samples model = new Model.GBT3354_Samples(); model.adhesive = _adhesive.Text; model.assessor = "-"; model.controlmode = "-"; model.d0 = double.Parse(d0); model.Do = double.Parse(Do); model.Et = 0; model.failuremode = "-"; model.getSample = getSample; model.h = double.Parse(h); model.humidity = double.Parse(humidity); model.isEffective = false; model.isFinish = false; model.isUseExtensometer1 = true; model.isUseExtensometer2 = true; model.lL = double.Parse(lL); model.lT = double.Parse(lT); model.mathineType = mathineType; model.Pmax = 0; model.reportNo = "-"; model.S0 = double.Parse(S0); if (rdoRect.Checked) { model.sampleShape = "矩形"; } if (rdoCircle.Checked) { model.sampleShape = "圆柱形"; } if (rdoPipe.Checked) { model.sampleShape = "圆管"; } model.sampleState = _sampleState.Text; model.sendCompany = _sendCompany.Text; model.sign = _sign.Text; model.strengthPlate = _strengthPlate.Text; model.stuffSpec = stuffSpec; model.temperature = double.Parse(temperature); model.testDate = this._testDate.Value.Date; model.tester = tester; model.testMethod = testMethod; model.testMethodName = testMethod; model.testNo = testNo; model.testSampleNo = testSampleNo; model.testStandard = testStandard; model.w = double.Parse(w); model.ε1t = 0; model.εz1 = εz1; model.εz2 = εz2; model.μ12 = 0; model.σt = 0; model.testCondition = _condition; model.controlmode = this._controlMode; BLL.GBT3354_Samples bll = new BLL.GBT3354_Samples(); if (bll.GetList("testSampleNo ='" + this._testSampleNo.Text + "'").Tables[0].Rows.Count == 0) { bll.Add(model); this._testSampleNo.Items.Remove(this._testSampleNo.SelectedItem); MessageBox.Show(this, "添加试样信息成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show(this, "已经存在相同的编号,请重新设置!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Warning); return; } }