private void openTransactionType(MoneyDataSet.TransactionTypesRow transactionType) { TransactionTypeForm form = new TransactionTypeForm(transactionType); if (form.ShowDialog(this) == DialogResult.OK) { fillTransactionTypes(); } }
private void btnOk_Click(object sender, EventArgs e) { if (existingItem != null) { if (existingItem.ID.StartsWith(Consts.Keeper.UserMetadataPrefix)) { existingItem.Title = tbTitle.Text.Trim(); existingItem.Description = tbDescription.Text.Trim(); existingItem.IsIncome = cbIsIncome.Checked; } } else { String ID = tbID.Text.Trim().ToUpper(); if (keeper.DataSet.TransactionTypes.FindByID(ID) != null) { MessageBox.Show(String.Format(Resources.Labels.RecordExistFormat, ID), Resources.Labels.ErrorSavingTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } else if (!ID.StartsWith(Consts.Keeper.UserMetadataPrefix)) { MessageBox.Show(String.Format(Resources.Labels.UserIDShouldHavePrefixFormat, Consts.Keeper.UserMetadataPrefix), Resources.Labels.ErrorSavingTitle, MessageBoxButtons.OK, MessageBoxIcon.Error); return; } MoneyDataSet.TransactionTypesRow transactionType = keeper.DataSet.TransactionTypes.NewTransactionTypesRow(); transactionType.ID = ID; transactionType.Title = tbTitle.Text.Trim(); transactionType.Description = tbDescription.Text.Trim(); transactionType.IsIncome = cbIsIncome.Checked; keeper.DataSet.TransactionTypes.AddTransactionTypesRow(transactionType); } keeper.DataSet.AcceptChanges(); this.DialogResult = DialogResult.OK; this.Close(); }
public TransactionTypeForm(MoneyDataSet.TransactionTypesRow existingItem) { InitializeComponent(); this.keeper = MoneyDataKeeper.Instance; this.existingItem = existingItem; }
public TransactionTypeForm(MoneyDataSet.TransactionTypesRow existingItem) { InitializeComponent(); this.keeper = MoneyDataKeeper.Instance; this.existingItem = existingItem; }