public AccountEditForm(bool isDebit, MoneyDataSet.AccountTypesRow accountType = null, MoneyDataSet.AccountsRow account = null) { InitializeComponent(); this.keeper = MoneyDataKeeper.Instance; this.isDebit = isDebit; this.accountType = accountType; this.account = account; }
public AccountViewForm(MoneyDataSet.AccountsRow account) { InitializeComponent(); this.account = account; tbTitle.Text = account.FullTitle; tbBalance.Text = account.Balance.ToString(Consts.UI.CurrencyFormat, account.CurrenciesRow.CurrencyCultureInfo); tbDescription.Text = account.Description; ttbTags.Tags = keeper.GetAccountTagStrings(account); DialogResult = DialogResult.Cancel; }
private void btnOk_Click(object sender, EventArgs e) { tbTitle.Text = tbTitle.Text.Trim(); if (account != null) { // updating existing account account = keeper.UpdateAccount(account.ID, tbTitle.Text, tbDescription.Text, cbHideAccount.Checked, ttbTags.Tags); } else { // creating new account account = keeper.PreCreateAccount(cbAccountType.SelectedItem as MoneyDataSet.AccountTypesRow, tbTitle.Text, tbDescription.Text, cbCurrency.SelectedItem as MoneyDataSet.CurrenciesRow, 0); ValidationResult result = keeper.Validate(account: account); if (!result.Success) { if (result.PreventAction) { MessageBox.Show(String.Format(Resources.Labels.AccountValidationErrorsFoundFormat, result.Message), Resources.Labels.AccountValidationTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else { if (MessageBox.Show(String.Format(Resources.Labels.AccountValidationWarningsFoundFormat, result.Message), Resources.Labels.AccountValidationTitle, MessageBoxButtons.OKCancel, MessageBoxIcon.Warning) == DialogResult.Cancel) { return; } } } account = keeper.CreateAccount(account, ttbTags.Tags); } keeper.AddTextHistory(Consts.Keeper.AccountTitleHistoryID, tbTitle.Text); this.DialogResult = DialogResult.OK; this.Close(); }
private void updateSourceCurrency() { if (cbSourceAccount.SelectedItem != null) { MoneyDataSet.AccountsRow account = cbSourceAccount.SelectedItem as MoneyDataSet.AccountsRow; MoneyDataSet.CurrenciesRow currency = account.CurrenciesRow; lblSourceCurrency.Visible = false; numSourceAmount.Visible = false; CultureInfo culture = account.CurrenciesRow.CurrencyCultureInfo; lblSourceBalance.Text = String.Format(culture, Resources.Labels.BalanceFormat, account.Balance); lblSourceCurrency.Text = culture.NumberFormat.CurrencySymbol; if (sourceAccountSelected != null) { numSourceAmount.Value = (decimal)(((double)numSourceAmount.Value) * sourceAccountSelected.CurrenciesRow.ExchangeRate / currency.ExchangeRate); numSourceAmount.Select(0, Int32.MaxValue); } if (currency.IsSymbolAfterAmount) { tlpSource.SetCellPosition(lblSourceCurrency, new TableLayoutPanelCellPosition(2, 6)); tlpSource.SetCellPosition(numSourceAmount, new TableLayoutPanelCellPosition(0, 6)); lblSourceCurrency.TextAlign = ContentAlignment.MiddleLeft; lblSourceCurrency.Dock = DockStyle.Left; } else { tlpSource.SetCellPosition(lblSourceCurrency, new TableLayoutPanelCellPosition(0, 6)); tlpSource.SetCellPosition(numSourceAmount, new TableLayoutPanelCellPosition(1, 6)); lblSourceCurrency.TextAlign = ContentAlignment.MiddleRight; lblSourceCurrency.Dock = DockStyle.Right; } lblSourceCurrency.Visible = true; numSourceAmount.Visible = true; sourceAccountSelected = account; } }
public AccountCorrectionForm(MoneyDataSet.AccountsRow selectedAccount = null) { InitializeComponent(); existingAccount = selectedAccount; keeper = MoneyDataKeeper.Instance; }