示例#1
0
        public bool EditGoods(AgentGoodsEntity goods)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tbAGoods set");
            strSql.Append("goods_id=@GoodsId,status_id=@StatusID,price=@Price,up_time=@UPTime,agent_AN=@AgentAccountName");
            strSql.Append("where id = @AgentGoodsID");
            SqlParameter[] paras =
            {
                new SqlParameter("@GoodsId",          goods.GoodsID),
                new SqlParameter("@StatusID",         goods.StatusID),
                new SqlParameter("@Price",            goods.Price),
                new SqlParameter("@UPTime",           goods.UPTime),
                new SqlParameter("@AgentAccountName", goods.AgentAccountName),
                new SqlParameter("@AgentGoodsID",     goods.AgentGoodsID)
            };
            object obj = SqlHelper.ExecuteNonQuery(SqlHelper.connStr, CommandType.Text, strSql.ToString(), paras);

            if (Convert.ToInt32(obj) > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
示例#2
0
        public int AddGoods(AgentGoodsEntity goods)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("insert into tbAGoods (goods_id,status_id,price,up_time,agent_AN)");
            strSql.Append("values");
            strSql.Append("(@GoodsID,@StatusID,@Price,@UPTime,@AgentAccountName)");
            strSql.Append(";SELECT @@IDENTITY");
            SqlParameter[] paras =
            {
                new SqlParameter("@GoodsID",          goods.GoodsID),
                new SqlParameter("@StatusID",         goods.StatusID),
                new SqlParameter("@Price",            goods.Price),
                new SqlParameter("@UPTime",           goods.UPTime),
                new SqlParameter("@AgentAccountName", goods.AgentAccountName)
            };
            return(Convert.ToInt32(SqlHelper.ExecuteScalar(SqlHelper.connStr, CommandType.Text, strSql.ToString(), paras)));
        }
示例#3
0
        public bool DeleteGoods(AgentGoodsEntity goods)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append("update tbAGoods set");
            strSql.Append("status_id=@StatusID");
            strSql.Append("where id = @AgentGoodsId");
            SqlParameter[] paras =
            {
                new SqlParameter("@StatusID",     goods.StatusID),
                new SqlParameter("@AgentGoodsId", goods.AgentGoodsID)
            };
            object obj = SqlHelper.ExecuteNonQuery(SqlHelper.connStr, CommandType.Text, strSql.ToString(), paras);

            if (Convert.ToInt32(obj) > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }