public static ScheduledTransactionDetail Load(dynamic dyn)
        {
            Func <dynamic, ScheduledTransactionDetail> func = (d) =>
            {
                var result = new ScheduledTransactionDetail
                {
                    AccountId              = d.account_id,
                    AccountName            = d.account_name,
                    Amount                 = d.amount,
                    CategoryId             = d.category_id,
                    CategoryName           = d.category_name,
                    DateFirst              = d.date_first,
                    DateNext               = d.date_next,
                    Deleted                = d.deleted,
                    FlagColor              = d.flag_color,
                    Frequency              = d.frequency,
                    Memo                   = d.memo,
                    PayeeId                = d.payee_id,
                    PayeeName              = d.payee_name,
                    ScheduledTransactionId = d.id,
                    TransferAccountId      = d.transfer_account_id,
                };
                foreach (var s in d.subtransactions)
                {
                    result.SubTransactions.Add(ScheduledSubTransaction.Load(s));
                }
                return(result);
            };

            return(YnabApi.ProcessApiResult(dyn, func));
        }
Example #2
0
        public static ScheduledSubTransaction Load(dynamic dyn)
        {
            Func <dynamic, ScheduledSubTransaction> func = (d) =>
            {
                var st = new ScheduledSubTransaction
                {
                    Amount     = d.amount,
                    CategoryId = d.category_id,
                    Deleted    = d.deleted,
                    Memo       = d.memo,
                    PayeeId    = d.payee_id,
                    ScheduledSubTransactionId = d.id,
                    ScheduledTransactionId    = d.scheduled_transaction_id,
                    TransferAccountId         = d.transfer_account_id,
                };
                return(st);
            };

            return(YnabApi.ProcessApiResult(dyn, func));
        }
Example #3
0
        public static BudgetDetail Load(dynamic dyn)
        {
            Func <dynamic, BudgetDetail> func = (d) =>
            {
                var result = new BudgetDetail
                {
                    BudgetId       = d.id,
                    CurrencyFormat = CurrencyFormat.Load(d.currency_format),
                    DateFormat     = DateFormat.Load(d.date_format),
                    FirstMonth     = d.first_month,
                    LastModifiedOn = d.last_modified_on,
                    LastMonth      = d.last_month,
                    Name           = d.name,
                };

                foreach (var a in d.accounts)
                {
                    result.Accounts.Add(Account.Load(a));
                }

                foreach (var p in d.payees)
                {
                    result.Payees.Add(Payee.Load(p));
                }

                foreach (var l in d.payee_locations)
                {
                    result.PayeeLocations.Add(PayeeLocation.Load(l));
                }

                foreach (var g in d.category_groups)
                {
                    result.CategoryGroups.Add(CategoryGroup.Load(g));
                }

                foreach (var c in d.categories)
                {
                    result.Categories.Add(Category.Load(c));
                }

                foreach (var m in d.months)
                {
                    result.Months.Add(MonthDetail.Load(m));
                }

                foreach (var t in d.transactions)
                {
                    result.Transactions.Add(TransactionSummary.Load(t));
                }

                foreach (var s in d.subtransactions)
                {
                    result.SubTransactions.Add(SubTransaction.Load(s));
                }

                foreach (var s in d.scheduled_transactions)
                {
                    result.ScheduledTransactions.Add(ScheduledTransactionSummary.Load(s));
                }

                foreach (var s in d.scheduled_subtransactions)
                {
                    result.ScheduledSubTransactions.Add(ScheduledSubTransaction.Load(s));
                }

                return(result);
            };

            return(YnabApi.ProcessApiResult(dyn, func));
        }