Exemple #1
0
        /// <summary>
        /// 更新一条数据
        /// </summary>
        public bool Update(Entity.BASE_PATROL_GOODS entity)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update BASE_PATROL_GOODS set ");

            strSql.Append(" PATROLGOODSID = :PATROLGOODSID , ");
            strSql.Append(" PATROLID = :PATROLID , ");
            strSql.Append(" AMOUNT = :AMOUNT , ");
            strSql.Append(" TOOLNAME = :TOOLNAME  ");
            strSql.Append(" where PATROLGOODSID=:PATROLGOODSID  ");

            OracleParameter[] parameters =
            {
                new OracleParameter(":PATROLGOODSID", OracleType.Number,  4),
                new OracleParameter(":PATROLID",      OracleType.Number,  4),
                new OracleParameter(":AMOUNT",        OracleType.Number,  4),
                new OracleParameter(":TOOLNAME",      OracleType.VarChar, 50)
            };

            parameters[4].Value = entity.PATROLGOODSID;
            parameters[5].Value = entity.PATROLID;
            parameters[6].Value = entity.AMOUNT;
            parameters[7].Value = entity.TOOLNAME;
            int rows = OracleHelper.ExecuteNonQuery(strSql.ToString(), parameters);

            if (rows > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #2
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Entity.BASE_PATROL_GOODS GetEntity(decimal PATROLGOODSID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("select PATROLGOODSID, PATROLID, AMOUNT, TOOLNAME  ");
            strSql.Append("  from BASE_PATROL_GOODS ");
            strSql.Append(" where PATROLGOODSID=:PATROLGOODSID ");
            OracleParameter[] parameters =
            {
                new OracleParameter(":PATROLGOODSID", OracleType.Number, 4)
            };
            parameters[0].Value = PATROLGOODSID;


            Entity.BASE_PATROL_GOODS entity = new Entity.BASE_PATROL_GOODS();
            DataTable dt = OracleHelper.Query(CommandType.Text, strSql.ToString(), parameters);

            if (dt.Rows.Count > 0)
            {
                if (dt.Rows[0]["PATROLGOODSID"].ToString() != "")
                {
                    entity.PATROLGOODSID = decimal.Parse(dt.Rows[0]["PATROLGOODSID"].ToString());
                }
                if (dt.Rows[0]["PATROLID"].ToString() != "")
                {
                    entity.PATROLID = decimal.Parse(dt.Rows[0]["PATROLID"].ToString());
                }
                if (dt.Rows[0]["AMOUNT"].ToString() != "")
                {
                    entity.AMOUNT = decimal.Parse(dt.Rows[0]["AMOUNT"].ToString());
                }
                entity.TOOLNAME = dt.Rows[0]["TOOLNAME"].ToString();

                return(entity);
            }
            else
            {
                return(null);
            }
        }
Exemple #3
0
        /// <summary>
        /// 增加一条数据
        /// </summary>
        public void Add(Entity.BASE_PATROL_GOODS entity)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into BASE_PATROL_GOODS(");
            strSql.Append("PATROLGOODSID,PATROLID,AMOUNT,TOOLNAME");
            strSql.Append(") values (");
            strSql.Append(":PATROLGOODSID,:PATROLID,:AMOUNT,:TOOLNAME");
            strSql.Append(") ");

            OracleParameter[] parameters =
            {
                new OracleParameter(":PATROLGOODSID", OracleType.Number,  4),
                new OracleParameter(":PATROLID",      OracleType.Number,  4),
                new OracleParameter(":AMOUNT",        OracleType.Number,  4),
                new OracleParameter(":TOOLNAME",      OracleType.VarChar, 50)
            };

            parameters[0].Value = entity.PATROLGOODSID;
            parameters[1].Value = entity.PATROLID;
            parameters[2].Value = entity.AMOUNT;
            parameters[3].Value = entity.TOOLNAME;
            OracleHelper.ExecuteNonQuery(strSql.ToString(), parameters);
        }