//MakeMatch
        //handles a single matchmaking attempt
        //Input: queued cinderellas and godmothers, and empty lists for them, to be added to.
        //Output: Lists are updates with the matches
        //preconditions: the lists that are past are without error, complete in the data that they should contain, and none of them have been matched
        //Postconditions: the cinderellas have been amtched are moved to the matched lists
        public void MakeMatch(ref List<CinderellaClass> CinderellaQueue, ref List<FairyGodmother> GodMotherQueue, ref List<CinderellaClass> MatchedCinderellas, ref List<FairyGodmother> MatchedGodMother)
        {
                //Create two objects to hold the cinderellas and godmothers at the head of the queue
                CinderellaClass Cinderella = new CinderellaClass();
                FairyGodmother GodMother = new FairyGodmother();
                //get the cinderella at the head of the queue
                Cinderella = CinderellaQueue[0];
                //do the same for the godmother
                if (GodMotherQueue.Count > 0)
                {
                    GodMother = GodMotherQueue[0];
                }
                else
                {
                    GodMother = null;
                }
                //handle the best case, not special needs, no requested godmother
                if ((Cinderella.SpecialNeeds == false) && (Cinderella.RequestedGodMother == 0))
                {
                    if (GodMother != null)
                    {//deqeue the cinderella and god mother and add the match to thier appropiate lists
                        MatchedCinderellas.Add(Cinderella);
                        CinderellaQueue.RemoveAt(0);
                        MatchedGodMother.Add(GodMother);
                        GodMotherQueue.RemoveAt(0);
                    }
                }
                //special needs, no requested godmother
                if ((Cinderella.SpecialNeeds == true) && (Cinderella.RequestedGodMother == 0))
                {
                    int id = FindSpecialGodMother(ref GodMotherQueue);
                    if ((GodMother != null) && (0 > -1))//there is an availible godmother that can handle special needs
                    {
                        MatchedCinderellas.Add(Cinderella);
                        CinderellaQueue.RemoveAt(0);//deqeue cinderella
                        MatchedGodMother.Add(GodMotherQueue[id]);
                        GodMotherQueue.RemoveAt(id);//deqeue GodMother
                    }
                }
                //requested godmother
                if (Cinderella.RequestedGodMother != 0)
                {
                    if (GodMother != null)
                    {
                        int id = FindGodMotherByID(Cinderella.RequestedGodMother, ref GodMotherQueue);
                        if (id > -1)
                        {//the Requested GodMother is availible
                            MatchedCinderellas.Add(Cinderella);
                            CinderellaQueue.RemoveAt(0);//deqeue cinderella
                            MatchedGodMother.Add(GodMotherQueue[id]);
                            GodMotherQueue.RemoveAt(id);//deqeue GodMother
                        }
                        else
                        {//the GodMother is not availible at the moment

                        }
                    }
            }
        }
        //GetPairedGodMother
        //gets the godmothers who are paired to each of the cinderellas in the pairedcinderella list
        //Input: the list of paired cinderellas, a list to hold the godmothers, and information pulled down from the db
        //Output: the godmother list filled with the godmothers paired to the cinderellas
        //precondition: the pairedcinderella and the DB are in a correct and valid state
        //postcondition: the godmother list has correctly filled, and the DB is still in a correct and valid state
        public void GetPairedGodMother(ref List<FairyGodmother> PairedGodMother, ref List<CinderellaClass> PairedCinderella)
        {
            //loops through to get the godmother that is matched to each cinderella
            foreach (CinderellaClass cinderella in PairedCinderella)
            {
            //sets up the query to get the godmother paired to the cinderella
            string query = sql.PairedPersonalShoppers(cinderella.getCinderellaID());
            //sets up the connection and the sqlDataReader
            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString);

            SqlCommand command = new SqlCommand(query, conn);
            conn.Open();
            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                //read from DB into godmother class
                FairyGodmother NewFairyGodmother = new FairyGodmother(reader.GetInt32(0), reader.GetString(1), reader.GetString(2));
                bool canInsert = true;
                foreach (FairyGodmother shopper in PairedGodMother)
                {//checks to see if the godmotehr is already in the list and if not add them to it
                    if (shopper.getFairyID() == NewFairyGodmother.getFairyID())
                    {
                        canInsert = false;
                    }
                }
                if (canInsert)
                {
                    PairedGodMother.Add(NewFairyGodmother);
                }
            }
            //clean up
            reader.Close();
            conn.Close();
            }
        }
        //GetGodMothers
        //fills a list with GodMothers from the DB
        //Input: a list to hold the GodMothers, and information pulled down from the DB
        //Output: the list of GodMothers has been filled with at most 15 GodMothers
        //precondition: the DB is in a correct and valid state
        //postcondition: the DB is still in a correct and valid state,a nd no duplicate GodMothers have been added to the list
        public void GetGodMothers(ref List<FairyGodmother> godMother)
        {
            //sets up the query to get 15 pending godmothers
            string query = sql.PersonalShoppersList(15, 4);
            //sets up the connection and the sqlDataReader
            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString);

            SqlCommand command = new SqlCommand(query, conn);
            conn.Open();
            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                //read from DB into godmother class
                FairyGodmother NewFairyGodmother = new FairyGodmother(reader.GetInt32(0), reader.GetString(1), reader.GetString(2));
                bool canInsert = true;
                foreach (FairyGodmother shopper in godMother)
                {
                    //check to see if the godmother is already in the list and if not add them to it
                    if (shopper.getFairyID() == NewFairyGodmother.getFairyID())
                    {
                        canInsert = false;
                    }
                }
                if (canInsert)
                {
                    godMother.Add(NewFairyGodmother);
                }
            }
            //clean up
            reader.Close();
            conn.Close();
        }
        //GetGodMothers
        //Fills a list with the GodMothers from the DB
        //Input: the list of GodMothers that have been through matchmaking before, a list to fill with GodMothers, and the amount to get
        //Output: updated list of GodMothers pulled down from the db
        //precondition: all inputs are valid, and the database is functioning correctly and the data in it has no errors
        //postcondition: the queue is generated correctly
        void GetGodMothers(ref List<FairyGodmother> godMother, int count, ref List<int> oldGodMothers)
        {
            //sets up the query to get 15 pending godmothers
            string query = sql.PersonalShoppersList(15, 4);
            //sets up the connection and the sqlDataReader
            SqlConnection conn = new SqlConnection(ConfigurationManager.ConnectionStrings["MyConnectionString"].ConnectionString);

            SqlCommand command = new SqlCommand(query, conn);
            conn.Open();
            SqlDataReader reader = command.ExecuteReader();

            while (reader.Read())
            {
                //read from DB into godmother class
                FairyGodmother NewFairyGodmother = new FairyGodmother(reader.GetInt32(0), reader.GetString(1), reader.GetString(2));
                bool godmotherexists = false;
                bool priority = false;
                //check to see if the god motehr is already in the list
                foreach (FairyGodmother shopper in godMother)
                {
                    if (NewFairyGodmother.getFairyID() == shopper.getFairyID())
                    {
                        godmotherexists = true;
                    }
                }
                //godmother doesnt exist, time to add it to the list
                if (godmotherexists == false)
                {
                    //check to see if the god motehr has been through before
                    foreach (int id in oldGodMothers)
                    {
                        if (NewFairyGodmother.getFairyID() == id)
                        {
                            priority = true;
                        }
                    }
                    if (priority)
                        //god mother has been through before add to the front of the queue
                    {
                        godMother.Insert(0, NewFairyGodmother);
                    }
                    else
                        //add normally
                    {
                        godMother.Add(NewFairyGodmother);
                    }
                }
            }
            //clean up
            reader.Close();
            conn.Close();
        }