private void enterBonusCardShowBalance_Click(object sender, RoutedEventArgs e) { notificationTextBlock.Text = ""; bonusCard = this.bonusCardService.findOne(int.Parse(BonusCardInputTextBoxShowBalance.Text)); MessageBoxResult result = MessageBox.Show("Your bonus: " + bonusCard.Bonus.ToString(), "Bonus", MessageBoxButton.OK, MessageBoxImage.Information); InputBoxShowBalance.Visibility = Visibility.Collapsed; }
public BonusCard findOne(int id) { BonusCard bonusCard = null; List <BonusCard> bonusCards = getAllBonusCards(); bonusCards.ForEach(bonusCard11 => { if (bonusCard11.Id == id) { bonusCard = bonusCard11; } }); return(bonusCard); }
public bool write(BonusCard bonusCard) { List <BonusCard> bonusCards = getAllBonusCards(); bonusCards.ForEach(bonusCard11 => { if (bonusCard11.Id == bonusCard.Id) { bonusCard11.Bonus = bonusCard.Bonus; } }); JsonService.write(bonusCards, path); return(true); }
private void enterBonusCard_Click(object sender, RoutedEventArgs e) { bonusCard = this.bonusCardService.findOne(int.Parse(bonusCardInputTextBox.Text)); if (bonusCard == null) { MessageBoxResult result = MessageBox.Show("Not found", "Error", MessageBoxButton.OK, MessageBoxImage.Error); } else { InputBox1.Visibility = Visibility.Collapsed; InputBox2.Visibility = Visibility.Visible; } }
public void createBonusCard() { List <BonusCard> bonusCards = getAllBonusCards(); BonusCard newBonusCard = new BonusCard(); newBonusCard.Bonus = 0; if (bonusCards.Count == 0) { newBonusCard.Id = 1; } else { newBonusCard.Id = bonusCards[bonusCards.Count - 1].Id + 1; } bonusCards.Add(newBonusCard); JsonService.write(bonusCards, path); }