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

            strSql.Append("update INVENTORS set ");
            strSql.Append("INVENTOR=:INVENTOR,");
            strSql.Append("INVENTOR_CH=:INVENTOR_CH,");
            strSql.Append("APPL_CODE1=:APPL_CODE1,");
            strSql.Append("PREFERRED=:PREFERRED");
            strSql.Append(" where ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":INVENTOR",    OracleType.VarChar, 100),
                new OracleParameter(":INVENTOR_CH", OracleType.VarChar, 150),
                new OracleParameter(":APPL_CODE1",  OracleType.Char,      4),
                new OracleParameter(":PREFERRED",   OracleType.Char, 1)
            };
            parameters[0].Value = model.INVENTOR;
            parameters[1].Value = model.INVENTOR_CH;
            parameters[2].Value = model.APPL_CODE1;
            parameters[3].Value = model.PREFERRED;

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

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

            strSql.Append("insert into INVENTORS(");
            strSql.Append("INVENTOR,INVENTOR_CH,APPL_CODE1,PREFERRED)");
            strSql.Append(" values (");
            strSql.Append(":INVENTOR,:INVENTOR_CH,:APPL_CODE1,:PREFERRED)");
            OracleParameter[] parameters =
            {
                new OracleParameter(":INVENTOR",    OracleType.VarChar, 100),
                new OracleParameter(":INVENTOR_CH", OracleType.VarChar, 150),
                new OracleParameter(":APPL_CODE1",  OracleType.Char,      4),
                new OracleParameter(":PREFERRED",   OracleType.Char, 1)
            };
            parameters[0].Value = model.INVENTOR;
            parameters[1].Value = model.INVENTOR_CH;
            parameters[2].Value = model.APPL_CODE1;
            parameters[3].Value = model.PREFERRED;

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

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
예제 #3
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Model.INVENTORS GetModel()
        {
            //该表无主键信息,请自定义主键/条件字段
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select INVENTOR,INVENTOR_CH,APPL_CODE1,PREFERRED from INVENTORS ");
            strSql.Append(" where ");
            OracleParameter[] parameters =
            {
            };

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

            if (ds.Tables[0].Rows.Count > 0)
            {
                return(DataRowToModel(ds.Tables[0].Rows[0]));
            }
            else
            {
                return(null);
            }
        }
예제 #4
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 public Model.INVENTORS DataRowToModel(DataRow row)
 {
     Model.INVENTORS model = new Model.INVENTORS();
     if (row != null)
     {
         if (row["INVENTOR"] != null)
         {
             model.INVENTOR = row["INVENTOR"].ToString();
         }
         if (row["INVENTOR_CH"] != null)
         {
             model.INVENTOR_CH = row["INVENTOR_CH"].ToString();
         }
         if (row["APPL_CODE1"] != null)
         {
             model.APPL_CODE1 = row["APPL_CODE1"].ToString();
         }
         if (row["PREFERRED"] != null)
         {
             model.PREFERRED = row["PREFERRED"].ToString();
         }
     }
     return(model);
 }
예제 #5
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Model.INVENTORS model)
 {
     return(dal.Update(model));
 }
예제 #6
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public bool Add(Model.INVENTORS model)
 {
     return(dal.Add(model));
 }