void OpenGameInfo(string name) { var gameToDisplay = UIController.PrepareGameToDisplay(DBController.GetGameByName(name)); var gameInfoForm = new GameInfoForm(gameToDisplay); gameInfoForm.GameBoughtEvent += GameBought; gameInfoForm.Show(); }
bool CheckAvailability(string name) { var currentGameCount = (from game in UIController.currentOrderGames where game.Item1 == name select game).Count(); var availableGames = DBController.GetGameByName(name).Quantity; return(availableGames > currentGameCount); }
private void OrderButton_Click(object sender, EventArgs e) { var currentOrderGameParams = new List <GameParams>(); var groupedGames = from game in UIController.currentOrderGames group game by game.Item1; foreach (var game in groupedGames) { var currentGame = DBController.GetGameByName(game.Key); currentGame.Quantity = game.Count(); currentOrderGameParams.Add(currentGame); } var orderConfirmationForm = new OrderConfirmationForm(currentOrderGameParams); Hide(); if (orderConfirmationForm.ShowDialog() == DialogResult.OK) { OnCartClear(); } Dispose(); }