Exemplo n.º 1
0
        void CreateGamesLayout()
        {
            var games = DBController.GetGamesParams();

            InitializeFilter(games);
            ShowGames(games);
        }
        void FillComboBoxes()
        {
            typeBox.Items.Clear();
            genreBox.Items.Clear();
            authorBox.Items.Clear();
            var games  = DBController.GetGamesParams();
            var genres = (from game in games
                          select game.Genre).Distinct();

            foreach (var genre in genres)
            {
                genreBox.Items.Add(genre);
            }
            genreBox.SelectedIndex = 0;
            var types = (from game in games
                         select game.Type).Distinct();

            foreach (var type in types)
            {
                typeBox.Items.Add(type);
            }
            typeBox.SelectedIndex = 1;
            var authors = (from game in games
                           select game.Author).Distinct();

            foreach (var author in authors)
            {
                authorBox.Items.Add(author);
            }
            authorBox.SelectedIndex = 1;
        }
        void DisplayGamesInfo()
        {
            dataGridView1.Rows.Clear();
            var games = DBController.GetGamesParams();

            foreach (var game in games)
            {
                dataGridView1.Rows.Add(game.ID, game.Name, game.Description, game.Price,
                                       game.Quantity, game.Author, game.minDuration, game.maxDuration,
                                       game.Genre, game.minPlayers, game.maxPlayers, game.Type, game.Image != null? "Да" : "Нет");
            }
        }