private void next_Click(object sender, EventArgs e) { try { if (operation == OperationType.Deposit) { int totalBanknotesQuantity = banknoteQuantities.Sum(el => el.Value); int totalSum = banknoteQuantities.Sum(el => el.Value * (int)el.Key); OnDeposit?.Invoke(totalSum, totalBanknotesQuantity); } else { OnWithdraw?.Invoke(banknoteQuantities); } UCSuccess sc = new UCSuccess(); Parent.Controls.Add(sc); Parent.Controls.SetChildIndex(sc, 0); } catch (ArgumentException ex) { MessageBox.Show(ex.Message, "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
public void Deposit(int sum) { this.Amount += sum; var eventArgs = new AccountEventArgs($"Deposited on account {sum}$", sum, Amount, DateTime.Now); OnDeposit?.Invoke(this, eventArgs); }