Beispiel #1
0
        private MoneyDataSet.PlannedTransactionsRow clonePlannedTransaction(MoneyDataSet.PlannedTransactionsRow source)
        {
            MoneyDataSet.PlannedTransactionsRow newPlan = ds.PlannedTransactions.NewPlannedTransactionsRow();
            newPlan.HistoryReferenceID = source.HistoryReferenceID;
            newPlan.Title = source.Title;
            newPlan.Description = source.Description;
            newPlan.AccountTypeID = source.AccountTypeID;
            newPlan.TransactionTypeID = source.TransactionTypeID;
            newPlan.Amount = source.Amount;
            newPlan.IsActive = source.IsActive;
            if (source.IsStartTimeNull())
            {
                newPlan.SetStartTimeNull();
            }
            else
            {
                newPlan.StartTime = source.StartTime;
            }
            newPlan.CurrencyID = source.CurrencyID;
            newPlan.RecurrencyID = source.RecurrencyID;
            newPlan.IsAggregated = source.IsAggregated;
            newPlan.TransactionTemplatesRow = source.TransactionTemplatesRow;
            if (!source.IsPairReferenceIDNull())
            {
                newPlan.PairReferenceID = source.PairReferenceID;
            }
            if (!source.IsEndTimeNull())
            {
                newPlan.EndTime = source.EndTime;
            }
            newPlan.EntryTime = DateTime.Now;
            ds.PlannedTransactions.AddPlannedTransactionsRow(newPlan);

            foreach (MoneyDataSet.TagsRow tag in source.GetPlannedTransactionTagsRows().Select(ptt => (ptt.TagRow)))
            {
                ds.PlannedTransactionTags.AddPlannedTransactionTagsRow(newPlan, tag);
            }

            return newPlan;
        }
        private void displayPlannedTransactionDetails(MoneyDataSet.PlannedTransactionsRow plan)
        {
            tbPlannedTransactionTitle.Text = plan.Title;
            tbPlannedTransactionDescription.Text = plan.Description;
            tbPlannedTransactionTags.Text = String.Join(Consts.UI.EnumerableSeparator, keeper.GetPlannedTransactionTagStrings(plan));

            tbPlannedTransactionAccountType.Text = plan.AccountTypeRow.Title;
            tbPlannedTransactionType.Text = plan.TransactionTypeRow.Title;

            tbPlannedTransactionAmount.Text = plan.Amount.ToString(Consts.UI.CurrencyFormat, plan.CurrenciesRow.CurrencyCultureInfo);

            tbPlannedTransactionStartDate.Text = plan.StartTime.ToString(Consts.UI.DateFormat);

            if (plan.IsEndTimeNull())
            {
                tbPlannedTransactionRecurrency.Text = plan.RecurrenciesRow.Title;
            }
            else
            {
                tbPlannedTransactionRecurrency.Text = String.Format(Resources.Labels.RecurrencyUntilFormat,
                    plan.RecurrenciesRow.Title, plan.EndTime);
            }

            btnPlannedTransactionEdit.Enabled = true;
            btnPlannedTransactionCopy.Enabled = true;
            btnPlannedTransactionDelete.Enabled = true;
            btnPlannedTransactionImplement.Enabled = true;
        }