Exemple #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(HR_Test.Model.GBT236152009_SelHeng model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tb_GBT236152009_SelHeng set ");
            strSql.Append("methodName=@methodName,");
            strSql.Append("Fmax=@Fmax,");
            strSql.Append("T1=@T1,");
            strSql.Append("T1_=@T1_,");
            strSql.Append("S=@S,");
            strSql.Append("T1c=@T1c,");
            strSql.Append("isSaveCurve=@isSaveCurve");
            strSql.Append(" where ID=@ID");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@methodName",  OleDbType.VarChar, 255),
                new OleDbParameter("@Fmax",        OleDbType.Boolean,   1),
                new OleDbParameter("@T1",          OleDbType.Boolean,   1),
                new OleDbParameter("@T1_",         OleDbType.Boolean,   1),
                new OleDbParameter("@S",           OleDbType.Boolean,   1),
                new OleDbParameter("@T1c",         OleDbType.Boolean,   1),
                new OleDbParameter("@isSaveCurve", OleDbType.Boolean,   1),
                new OleDbParameter("@ID",          OleDbType.Integer, 4)
            };
            parameters[0].Value = model.methodName;
            parameters[1].Value = model.Fmax;
            parameters[2].Value = model.T1;
            parameters[3].Value = model.T1_;
            parameters[4].Value = model.S;
            parameters[5].Value = model.T1c;
            parameters[6].Value = model.isSaveCurve;
            parameters[7].Value = model.ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(HR_Test.Model.GBT236152009_SelHeng model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tb_GBT236152009_SelHeng(");
            strSql.Append("methodName,Fmax,T1,T1_,S,T1c,isSaveCurve)");
            strSql.Append(" values (");
            strSql.Append("@methodName,@Fmax,@T1,@T1_,@S,@T1c,@isSaveCurve)");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@methodName",  OleDbType.VarChar, 255),
                new OleDbParameter("@Fmax",        OleDbType.Boolean,   1),
                new OleDbParameter("@T1",          OleDbType.Boolean,   1),
                new OleDbParameter("@T1_",         OleDbType.Boolean,   1),
                new OleDbParameter("@S",           OleDbType.Boolean,   1),
                new OleDbParameter("@T1c",         OleDbType.Boolean,   1),
                new OleDbParameter("@isSaveCurve", OleDbType.Boolean, 1)
            };
            parameters[0].Value = model.methodName;
            parameters[1].Value = model.Fmax;
            parameters[2].Value = model.T1;
            parameters[3].Value = model.T1_;
            parameters[4].Value = model.S;
            parameters[5].Value = model.T1c;
            parameters[6].Value = model.isSaveCurve;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public HR_Test.Model.GBT236152009_SelHeng GetModel(string methodName)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,methodName,Fmax,T1,T1_,S,T1c,isSaveCurve from tb_GBT236152009_SelHeng ");
            strSql.Append(" where methodName=@methodName");
            OleDbParameter[] parameters =
            {
                new OleDbParameter("@methodName", OleDbType.VarChar)
            };
            parameters[0].Value = methodName;

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
Exemple #4
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public HR_Test.Model.GBT236152009_SelHeng DataRowToModel(DataRow row)
 {
     HR_Test.Model.GBT236152009_SelHeng model = new HR_Test.Model.GBT236152009_SelHeng();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = int.Parse(row["ID"].ToString());
         }
         if (row["methodName"] != null)
         {
             model.methodName = row["methodName"].ToString();
         }
         if (row["Fmax"] != null && row["Fmax"].ToString() != "")
         {
             if ((row["Fmax"].ToString() == "1") || (row["Fmax"].ToString().ToLower() == "true"))
             {
                 model.Fmax = true;
             }
             else
             {
                 model.Fmax = false;
             }
         }
         if (row["T1"] != null && row["T1"].ToString() != "")
         {
             if ((row["T1"].ToString() == "1") || (row["T1"].ToString().ToLower() == "true"))
             {
                 model.T1 = true;
             }
             else
             {
                 model.T1 = false;
             }
         }
         if (row["T1_"] != null && row["T1_"].ToString() != "")
         {
             if ((row["T1_"].ToString() == "1") || (row["T1_"].ToString().ToLower() == "true"))
             {
                 model.T1_ = true;
             }
             else
             {
                 model.T1_ = false;
             }
         }
         if (row["S"] != null && row["S"].ToString() != "")
         {
             if ((row["S"].ToString() == "1") || (row["S"].ToString().ToLower() == "true"))
             {
                 model.S = true;
             }
             else
             {
                 model.S = false;
             }
         }
         if (row["T1c"] != null && row["T1c"].ToString() != "")
         {
             if ((row["T1c"].ToString() == "1") || (row["T1c"].ToString().ToLower() == "true"))
             {
                 model.T1c = true;
             }
             else
             {
                 model.T1c = false;
             }
         }
         if (row["isSaveCurve"] != null && row["isSaveCurve"].ToString() != "")
         {
             if ((row["isSaveCurve"].ToString() == "1") || (row["isSaveCurve"].ToString().ToLower() == "true"))
             {
                 model.isSaveCurve = true;
             }
             else
             {
                 model.isSaveCurve = false;
             }
         }
     }
     return(model);
 }