コード例 #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(STBC.Model.ST_MEASURE model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update ST_MEASURE set ");
            strSql.Append("NAME=:NAME");
            strSql.Append(" where ID=:ID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":NAME", OracleDbType.Varchar2, 100),
                new OracleParameter(":ID",   OracleDbType.Int32, 3)
            };
            parameters[0].Value = model.NAME;
            parameters[1].Value = model.ID;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #2
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public bool Add(STBC.Model.ST_MEASURE model)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into ST_MEASURE(");
            strSql.Append("ID,NAME)");
            strSql.Append(" values (");
            strSql.Append(":ID,:NAME)");
            OracleParameter[] parameters =
            {
                new OracleParameter(":ID",   OracleDbType.Int32,    3),
                new OracleParameter(":NAME", OracleDbType.Varchar2, 100)
            };
            parameters[0].Value = model.ID;
            parameters[1].Value = model.NAME;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
コード例 #3
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public STBC.Model.ST_MEASURE DataRowToModel(DataRow row)
 {
     STBC.Model.ST_MEASURE model = new STBC.Model.ST_MEASURE();
     if (row != null)
     {
         if (row["ID"] != null && row["ID"].ToString() != "")
         {
             model.ID = decimal.Parse(row["ID"].ToString());
         }
         if (row["NAME"] != null)
         {
             model.NAME = row["NAME"].ToString();
         }
     }
     return(model);
 }
コード例 #4
0
ファイル: ST_MEASURE.cs プロジェクト: coasline/STBC
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public STBC.Model.ST_MEASURE DataRowToModel(DataRow row)
 {
     STBC.Model.ST_MEASURE model=new STBC.Model.ST_MEASURE();
     if (row != null)
     {
         if(row["ID"]!=null && row["ID"].ToString()!="")
         {
             model.ID=decimal.Parse(row["ID"].ToString());
         }
         if(row["NAME"]!=null)
         {
             model.NAME=row["NAME"].ToString();
         }
     }
     return model;
 }
コード例 #5
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public STBC.Model.ST_MEASURE GetModel(decimal ID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select ID,NAME from ST_MEASURE ");
            strSql.Append(" where ID=:ID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":ID", OracleDbType.Int32, 22)
            };
            parameters[0].Value = ID;

            STBC.Model.ST_MEASURE model = new STBC.Model.ST_MEASURE();
            DataSet ds = DbHelperOra.Query(strSql.ToString(), parameters);

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
コード例 #6
0
ファイル: ST_MEASURE.cs プロジェクト: coasline/STBC
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public STBC.Model.ST_MEASURE GetModel(decimal ID)
        {
            StringBuilder strSql=new StringBuilder();
            strSql.Append("select ID,NAME from ST_MEASURE ");
            strSql.Append(" where ID=:ID ");
            OracleParameter[] parameters = {
                    new OracleParameter(":ID", OracleDbType.Int32,22)			};
            parameters[0].Value = ID;

            STBC.Model.ST_MEASURE model=new STBC.Model.ST_MEASURE();
            DataSet ds=DbHelperOra.Query(strSql.ToString(),parameters);
            if(ds.Tables[0].Rows.Count>0)
            {
                return DataRowToModel(ds.Tables[0].Rows[0]);
            }
            else
            {
                return null;
            }
        }