public BasicUserAddMoneyReportPanel( BasicUserAddMoneyReportPanelVM basicUserAddMoneyReportPanelVM) { InitializeComponent(); // Show date information this.DateValueLabel.Text = DateTime.Now.ToString("dd/MM/yyyy"); // Show account state information this.AccountStateValueLabel.Text = (String.Format("{0:0.00}", basicUserAddMoneyReportPanelVM.accountState) .ToString(new CultureInfo("en-US")) + " PLN"); // Show add money information this.AddMoneyValueLabel.Text = (String.Format("{0:0.00}", basicUserAddMoneyReportPanelVM.addMoneyValue) .ToString(new CultureInfo("en-US")) + " PLN"); }
private void AddMoneyButton_Click(object sender, System.EventArgs e) { // Add money process Currency exchangeRateCurrency = Currency.PLN; decimal exchangeRate = 0.0M; decimal addMoneyValue = 0.0M; // Get information about currency switch (this.CurrencyComboBox.SelectedIndex) { case 0: { exchangeRateCurrency = Currency.PLN; exchangeRate = CashWithdrawalProperties.exchangeRates.PLN_exchangeRate; } break; case 1: { exchangeRateCurrency = Currency.USD; exchangeRate = CashWithdrawalProperties.exchangeRates.USD_exchangeRate; } break; case 2: { exchangeRateCurrency = Currency.EUR; exchangeRate = CashWithdrawalProperties.exchangeRates.EUR_exchangeRate; } break; case 3: { exchangeRateCurrency = Currency.GBP; exchangeRate = CashWithdrawalProperties.exchangeRates.GBP_exchangeRate; } break; } // Get information about add money value switch (this.AddMoneyValueComboBox.SelectedIndex) { case 0: { addMoneyValue = 50.0M; } break; case 1: { addMoneyValue = 100.0M; } break; case 2: { addMoneyValue = 200.0M; } break; case 3: { addMoneyValue = 500.0M; } break; case 4: { addMoneyValue = 1000.0M; } break; } // Add money try { this.basicUser._BankAccount.AddMoney(currencyRate: exchangeRate, money: new MoneyVAL(value: addMoneyValue, currency: exchangeRateCurrency), user: this.basicUser); } catch (BankAccount_Exception b_e) { } // Check report type if (AddMoneyReportCheckBox.Checked == false) { // Redirect to basic user add money execute panel BasicUserAddMoneyExecutePanel basicUserAddMoneyExecutePanel = new BasicUserAddMoneyExecutePanel(); basicUserAddMoneyExecutePanel.ShowDialog(); } else { // Redirect to basic user add money report panel BasicUserAddMoneyReportPanelVM basicUserAddMoneyReportPanelVM = new BasicUserAddMoneyReportPanelVM { accountState = this.basicUser._BankAccount.state._Value, addMoneyValue = (addMoneyValue * exchangeRate) }; BasicUserAddMoneyReportPanel basicUserAddMoneyReportPanel = new BasicUserAddMoneyReportPanel(basicUserAddMoneyReportPanelVM); basicUserAddMoneyReportPanel.ShowDialog(); } }