Example #1
0
 /// <summary>
 /// Handler for double click on month plans grid
 /// </summary>
 private void dgvPlans_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         PlanViewForm form = new PlanViewForm(dgvPlans.Rows[e.RowIndex].Tag as MoneyDataSet.PlannedTransactionsRow);
         if (form.ShowDialog() != DialogResult.Cancel)
         {
             refreshForm();
         }
     }
 }
Example #2
0
 private void dgvPlans_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
 {
     if (e.RowIndex >= 0)
     {
         PlanViewForm form = new PlanViewForm(dgvPlans.Rows[e.RowIndex].Tag as MoneyDataSet.PlannedTransactionsRow);
         if (form.ShowDialog() != DialogResult.Cancel)
         {
             refreshPlans();
         }
     }
 }
Example #3
0
 private void dgvPlans_KeyDown(object sender, KeyEventArgs e)
 {
     if (e.KeyCode == Keys.Enter)
     {
         if (dgvPlans.SelectedRows.Count == 1)
         {
             PlanViewForm form = new PlanViewForm(dgvPlans.SelectedRows[0].Tag as MoneyDataSet.PlannedTransactionsRow);
             if (form.ShowDialog() != DialogResult.Cancel)
             {
                 refreshForm();
             }
         }
     }
 }
Example #4
0
        private void dgvPlans_KeyDown(object sender, KeyEventArgs e)
        {
            if (e.KeyCode == Keys.Enter)
            {
                if (dgvPlans.SelectedRows.Count == 1)
                {
                    PlanViewForm form =
                        new PlanViewForm(dgvPlans.SelectedRows[0].Tag as MoneyDataSet.PlannedTransactionsRow);

                    if (form.ShowDialog() != DialogResult.Cancel)
                    {
                        refreshPlans();
                    }
                }
            }
        }
Example #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();
        }
Example #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();
        }