public void LoadBoardGamesFromDatabase(OracleConnection connection) { try { OracleCommand command = connection.CreateCommand(); command.CommandText = String.Format(QRY_SELECT_BOARDGAMES, _id); connection.Open(); OracleDataReader reader = command.ExecuteReader(); while (reader.Read()) { BoardGameList.Add(BoardGameCollection.Instance().BoardGames.Where(s => s.Id == Int32.Parse(reader["BOARDGAME_ID"].ToString())).First()); } } catch (OracleException e) { throw e; } finally { connection.Close(); } }
public ListBoxSelection(List <BoardGame> FullBoardGameList, out List <BoardGame> currentBgList, ListBox resultDisplayList, bool cbshortIsChecked, bool cbmediumIsChecked, bool cblongIsChecked) { List <BoardGame> toList = new List <BoardGame>(); List <BoardGame> BoardGameList = new List <BoardGame>(); if (cbshortIsChecked) { foreach (BoardGame game in FullBoardGameList) { if (game.durationMin <= 20 && game.durationMax <= 20) { bool alreadyExist = BoardGameList.Contains(game); if (!alreadyExist) { BoardGameList.Add(game); } } } } if (cbmediumIsChecked) { foreach (BoardGame game in FullBoardGameList) { if (game.durationMax <= 60) { bool alreadyExist = BoardGameList.Contains(game); if (!alreadyExist) { BoardGameList.Add(game); } } } } if (cblongIsChecked) { foreach (BoardGame game in FullBoardGameList) { if (game.durationMin >= 60) { bool alreadyExist = BoardGameList.Contains(game); if (!alreadyExist) { BoardGameList.Add(game); } } } } if (!cbshortIsChecked && !cbmediumIsChecked && !cblongIsChecked) { BoardGameList = FullBoardGameList; } List <BoardGame> sortedList = BoardGameList.OrderBy(o => o.title).ToList(); toList.AddRange(sortedList); foreach (BoardGame game in BoardGameList) { game.expansionDisclaimer = null; string expansionListTitles = string.Empty; if (game.nbExpansions != 0) { foreach (Expansion expansion in game.expansionList) { expansionListTitles += expansion.title + " ; "; } } game.expansionListTitles = expansionListTitles; } ListCollectionView todisplay = new ListCollectionView(toList); currentBgList = toList; //resultDisplayList.ItemsSource = todisplay; //toResultDisplayList = toList; //resultDisplayList.ItemsSource = ResultDisplayListCV; }