Beispiel #1
0
        /// <summary>
        /// Get cards shuffle and seperate into questions and answers
        /// </summary>
        /// <param name="game">The game to get cards for</param>
        /// <param name="questions">A list of question cards</param>
        /// <param name="answers">A list of answer cards</param>
        public void Execute(Entities.Game game, out List<Entities.Card> questions, out List<Entities.Card> answers)
        {
            Entities.Filters.Card.SelectForDeal filter = new Entities.Filters.Card.SelectForDeal();
            filter.GameID = game.GameID;

            List<Entities.Card> cards = _selectCard.Execute(filter);

            cards.Shuffle();

            questions = cards.Where(x => x.Type == Entities.Enums.Card.CardType.Question).ToList();
            answers = cards.Where(x => x.Type == Entities.Enums.Card.CardType.Answer).ToList();

            questions.Shuffle();
            answers.Shuffle();
        }
Beispiel #2
0
        /// <summary>
        /// Get cards shuffle and seperate into questions and answers
        /// </summary>
        /// <param name="game">The game to get cards for</param>
        /// <param name="questions">A list of question cards</param>
        /// <param name="answers">A list of answer cards</param>
        public void Execute(Entities.Game game, out List <Entities.Card> questions, out List <Entities.Card> answers)
        {
            Entities.Filters.Card.SelectForDeal filter = new Entities.Filters.Card.SelectForDeal();
            filter.GameID = game.GameID;

            List <Entities.Card> cards = _selectCard.Execute(filter);

            cards.Shuffle();

            questions = cards.Where(x => x.Type == Entities.Enums.Card.CardType.Question).ToList();
            answers   = cards.Where(x => x.Type == Entities.Enums.Card.CardType.Answer).ToList();

            questions.Shuffle();
            answers.Shuffle();
        }
Beispiel #3
0
        /// <summary>
        /// Select cards based on a filter
        /// </summary>
        /// <param name="filter">The filter used to select cards</param>
        /// <returns>A filtered list of cards</returns>
        public List <Entities.Card> Execute(Entities.Filters.Card.SelectForDeal filter)
        {
            List <Entities.Card> cards = new List <Entities.Card>();

            using (DbCommand cmd = _db.GetStoredProcCommand("Card_SelectForDeal"))
            {
                _db.AddInParameter(cmd, "@GameID", DbType.Int32, filter.GameID);

                using (IDataReader idr = _db.ExecuteReader(cmd))
                {
                    while (idr.Read())
                    {
                        cards.Add(new Entities.Card(idr));
                    }
                }
            }

            return(cards);
        }
Beispiel #4
0
 /// <summary>
 /// Select cards based on a filter
 /// </summary>
 /// <param name="filter">The filter used to select cards</param>
 /// <returns>A filtered list of cards</returns>
 public List <Entities.Card> Execute(Entities.Filters.Card.SelectForDeal filter)
 {
     return(_selectCard.Execute(filter));
 }