示例#1
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public HR_Test.Model.GBT236152009_TensileHeng GetModel(int ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,testMethodName,testNo,testSampleNo,reportNo,sendCompany,stuffCardNo,stuffSpec,stuffType,hotStatus,temperature,humidity,testStandard,testMethod,mathineType,testCondition,sampleCharacter,getSample,tester,assessor,sign,testType,L,t,S0,Fmax,T1,isFinish,testDate,condition,controlmode,isUseExtensometer,isEffective from tb_GBT236152009_TensileHeng ");
            strSql.Append(" where ID=@ID");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@ID", OleDbType.Integer, 4)
            };
            parameters[0].Value = ID;

            HR_Test.Model.GBT236152009_TensileHeng model = new HR_Test.Model.GBT236152009_TensileHeng();
            DataSet ds = DbHelperOleDb.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
示例#2
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public HR_Test.Model.GBT236152009_TensileHeng DataRowToModel(DataRow row)
 {
     HR_Test.Model.GBT236152009_TensileHeng model = new HR_Test.Model.GBT236152009_TensileHeng();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = int.Parse(row["ID"].ToString());
         }
         if (row["testMethodName"] != null)
         {
             model.testMethodName = row["testMethodName"].ToString();
         }
         if (row["testNo"] != null)
         {
             model.testNo = row["testNo"].ToString();
         }
         if (row["testSampleNo"] != null)
         {
             model.testSampleNo = row["testSampleNo"].ToString();
         }
         if (row["reportNo"] != null)
         {
             model.reportNo = row["reportNo"].ToString();
         }
         if (row["sendCompany"] != null)
         {
             model.sendCompany = row["sendCompany"].ToString();
         }
         if (row["stuffCardNo"] != null)
         {
             model.stuffCardNo = row["stuffCardNo"].ToString();
         }
         if (row["stuffSpec"] != null)
         {
             model.stuffSpec = row["stuffSpec"].ToString();
         }
         if (row["stuffType"] != null)
         {
             model.stuffType = row["stuffType"].ToString();
         }
         if (row["hotStatus"] != null)
         {
             model.hotStatus = row["hotStatus"].ToString();
         }
         model.temperature = Convert.ToDouble(row["temperature"].ToString());
         model.humidity    = Convert.ToDouble(row["humidity"].ToString());
         if (row["testStandard"] != null)
         {
             model.testStandard = row["testStandard"].ToString();
         }
         if (row["testMethod"] != null)
         {
             model.testMethod = row["testMethod"].ToString();
         }
         if (row["mathineType"] != null)
         {
             model.mathineType = row["mathineType"].ToString();
         }
         if (row["testCondition"] != null)
         {
             model.testCondition = row["testCondition"].ToString();
         }
         if (row["sampleCharacter"] != null)
         {
             model.sampleCharacter = row["sampleCharacter"].ToString();
         }
         if (row["getSample"] != null)
         {
             model.getSample = row["getSample"].ToString();
         }
         if (row["tester"] != null)
         {
             model.tester = row["tester"].ToString();
         }
         if (row["assessor"] != null)
         {
             model.assessor = row["assessor"].ToString();
         }
         if (row["sign"] != null)
         {
             model.sign = row["sign"].ToString();
         }
         if (row["testType"] != null)
         {
             model.testType = row["testType"].ToString();
         }
         model.L    = Convert.ToDouble(row["L"].ToString());
         model.t    = Convert.ToDouble(row["t"].ToString());
         model.S0   = Convert.ToDouble(row["S0"].ToString());
         model.Fmax = Convert.ToDouble(row["Fmax"].ToString());
         model.T1   = Convert.ToDouble(row["T1"].ToString());
         if (row["isFinish"] != null && row["isFinish"].ToString() != "")
         {
             if ((row["isFinish"].ToString() == "1") || (row["isFinish"].ToString().ToLower() == "true"))
             {
                 model.isFinish = true;
             }
             else
             {
                 model.isFinish = false;
             }
         }
         if (row["testDate"] != null && row["testDate"].ToString() != "")
         {
             model.testDate = DateTime.Parse(row["testDate"].ToString());
         }
         if (row["condition"] != null)
         {
             model.condition = row["condition"].ToString();
         }
         if (row["controlmode"] != null)
         {
             model.controlmode = row["controlmode"].ToString();
         }
         if (row["isUseExtensometer"] != null && row["isUseExtensometer"].ToString() != "")
         {
             if ((row["isUseExtensometer"].ToString() == "1") || (row["isUseExtensometer"].ToString().ToLower() == "true"))
             {
                 model.isUseExtensometer = true;
             }
             else
             {
                 model.isUseExtensometer = false;
             }
         }
         if (row["isEffective"] != null && row["isEffective"].ToString() != "")
         {
             if ((row["isEffective"].ToString() == "1") || (row["isEffective"].ToString().ToLower() == "true"))
             {
                 model.isEffective = true;
             }
             else
             {
                 model.isEffective = false;
             }
         }
     }
     return(model);
 }
示例#3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(HR_Test.Model.GBT236152009_TensileHeng model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tb_GBT236152009_TensileHeng(");
            strSql.Append("testMethodName,testNo,testSampleNo,reportNo,sendCompany,stuffCardNo,stuffSpec,stuffType,hotStatus,temperature,humidity,testStandard,testMethod,mathineType,testCondition,sampleCharacter,getSample,tester,assessor,sign,testType,L,t,S0,Fmax,T1,isFinish,testDate,condition,controlmode,isUseExtensometer,isEffective)");
            strSql.Append(" values (");
            strSql.Append("@testMethodName,@testNo,@testSampleNo,@reportNo,@sendCompany,@stuffCardNo,@stuffSpec,@stuffType,@hotStatus,@temperature,@humidity,@testStandard,@testMethod,@mathineType,@testCondition,@sampleCharacter,@getSample,@tester,@assessor,@sign,@testType,@L,@t,@S0,@Fmax,@T1,@isFinish,@testDate,@condition,@controlmode,@isUseExtensometer,@isEffective)");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@testMethodName",    OleDbType.VarChar, 100),
                new OleDbParameter("@testNo",            OleDbType.VarChar, 100),
                new OleDbParameter("@testSampleNo",      OleDbType.VarChar, 100),
                new OleDbParameter("@reportNo",          OleDbType.VarChar, 100),
                new OleDbParameter("@sendCompany",       OleDbType.VarChar, 100),
                new OleDbParameter("@stuffCardNo",       OleDbType.VarChar, 100),
                new OleDbParameter("@stuffSpec",         OleDbType.VarChar, 100),
                new OleDbParameter("@stuffType",         OleDbType.VarChar, 100),
                new OleDbParameter("@hotStatus",         OleDbType.VarChar, 100),
                new OleDbParameter("@temperature",       OleDbType.Double),
                new OleDbParameter("@humidity",          OleDbType.Double),
                new OleDbParameter("@testStandard",      OleDbType.VarChar, 100),
                new OleDbParameter("@testMethod",        OleDbType.VarChar, 100),
                new OleDbParameter("@mathineType",       OleDbType.VarChar, 100),
                new OleDbParameter("@testCondition",     OleDbType.VarChar, 100),
                new OleDbParameter("@sampleCharacter",   OleDbType.VarChar, 100),
                new OleDbParameter("@getSample",         OleDbType.VarChar, 100),
                new OleDbParameter("@tester",            OleDbType.VarChar, 100),
                new OleDbParameter("@assessor",          OleDbType.VarChar, 100),
                new OleDbParameter("@sign",              OleDbType.VarChar, 255),
                new OleDbParameter("@testType",          OleDbType.VarChar, 255),
                new OleDbParameter("@L",                 OleDbType.Double),
                new OleDbParameter("@t",                 OleDbType.Double),
                new OleDbParameter("@S0",                OleDbType.Double),
                new OleDbParameter("@Fmax",              OleDbType.Double),
                new OleDbParameter("@T1",                OleDbType.Double),
                new OleDbParameter("@isFinish",          OleDbType.Boolean,   1),
                new OleDbParameter("@testDate",          OleDbType.Date),
                new OleDbParameter("@condition",         OleDbType.VarChar, 255),
                new OleDbParameter("@controlmode",       OleDbType.VarChar, 255),
                new OleDbParameter("@isUseExtensometer", OleDbType.Boolean,   1),
                new OleDbParameter("@isEffective",       OleDbType.Boolean, 1)
            };
            parameters[0].Value  = model.testMethodName;
            parameters[1].Value  = model.testNo;
            parameters[2].Value  = model.testSampleNo;
            parameters[3].Value  = model.reportNo;
            parameters[4].Value  = model.sendCompany;
            parameters[5].Value  = model.stuffCardNo;
            parameters[6].Value  = model.stuffSpec;
            parameters[7].Value  = model.stuffType;
            parameters[8].Value  = model.hotStatus;
            parameters[9].Value  = model.temperature;
            parameters[10].Value = model.humidity;
            parameters[11].Value = model.testStandard;
            parameters[12].Value = model.testMethod;
            parameters[13].Value = model.mathineType;
            parameters[14].Value = model.testCondition;
            parameters[15].Value = model.sampleCharacter;
            parameters[16].Value = model.getSample;
            parameters[17].Value = model.tester;
            parameters[18].Value = model.assessor;
            parameters[19].Value = model.sign;
            parameters[20].Value = model.testType;
            parameters[21].Value = model.L;
            parameters[22].Value = model.t;
            parameters[23].Value = model.S0;
            parameters[24].Value = model.Fmax;
            parameters[25].Value = model.T1;
            parameters[26].Value = model.isFinish;
            parameters[27].Value = model.testDate;
            parameters[28].Value = model.condition;
            parameters[29].Value = model.controlmode;
            parameters[30].Value = model.isUseExtensometer;
            parameters[31].Value = model.isEffective;

            int rows = DbHelperOleDb.ExecuteSql(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#4
0
        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))
            {
                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 (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 (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 (this._L.Text.Trim().Length == 0)
            {
                strErr += "'L'不能为空!\r\n\r\n";
            }
            else
            {
                if (double.Parse(this._L.Text.Trim()) == 0d)
                {
                    strErr += "'L'不能为0!\r\n\r\n";
                }
            }

            if (this._t.Text.Trim().Length == 0)
            {
                strErr += "'t'不能为空!\r\n\r\n";
            }
            else
            {
                if (double.Parse(this._t.Text.Trim()) == 0d)
                {
                    strErr += "'t'不能为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;
            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;
            double l = Convert.ToDouble(!string.IsNullOrEmpty(this._L.Text)?this._L.Text:"0");
            double t = Convert.ToDouble(!string.IsNullOrEmpty(this._t.Text)?this._t.Text:"0");

            Model.GBT236152009_TensileHeng model = new HR_Test.Model.GBT236152009_TensileHeng();
            model.testMethodName  = this._testMethod.Text;
            model.testNo          = testNo;
            model.testSampleNo    = testSampleNo;
            model.reportNo        = "-";
            model.sendCompany     = sendCompany;
            model.stuffCardNo     = stuffCardNo;
            model.stuffSpec       = stuffSpec;
            model.stuffType       = stuffType;
            model.hotStatus       = hotStatus;
            model.temperature     = double.Parse(this._temperature);
            model.humidity        = 0;
            model.testStandard    = testStandard;
            model.testMethod      = testMethod;
            model.mathineType     = mathineType;
            model.testCondition   = "-";
            model.sampleCharacter = sampleCharacter;
            model.getSample       = getSample;
            model.tester          = tester;
            model.assessor        = "-";
            model.L           = l;
            model.t           = t;
            model.S0          = Math.Round(l * t, 4);
            model.Fmax        = 0;
            model.T1          = 0;
            model.sign        = this._sign.Text;
            model.testType    = this._testType.Text;
            model.isFinish    = false;
            model.isEffective = false;
            //是否使用引申计根据试验方法确定
            model.isUseExtensometer = false;
            model.testDate          = this._testDate.Value.Date;
            model.condition         = this._condition;
            model.controlmode       = this._controlMode;
            BLL.GBT236152009_TensileHeng bll = new BLL.GBT236152009_TensileHeng();
            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;
            }
        }