Exemple #1
0
        private void TransactionListForm_Load(object sender, EventArgs e)
        {
            if (!keeper.Accounts.Any())
            {
                tsddbNewIncome.Enabled  = false;
                tsddbNewPayment.Enabled = false;
                return;
            }
            else
            {
                // payment transactions
                foreach (MoneyDataSet.TransactionTemplatesRow template in keeper.GetTransactionTemplates(false))
                {
                    FormHelper.InsertTemplate(tsddbNewPayment.DropDownItems, template, tsmiTransactionFromTemplate_Click);
                }

                // income transactions
                foreach (MoneyDataSet.TransactionTemplatesRow template in keeper.GetTransactionTemplates(true))
                {
                    FormHelper.InsertTemplate(tsddbNewIncome.DropDownItems, template, tsmiTransactionFromTemplate_Click);
                }

                // undefined transactions are out of scope for this form, only in welcome screen
            }

            refreshTransactions();
        }
Exemple #2
0
        private void PlanListForm_Load(object sender, EventArgs e)
        {
            // payment transactions
            foreach (MoneyDataSet.TransactionTemplatesRow template in keeper.GetTransactionTemplates(false))
            {
                FormHelper.InsertTemplate(tsddbPlanPayment.DropDownItems, template, tsmiPlanFromTemplate_Click);
            }

            // income transactions
            foreach (MoneyDataSet.TransactionTemplatesRow template in keeper.GetTransactionTemplates(true))
            {
                FormHelper.InsertTemplate(tsddbPlanIncome.DropDownItems, template, tsmiPlanFromTemplate_Click);
            }

            refreshPlans();
        }
Exemple #3
0
        /// <summary>
        /// Update contents of Transactions and Plans menus
        /// </summary>
        private void refreshNewMenus()
        {
            tsmiNewIncome.DropDownItems.Clear();
            tsmiNewPayment.DropDownItems.Clear();
            tsmiPlanPayment.DropDownItems.Clear();
            tsmiPlanIncome.DropDownItems.Clear();

            if (!keeper.Accounts.Any())
            {
                ToolStripMenuItem tsmiCreateAccountsFirst = new ToolStripMenuItem(Resources.Labels.CreateAccountsFirst,
                                                                                  Properties.Resources.book_open, tsmiCreateAccountsFirst_Click);
                tsmiCreateAccountsFirst.ImageScaling = ToolStripItemImageScaling.None;
                tsmiNewIncome.DropDownItems.Add(tsmiCreateAccountsFirst);
                tsmiNewPayment.DropDownItems.Add(tsmiCreateAccountsFirst);

                // removing undefined transactions
                for (int i = tsmiTransactions.DropDownItems.Count - 1; i > 3; i--)
                {
                    tsmiTransactions.DropDownItems.Remove(tsmiTransactions.DropDownItems[i]);
                }

                // removing undefined planned transactions
                for (int i = tsmiPlans.DropDownItems.Count - 1; i > 3; i--)
                {
                    tsmiPlans.DropDownItems.Remove(tsmiPlans.DropDownItems[i]);
                }
            }
            else
            {
                // payment transactions
                foreach (MoneyDataSet.TransactionTemplatesRow template in keeper.GetTransactionTemplates(false))
                {
                    FormHelper.InsertTemplate(tsmiNewPayment.DropDownItems, template, tsmiTransactionFromTemplate_Click);
                    FormHelper.InsertTemplate(tsmiPlanPayment.DropDownItems, template, tsmiPlanFromTemplate_Click);
                }

                // income transactions
                foreach (MoneyDataSet.TransactionTemplatesRow template in keeper.GetTransactionTemplates(true))
                {
                    FormHelper.InsertTemplate(tsmiNewIncome.DropDownItems, template, tsmiTransactionFromTemplate_Click);
                    FormHelper.InsertTemplate(tsmiPlanIncome.DropDownItems, template, tsmiPlanFromTemplate_Click);
                }

                // TODO: replace these hacks with something adequate
                // removing undefined transactions
                for (int i = tsmiTransactions.DropDownItems.Count - 1; i > 3; i--)
                {
                    tsmiTransactions.DropDownItems.Remove(tsmiTransactions.DropDownItems[i]);
                }

                // removing undefined planned transactions
                for (int i = tsmiPlans.DropDownItems.Count - 1; i > 3; i--)
                {
                    tsmiPlans.DropDownItems.Remove(tsmiPlans.DropDownItems[i]);
                }

                // undefined transactions
                foreach (MoneyDataSet.TransactionTemplatesRow template in keeper.GetTransactionTemplates(null))
                {
                    FormHelper.InsertTemplate(tsmiTransactions.DropDownItems, template, tsmiTransactionFromTemplate_Click);
                    FormHelper.InsertTemplate(tsmiPlans.DropDownItems, template, tsmiPlanFromTemplate_Click);
                }

                ToolStripMenuItem tsmiAccountBalanceCorrection = new ToolStripMenuItem(Resources.Labels.AccountCorrectionLabel,
                                                                                       Properties.Resources.calculator, tsmiAccountCorrection_Click);
                tsmiAccountBalanceCorrection.ImageScaling = ToolStripItemImageScaling.None;
                tsmiAccountBalanceCorrection.ToolTipText  = Resources.Labels.AccountBalanceButtonToolTip;
                tsmiTransactions.DropDownItems.Add(tsmiAccountBalanceCorrection);
            }
        }