/// <summary>
        /// Loads the new giveaway form
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void newGiveawayToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Giveaway ga = new Giveaway(this);

            ga.Show();
            ga.Setup();
        }
 /// <summary>
 /// Takes you to the configuration page for the current giveaway
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void configureGiveawayToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (GiveAwayID == "-1")
     {
         Giveaway ga = new Giveaway(this);
         ga.Show();
         ga.Setup();
     }
     else
     {
         Giveaway ga = new Giveaway(this);
         ga.Show();
         ga.Setup(GiveAwayID);
     }
 }
        /// <summary>
        /// Runs through the items and picks the winner for each one.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void pickWinner_Click(object sender, EventArgs e)
        {
            new Thread(() =>
            {
                if (GiveAwayID != "-1")
                {
                    //check how many items there are for this
                    String selectItems = "SELECT id,item_name,quantity,won FROM giveaway_items where giveaway=" + GiveAwayID;
                    Database db        = new Database();
                    db.Open();
                    SQLiteDataReader itemRes = db.Select(selectItems);
                    if (itemRes.HasRows)
                    {
                        List <Item> items = new List <Item>();
                        while (itemRes.Read())
                        {
                            String itemID   = itemRes.GetValue(0).ToString();
                            String itemName = (String)itemRes.GetValue(1);
                            Int64 itemCount = (Int64)itemRes.GetValue(2);
                            Int64 itemsWon  = (Int64)itemRes.GetValue(3);
                            items.Add(new Item(itemID, itemName, itemCount, itemsWon));
                        }
                        itemRes.Close();
                        db.Close();
                        foreach (Item item in items)
                        {
                            if (item.itemsWon < item.itemCount)
                            {
                                item.itemCount = item.itemCount - item.itemsWon;//so we don't double gift
                                if (item.itemCount == 1)
                                {
                                    GetWinner(item.itemID, item.itemName, 1, 1);
                                }
                                else
                                {
                                    for (int i = 0; i < item.itemCount; i++)
                                    {
                                        int itemNo = i + 1;
                                        GetWinner(item.itemID, item.itemName, itemNo, (int)item.itemCount);
                                    }
                                }
                            }
                        }
                        Winners win = new Winners(GiveAwayID);
                        win.ShowDialog();
                    }
                    else
                    {
                        itemRes.Close();
                        db.Close();
                        MessageBox.Show("There are currently no items for this giveaway. Please add some");

                        Giveaway ga = new Giveaway(this);
                        ga.Show();
                        ga.Setup(GiveAwayID);
                    }
                }
                else
                {
                    MessageBox.Show("You have not got a giveaway selected. Please either create one or select one");
                }
            }).Start();
        }