コード例 #1
0
        private void gBtnAddToMethod1_Click(object sender, EventArgs e)
        {
            string strErr = "";

            if (string.IsNullOrEmpty(this._sendCompany))
            {
                strErr += "送检单位不能为空!\r\n\r\n";
            }
            if (this._stuffCardNo.Text.Trim().Length == 0)
            {
                strErr += "材料牌号不能为空!\r\n\r\n";
            }
            if (this._stuffSpec.Text.Trim().Length == 0)
            {
                strErr += "材料规格不能为空!\r\n\r\n";
            }
            if (this._stuffType.Text.Trim().Length == 0)
            {
                strErr += "试样类型不能为空!\r\n\r\n";
            }

            if (string.IsNullOrEmpty(this._temperature))
            {
                strErr += "试验温度不能为空!\r\n\r\n";
            }

            if (this._testMethod.Text.Trim().Length == 0)
            {
                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 (string.IsNullOrEmpty(this._sampleCharacter))
            {
                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 (strErr != "")
            {
                MessageBox.Show(this, strErr);
                return;
            }

            string testNo          = this._testNo.Text;
            string testSampleNo    = this._testSampleNo.Text;
            string sendCompany     = this._sendCompany;
            string stuffCardNo     = this._stuffCardNo.Text;
            string stuffSpec       = this._stuffSpec.Text;
            string stuffType       = this._stuffType.Text;
            string hotStatus       = this._hotStatus;
            string temperature     = this._temperature;
            string humidity        = this._humidity;
            string testStandard    = this._testStandard.Text;
            string testMethod      = this._testMethod.Text;
            string mathineType     = this._mathineType.Text;
            string sampleCharacter = this._sampleCharacter;
            string getSample       = this._getSample.Text;
            string tester          = this._tester.Text;

            BLL.GBT236152009_Method   bllcm = new HR_Test.BLL.GBT236152009_Method();
            Model.GBT236152009_Method model = bllcm.GetModel(this._testMethod.Text);

            model.sendCompany     = sendCompany;
            model.stuffCardNo     = stuffCardNo;
            model.stuffSpec       = stuffSpec;
            model.stuffType       = stuffType;
            model.hotStatus       = hotStatus;
            model.temperature     = double.Parse(this._temperature);
            model.humidity        = double.Parse(this._humidity);
            model.testStandard    = testStandard;
            model.testMethod      = testMethod;
            model.mathineType     = mathineType;
            model.testCondition   = "-";
            model.sampleCharacter = sampleCharacter;
            model.getSample       = getSample;
            model.tester          = tester;
            model.condition       = this._condition;
            model.controlmode     = this._controlMode;
            model.assessor        = "-";
            model.sign            = this._sign.Text;

            if (bllcm.Update(model))
            {
                MessageBox.Show(this, "更新成功!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }