Exemplo n.º 1
0
        private void gBtnAddC_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (this.c_testNo.Text.Trim().Length == 0)
            {
                strErr += "试验编号不能为空!\r\n\r\n";
            }
            if (this.c_testSampleNo.Text.Trim().Length == 0)
            {
                strErr += "试样编号不能为空!\r\n\r\n";
            }

            if (this._sendCompany.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._condition.Trim().Length == 0)
            {
                strErr += "试验条件不能为空!\r\n\r\n";
            }

            if (this._controlMode.Trim().Length == 0)
            {
                strErr += "控制方式不能为空!\r\n\r\n";
            }

            if (this._testStandard_C.Text.Trim().Length == 0)
            {
                strErr += "试验标准不能为空!\r\n\r\n";
            }

            if (this._sampleCharacter.Trim().Length == 0)
            {
                strErr += "试样标识不能为空!\r\n\r\n";
            }
            if (this.c_getSample.Text.Trim().Length == 0)
            {
                strErr += "试样取样不能为空!\r\n\r\n";
            }
            if (this.c_tester.Text.Trim().Length == 0)
            {
                strErr += "试验员不能为空!\r\n\r\n";
            }

            if (rBtnRect.Checked)
            {
                if (this.c_a.Text.Trim().Length == 0)
                {
                    strErr += "a不能为空!\r\n\r\n";
                }
                if (this.c_b.Text.Trim().Length == 0)
                {
                    strErr += "b不能为空!\r\n\r\n";
                }
            }

            if (rBtnCircle.Checked)
            {
                if (this.c_d.Text.Trim().Length == 0)
                {
                    strErr += "d不能为空!\r\n\r\n";
                }
            }

            if (this.c_S0.Text.Trim().Length == 0)
            {
                strErr += "S0不能为空!\r\n\r\n";
            }
            else
            {
                if (double.Parse(this.c_S0.Text.Trim()) == 0d)
                {
                    strErr += "S0不能为0!\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 (this.Epc.Text.Trim().Length == 0)
            {
                strErr += "εpc 不能为空!\r\n\r\n";
            }
            else
            {
                if (double.Parse(this.Epc.Text.Trim()) == 0d)
                {
                    strErr += " εpc 不能为0!\r\n\r\n";
                }
            }

            if (this.Etc.Text.Trim().Length == 0)
            {
                strErr += "εtc 不能为空!\r\n\r\n";
            }
            else
            {
                if (double.Parse(this.Etc.Text.Trim()) == 0d)
                {
                    strErr += " εtc 不能为0!\r\n\r\n";
                }
            }

            if (this.txtn.Text.Trim().Length == 0)
            {
                strErr += "变形放大倍数 n 不能为空!\r\n\r\n";
            }
            else
            {
                if (double.Parse(this.txtn.Text.Trim()) == 0d)
                {
                    strErr += " 变形放大倍数 n 不能为0!\r\n\r\n";
                }
            }

            if (this.c_L.Text.Trim().Length == 0)
            {
                strErr += " L不能为空!\r\n\r\n";
            }


            if (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }

            HR_Test.Model.Compress model = new HR_Test.Model.Compress();
            model.testMethodName = this.c_testMethod.Text;
            model.testNo         = this.c_testNo.Text;
            model.testSampleNo   = this.c_testSampleNo.Text;
            model.reportNo       = "-";

            model.sendCompany     = this._sampleCharacter;
            model.temperature     = double.Parse(this._temperature);
            model.humidity        = double.Parse(this._humidity);
            model.testStandard    = this._testStandard_C.Text;
            model.sampleCharacter = this._sampleCharacter;
            model.hotStatus       = this._hotStatus;
            model.condition       = this._condition;
            model.controlMode     = this._controlMode;


            model.stuffCardNo   = this.c_stuffCardNo.Text;
            model.stuffSpec     = c_stuffSpec.Text;
            model.stuffType     = c_stuffType.Text;
            model.testMethod    = c_testMethod.Text;
            model.mathineType   = c_mathineType.Text;
            model.testCondition = "-";

            model.getSample = c_getSample.Text;
            model.tester    = c_tester.Text;
            model.assessor  = "-";
            model.sign      = this.c_sign.Text;

            model.a           = Convert.ToDouble(!string.IsNullOrEmpty(this.c_a.Text) ? this.c_a.Text : "0");
            model.b           = Convert.ToDouble(!string.IsNullOrEmpty(this.c_b.Text) ? this.c_b.Text : "0");
            model.d           = Convert.ToDouble(!string.IsNullOrEmpty(this.c_d.Text) ? this.c_d.Text : "0");
            model.L           = Convert.ToDouble(!string.IsNullOrEmpty(this.c_L.Text) ? this.c_L.Text : "0");
            model.L0          = Convert.ToDouble(!string.IsNullOrEmpty(this.c_L0.Text) ? this.c_L0.Text : "0");
            model.H           = Convert.ToDouble(!string.IsNullOrEmpty(this.c_HH.Text) ? this.c_HH.Text : "0");
            model.hh          = Convert.ToDouble(!string.IsNullOrEmpty(this.c_h.Text) ? this.c_h.Text : "0");
            model.S0          = Convert.ToDouble(!string.IsNullOrEmpty(this.c_S0.Text) ? this.c_S0.Text : "0");
            model.Ff          = Convert.ToDouble(!string.IsNullOrEmpty(this.c_Ff.Text) ? this.c_Ff.Text : "0");
            model.εpc         = Convert.ToDouble(!string.IsNullOrEmpty(this.Epc.Text) ? this.Epc.Text : "0");
            model.εtc         = Convert.ToDouble(!string.IsNullOrEmpty(this.Etc.Text) ? this.Etc.Text : "0");
            model.n           = Convert.ToDouble(!string.IsNullOrEmpty(this.txtn.Text) ? this.txtn.Text : "1");
            model.deltaL      = 0;
            model.F0          = 0;
            model.Fpc         = 0;
            model.Ftc         = 0;
            model.FeHc        = 0;
            model.FeLc        = 0;
            model.Fmc         = 0;
            model.Rpc         = 0;
            model.Rtc         = 0;
            model.ReHc        = 0;
            model.ReLc        = 0;
            model.Rmc         = 0;
            model.Ec          = 0;
            model.Avera       = 0;
            model.Avera1      = 0;
            model.isFinish    = false;
            model.isEffective = false;
            model.testDate    = this.c_testDate.Value.Date;
            BLL.Compress bllc = new HR_Test.BLL.Compress();
            if (bllc.GetList("testSampleNo ='" + this.c_testSampleNo.Text + "'").Tables[0].Rows.Count == 0)
            {
                if (bllc.Add(model))
                {
                    this.c_testSampleNo.Items.Remove(this.c_testSampleNo.SelectedItem);
                    //this.c_a.Text = "";
                    //this.c_b.Text = "";
                    //this.c_d.Text = "";
                    //this.c_S0.Text = "";
                    MessageBox.Show("添加压缩试样信息成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                else
                {
                    MessageBox.Show("添加压缩试样信息失败!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            else
            {
                MessageBox.Show("已经存在相同的编号,请重新设置!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }
            //TestStandard.MethodControl.ReadMethod(this.treeviewTestMethod);
        }