private void removeCardSell(object sender, RoutedEventArgs e)
        {
            if (listBox_cardsInListingSelling.SelectedIndex == -1)
            {
                return;
            }

            try
            {
                Listing       listing     = ((Listing)listBox_myS.SelectedItem);
                CardInListing cardListing = ((CardInListing)listBox_cardsInListingSelling.SelectedItem);
                DatabaseControl.ExecuteNonQuerryCommand("EXEC usp_rmCardToListing " + listing.Id + ", " + cardListing.Card + ", " + cardListing.Priceperunit + ", '" + cardListing.Condition + "'");
            }
            catch (SqlException sqlE) { Console.Write("" + sqlE); }

            updateCardsList();
            updateVisual();
        }
        private void sellCard(object sender, RoutedEventArgs e)
        {
            if (listBox_b.SelectedIndex == -1)
            {
                return;
            }

            CardInListing l = listBox_b.SelectedItem as CardInListing;

            try {
                string cs = ConfigurationManager.ConnectionStrings["magicConnect"].ConnectionString;
                using (SqlConnection conn = new SqlConnection(@cs))
                {
                    conn.Open();
                    using (SqlCommand cmd = new SqlCommand("usp_buyOrSellCard", conn))
                    {
                        cmd.CommandType = CommandType.StoredProcedure;

                        // set up the parameters
                        cmd.Parameters.Add("@cardInListing", SqlDbType.Int);
                        cmd.Parameters.Add("@amount", SqlDbType.Int);
                        cmd.Parameters.Add("@user", SqlDbType.VarChar, 255);
                        cmd.Parameters.Add("@sell", SqlDbType.Bit);

                        // set parameter values
                        cmd.Parameters["@cardInListing"].Value = l.Id;
                        cmd.Parameters["@amount"].Value        = AmountToBuy.Text;
                        cmd.Parameters["@user"].Value          = App.User;
                        cmd.Parameters["@sell"].Value          = 0;
                        // open connection and execute stored procedure

                        cmd.ExecuteNonQuery();
                        conn.Close();
                    }
                }
            } catch (SqlException sqlE) { MessageBox.Show("Invalid amount of cards"); }
            updateVisual();
        }