Beispiel #1
0
        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;
        }
Beispiel #2
0
        public BonusCard findOne(int id)
        {
            BonusCard        bonusCard  = null;
            List <BonusCard> bonusCards = getAllBonusCards();

            bonusCards.ForEach(bonusCard11 =>
            {
                if (bonusCard11.Id == id)
                {
                    bonusCard = bonusCard11;
                }
            });
            return(bonusCard);
        }
Beispiel #3
0
        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);
        }
Beispiel #4
0
 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;
     }
 }
Beispiel #5
0
        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);
        }