public bidWCF GetTopBid(int item_id)
        {
            using (SqlConnection connection = new SqlConnection(Constants.SQLConnectionString))
            {
                using (SqlCommand cmd = new SqlCommand("SELECT TOP 1 * from dbo.bids WHERE item_id = @item_id ORDER BY amount DESC", connection))
                {
                    cmd.Parameters.AddWithValue("@item_id", item_id);
                    connection.Open();
                    using (SqlDataReader reader = cmd.ExecuteReader())
                    {
                        // Check is the reader has any rows at all before starting to read.
                        if (reader.HasRows)
                        {
                            // Read advances to the next row.
                            //TODO: chekc fvalues for null
                            while (reader.Read())
                            {
                                bidWCF b = new bidWCF(
                                    reader.GetInt32(reader.GetOrdinal("id")),
                                    reader.GetInt32(reader.GetOrdinal("item_id")),
                                    reader.GetString(reader.GetOrdinal("bidder_id")),
                                    reader.GetFloat(reader.GetOrdinal("amount"))
                                    );

                                return(b);
                            }
                        }
                    }
                }
            }
            return(null);
        }
        public bool AddBid(bidWCF bid)
        {
            bidWCF b        = bid;
            int    affected = 0;

            using (SqlConnection connection = new SqlConnection(Constants.SQLConnectionString))

                using (SqlCommand cmd = new SqlCommand("INSERT INTO dbo.bids(item_id,bidder_id,amount,date_added) VALUES(@item_id,@bidder_id,@amount,SYSDATETIME())", connection))
                {
                    cmd.Parameters.AddWithValue("@item_id", b.item_id);
                    cmd.Parameters.AddWithValue("@bidder_id", b.bidder_id);
                    cmd.Parameters.AddWithValue("@amount", b.amount);

                    connection.Open();
                    affected = cmd.ExecuteNonQuery();
                }
            return(affected > 0 ? true : false);
        }
 public bool AddBid(bidWCF bid)
 {
     return(DBACC.AddBid(bid));
 }