private void BtnAdd_Click(object sender, EventArgs e)
        {
            TransactionsUpsert transactionsUpsert = new TransactionsUpsert(db, null);

            transactionsUpsert.InitializeManageTransaction(this);
            transactionsUpsert.ShowDialog();
        }
        private void BtnEdit_Click(object sender, EventArgs e)
        {
            try
            {
                var data = ((BindingSource)dvTransactions.DataSource).List;

                TransactionSet currentTransaction = null;

                int id = int.Parse(dvTransactions.Rows[selectedRowIndex].Cells[0].Value.ToString());
                foreach (TransactionSet trans in data)
                {
                    if (trans.Id == id)
                    {
                        currentTransaction = trans;
                        break;
                    }
                }

                TransactionsUpsert transactionsUpsert = new TransactionsUpsert(db, currentTransaction);
                transactionsUpsert.InitializeManageTransaction(this);
                transactionsUpsert.ShowDialog();
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);
                MessageBox.Show("Failed to edit transaction.");
            }
        }
Ejemplo n.º 3
0
 public AddNewContact(TransactionsUpsert transactionUpsert, DatabaseModelContainer db, ContactManagement contactManagement,
                      Contact editingContact)
 {
     this.transactionUpsert = transactionUpsert;
     this.db = db;
     this.contactManagement = contactManagement;
     this.editingContact    = editingContact;
     InitializeComponent();
     if (editingContact != null)
     {
         LoadCurrentData();
     }
 }
Ejemplo n.º 4
0
        public AddNewCategory(TransactionsUpsert transactionUpsert, DatabaseModelContainer db, CategoryManagement categoryManagement,
                              Category editingCategory)
        {
            this.transactionUpsert = transactionUpsert;
            this.db = db;
            this.categoryManagement = categoryManagement;
            this.editingCategory    = editingCategory;
            InitializeComponent();


            if (editingCategory != null)
            {
                LoadCurrentCategory();
            }
        }