Example #1
0
        private void buttonCreate_Click(object sender, RoutedEventArgs e)
        {
            if (textBoxName.Text == "" || textBoxAmount.Text == "" || textBoxInterest.Text == "")
            {
                MessageBox.Show("Name, Amount or Interest is empty!");
            }
            else
            {
                string name     = textBoxName.Text;
                double amount   = double.Parse(textBoxAmount.Text);
                double interest = double.Parse(textBoxInterest.Text);
                book = new ClassSavingbook(name);

                book.PayIn(amount);
                book.Interest = interest;

                if (savingsBooks.Contains(book))
                {
                    MessageBox.Show("Name already exists!");
                }
                else
                {
                    savingsBooks.Add(book);
                    listBoxBooks.Items.Refresh();
                    CurrentCapital();
                }
            }
        }
Example #2
0
 public override bool Equals(object obj)
 {
     if (obj is ClassSavingbook)
     {
         ClassSavingbook otherSavingsBook = (ClassSavingbook)obj;
         if (otherSavingsBook.Name == this.Name)
         {
             return(true);
         }
     }
     return(false);
 }