Exemplo n.º 1
0
 private void dgvAccounts_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         AccountViewForm form = new AccountViewForm(dgvAccounts.Rows[e.RowIndex].Tag as MoneyDataSet.AccountsRow);
         if (form.ShowDialog() != DialogResult.Cancel)
         {
             refreshAccounts();
         }
     }
 }
Exemplo n.º 2
0
 private void dgvAccounts_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         AccountViewForm form = new AccountViewForm(dgvAccounts.Rows[e.RowIndex].Tag as MoneyDataSet.AccountsRow);
         if (form.ShowDialog() != DialogResult.Cancel)
         {
             refreshAccounts();
         }
     }
 }
Exemplo n.º 3
0
        private void dgvAccounts_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (dgvAccounts.SelectedRows.Count == 1)
                {
                    AccountViewForm form =
                        new AccountViewForm(dgvAccounts.SelectedRows[0].Tag as MoneyDataSet.AccountsRow);

                    if (form.ShowDialog() != DialogResult.Cancel)
                    {
                        refreshAccounts();
                    }
                }
            }
        }
Exemplo n.º 4
0
        private void dgvAccounts_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (dgvAccounts.SelectedRows.Count == 1)
                {
                    AccountViewForm form =
                        new AccountViewForm(dgvAccounts.SelectedRows[0].Tag as MoneyDataSet.AccountsRow);

                    if (form.ShowDialog() != DialogResult.Cancel)
                    {
                        refreshAccounts();
                    }
                }
            }
        }
Exemplo n.º 5
0
        private void openSearchResult(bool editMode = false)
        {
            object tag = dgvSearchResults.CurrentRow.Tag;

            if (tag is MoneyDataSet.AccountsRow)
            {
                MoneyDataSet.AccountsRow account = tag as MoneyDataSet.AccountsRow;
                if (editMode)
                {
                    AccountEditForm form = new AccountEditForm(account.AccountTypesRow.IsDebit, account: account);
                    if (form.ShowDialog() != DialogResult.Cancel)
                    {
                        updateTagCloud();
                        dgvSearchResults.Rows.Clear();
                    }
                }
                else
                {
                    AccountViewForm form = new AccountViewForm(account);
                    if (form.ShowDialog() != DialogResult.Cancel)
                    {
                        updateTagCloud();
                        dgvSearchResults.Rows.Clear();
                    }
                }
            }
            else if (tag is MoneyDataSet.TransactionsRow)
            {
                MoneyDataSet.TransactionsRow transaction = tag as MoneyDataSet.TransactionsRow;
                TransactionViewForm form = new TransactionViewForm(transaction);
                if (form.ShowDialog() != DialogResult.Cancel)
                {
                    dgvSearchResults.Rows.Remove(dgvSearchResults.CurrentRow);
                }
            }
            else if (tag is MoneyDataSet.PlannedTransactionsRow)
            {
                MoneyDataSet.PlannedTransactionsRow plan = tag as MoneyDataSet.PlannedTransactionsRow;
                if (editMode)
                {
                    MoneyDataSet.PlannedTransactionsRow sourcePlan = null;
                    MoneyDataSet.PlannedTransactionsRow destinationPlan = null;

                    if (plan.TransactionTemplatesRow == null)
                    {
                        ErrorHelper.ShowErrorBox(ErrorHelper.Errors.PlanWithoutTemplate);
                        Log.Write("Plan", plan);
                        return;
                    }

                    if (plan.TransactionTemplatesRow.HasDestinationAccount)
                    {
                        sourcePlan = keeper.PlannedTransactions.SingleOrDefault(p => ((!p.IsPairReferenceIDNull()) &&
                            (p.PairReferenceID == plan.PairReferenceID) &&
                            (p.TransactionTypeID.Equals(plan.TransactionTemplatesRow.SourceTransactionTypeID))));

                        destinationPlan = keeper.PlannedTransactions.SingleOrDefault(p => ((!p.IsPairReferenceIDNull()) &&
                            (p.PairReferenceID == plan.PairReferenceID) &&
                            (p.TransactionTypeID.Equals(plan.TransactionTemplatesRow.DestinationTransactionTypeID))));
                    }
                    else
                    {
                        sourcePlan = plan;
                    }

                    PlanEditForm form = new PlanEditForm(sourcePlan.TransactionTemplatesRow,
                        sourcePlan, destinationPlan);

                    if (form.ShowDialog(this) != DialogResult.Cancel)
                    {
                        updateTagCloud();
                        dgvSearchResults.Rows.Clear();
                    }
                }
                else
                {
                    PlanViewForm form = new PlanViewForm(plan);
                    if (form.ShowDialog(this) != DialogResult.Cancel)
                    {
                        updateTagCloud();
                        dgvSearchResults.Rows.Clear();
                    }
                }
            }
            else
            {
                ErrorHelper.ShowErrorBox(ErrorHelper.Errors.UnknownSearchResult);
                Log.Write("Found in search", tag);
            }

            //updateTagCloud();
            //dgvSearchResults.Rows.Clear();
        }
Exemplo n.º 6
0
        private void openSearchResult(bool editMode = false)
        {
            object tag = dgvSearchResults.CurrentRow.Tag;

            if (tag is MoneyDataSet.AccountsRow)
            {
                MoneyDataSet.AccountsRow account = tag as MoneyDataSet.AccountsRow;
                if (editMode)
                {
                    AccountEditForm form = new AccountEditForm(account.AccountTypesRow.IsDebit, account: account);
                    if (form.ShowDialog() != DialogResult.Cancel)
                    {
                        updateTagCloud();
                        dgvSearchResults.Rows.Clear();
                    }
                }
                else
                {
                    AccountViewForm form = new AccountViewForm(account);
                    if (form.ShowDialog() != DialogResult.Cancel)
                    {
                        updateTagCloud();
                        dgvSearchResults.Rows.Clear();
                    }
                }
            }
            else if (tag is MoneyDataSet.TransactionsRow)
            {
                MoneyDataSet.TransactionsRow transaction = tag as MoneyDataSet.TransactionsRow;
                TransactionViewForm          form        = new TransactionViewForm(transaction);
                if (form.ShowDialog() != DialogResult.Cancel)
                {
                    dgvSearchResults.Rows.Remove(dgvSearchResults.CurrentRow);
                }
            }
            else if (tag is MoneyDataSet.PlannedTransactionsRow)
            {
                MoneyDataSet.PlannedTransactionsRow plan = tag as MoneyDataSet.PlannedTransactionsRow;
                if (editMode)
                {
                    MoneyDataSet.PlannedTransactionsRow sourcePlan      = null;
                    MoneyDataSet.PlannedTransactionsRow destinationPlan = null;

                    if (plan.TransactionTemplatesRow == null)
                    {
                        ErrorHelper.ShowErrorBox(ErrorHelper.Errors.PlanWithoutTemplate);
                        Log.Write("Plan", plan);
                        return;
                    }

                    if (plan.TransactionTemplatesRow.HasDestinationAccount)
                    {
                        sourcePlan = keeper.PlannedTransactions.SingleOrDefault(p => ((!p.IsPairReferenceIDNull()) &&
                                                                                      (p.PairReferenceID == plan.PairReferenceID) &&
                                                                                      (p.TransactionTypeID.Equals(plan.TransactionTemplatesRow.SourceTransactionTypeID))));

                        destinationPlan = keeper.PlannedTransactions.SingleOrDefault(p => ((!p.IsPairReferenceIDNull()) &&
                                                                                           (p.PairReferenceID == plan.PairReferenceID) &&
                                                                                           (p.TransactionTypeID.Equals(plan.TransactionTemplatesRow.DestinationTransactionTypeID))));
                    }
                    else
                    {
                        sourcePlan = plan;
                    }

                    PlanEditForm form = new PlanEditForm(sourcePlan.TransactionTemplatesRow,
                                                         sourcePlan, destinationPlan);

                    if (form.ShowDialog(this) != DialogResult.Cancel)
                    {
                        updateTagCloud();
                        dgvSearchResults.Rows.Clear();
                    }
                }
                else
                {
                    PlanViewForm form = new PlanViewForm(plan);
                    if (form.ShowDialog(this) != DialogResult.Cancel)
                    {
                        updateTagCloud();
                        dgvSearchResults.Rows.Clear();
                    }
                }
            }
            else
            {
                ErrorHelper.ShowErrorBox(ErrorHelper.Errors.UnknownSearchResult);
                Log.Write("Found in search", tag);
            }

            //updateTagCloud();
            //dgvSearchResults.Rows.Clear();
        }