private void Butconfirm_Click(object sender, RoutedEventArgs e) { double amount = 0.0; try { amount = Convert.ToDouble(TBbetrag.Text); } catch (FormatException) { MessageBox.Show("Bitte füllen Sie den Betragfeld richtig ein", "Alert", MessageBoxButton.OK, MessageBoxImage.Asterisk); } catch (Exception ex) { MessageBox.Show(ex.Message); } if (Transtyp == 1 && amount != 0.0) { if (mainkonto is Girokonto) { gkonto = mainkonto as Girokonto; try { gkonto.PayIn(amount); kontotyp = 1; } catch (KtoException ex) { MessageBox.Show(ex.Message); } } else { skonto = mainkonto as Sparkonto; try { skonto.PayIn(amount); kontotyp = -1; } catch (KtoException ex) { MessageBox.Show(ex.Message); } } } if (Transtyp == -1 && amount != 0.0) { if (mainkonto is Girokonto) { gkonto = mainkonto as Girokonto; try { gkonto.PayOut(amount); kontotyp = 1; } catch (KtoException ex) { MessageBox.Show(ex.Message); } } else { skonto = mainkonto as Sparkonto; try { skonto.PayOut(amount); kontotyp = -1; } catch (KtoException ex) { MessageBox.Show(ex.Message); } } } DialogResult = true; this.Close(); }