Beispiel #1
0
        private static void fillBoadList()
        {
            if (boardList != null && boardList.Count != 0)
                return;

            DataObjects.Board board1 = new DAL.DataObjects.Board("patato", "description", 1);
            DataObjects.CardHolder holder11 = new CardHolder("holder11", 1, board1.BoardId);
            DataObjects.CardHolder holder12 = new CardHolder("holder12", 2, board1.BoardId);
            DataObjects.Card card11 = new Card("card111", 1, holder11.CardHolderID);
            DataObjects.Card card12 = new Card("card112", 2, holder12.CardHolderID);
            DataObjects.Card card13 = new Card("card113", 3, holder12.CardHolderID);

            holder11.CardList = new List<Card>();
            holder11.CardList.Add(card11);

            holder12.CardList = new List<Card>();
            holder12.CardList.Add(card12);
            holder12.CardList.Add(card13);

            
            board1.CardHolderList = new List<CardHolder>();
            board1.CardHolderList.Add(holder11);
            board1.CardHolderList.Add(holder12);

            DataObjects.Board board2 = new DataObjects.Board("fire", "description", 2);
            DataObjects.CardHolder holder21 = new CardHolder("holder21", 3, board2.BoardId);
            DataObjects.CardHolder holder22 = new CardHolder("holder22", 4, board2.BoardId);
            DataObjects.Card card21 = new Card("card211", 4, holder21.CardHolderID);
            DataObjects.Card card22 = new Card("card212", 5, holder22.CardHolderID);

            holder21.CardList = new List<Card>();
            holder21.CardList.Add(card21);

            holder22.CardList = new List<Card>();
            holder22.CardList.Add(card22);

            board2.CardHolderList = new List<CardHolder>();
            board2.CardHolderList.Add(holder21);
            board2.CardHolderList.Add(holder22);

            boardList.Add(board1);
            boardList.Add(board2);

            cardHolderList.Add(holder11);
            cardHolderList.Add(holder12);
            cardHolderList.Add(holder21);
            cardHolderList.Add(holder22);

            cardList.Add(card11);
            cardList.Add(card12);
            cardList.Add(card13);
            cardList.Add(card22);
            cardList.Add(card21);
        }
Beispiel #2
0
        public static bool IncludeCardHolderInBoard(int boardWhitNewCardHolderID, CardHolder NewCardHolder)
        {
            Board board = boardList.Find(b => b.BoardId == boardWhitNewCardHolderID);

            if (board == null)
                return false;

           if (board.CardHolderList == null)
               board.CardHolderList = new List<CardHolder>();

           NewCardHolder.CardHolderID = cardHolderList.Count + 1;
            board.CardHolderList.Add(NewCardHolder);


           return true;
        }