public BasicUserTakeOutMoneyReportPanel( BasicUserTakeOutMoneyReportPanelVM basicUserTakeOutMoneyReportPanelVM) { 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}", basicUserTakeOutMoneyReportPanelVM.accountState) .ToString(new CultureInfo("en-US")) + " PLN"); // Show take out money information this.TakeOutMoneyValueLabel.Text = (String.Format("{0:0.00}", basicUserTakeOutMoneyReportPanelVM.takeOutMoneyValue) .ToString(new CultureInfo("en-US")) + " PLN"); }
private void TakeOutMoneyButton_Click(object sender, EventArgs e) { // Take out money process string takeOutMoneyResult = " Transakcja Przeprowadzona Pomyślnie"; Currency exchangeRateCurrency = Currency.PLN; decimal exchangeRate = 0.0M; decimal takeOutMoneyValue = 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 take out money value switch (this.TakeOutMoneyValueComboBox.SelectedIndex) { case 0: { takeOutMoneyValue = 50.0M; } break; case 1: { takeOutMoneyValue = 100.0M; } break; case 2: { takeOutMoneyValue = 200.0M; } break; case 3: { takeOutMoneyValue = 500.0M; } break; case 4: { takeOutMoneyValue = 1000.0M; } break; } // Take out money try { basicUser._BankAccount.TakeOutMoney(currencyRate: exchangeRate, new MoneyVAL(value: takeOutMoneyValue, currency: exchangeRateCurrency), user: this.basicUser); } catch (BankAccount_Exception b_e) { takeOutMoneyResult = b_e.What(); } catch (PhysicalMoneyVAL_Exception pm_e) { takeOutMoneyResult = "!!! Stan bankomatu nie pozwala na wypłatę !!!"; } // Check report type if (this.TakeOutMoneyReportCheckBox.Checked == false) { // redirect to basic user take out money execute panel BasicUserTakeOutMoneyExecutePanelVM basicUserTakeOutMoneyExecutePanelVM = new BasicUserTakeOutMoneyExecutePanelVM { takeOutMoneyResult = takeOutMoneyResult }; BasicUserTakeOutMoneyExecutePanel basicUserTakeOutMoneyExecutePanel = new BasicUserTakeOutMoneyExecutePanel( basicUserTakeOutMoneyExecutePanelVM); basicUserTakeOutMoneyExecutePanel.ShowDialog(); } else { // Check correct take out money process if (takeOutMoneyResult.Equals( " Transakcja Przeprowadzona Pomyślnie") == true) { // Redirect to basic user take out money report panel BasicUserTakeOutMoneyReportPanelVM basicUserTakeOutMoneyReportPanelVM = new BasicUserTakeOutMoneyReportPanelVM { accountState = this.basicUser._BankAccount.state._Value, takeOutMoneyValue = takeOutMoneyValue }; BasicUserTakeOutMoneyReportPanel basicUserTakeOutMoneyReportPanel = new BasicUserTakeOutMoneyReportPanel(basicUserTakeOutMoneyReportPanelVM); basicUserTakeOutMoneyReportPanel.ShowDialog(); } else { // redirect to basic user take out money execute panel BasicUserTakeOutMoneyExecutePanelVM basicUserTakeOutMoneyExecutePanelVM = new BasicUserTakeOutMoneyExecutePanelVM { takeOutMoneyResult = takeOutMoneyResult }; BasicUserTakeOutMoneyExecutePanel basicUserTakeOutMoneyExecutePanel = new BasicUserTakeOutMoneyExecutePanel( basicUserTakeOutMoneyExecutePanelVM); basicUserTakeOutMoneyExecutePanel.ShowDialog(); } } }