コード例 #1
0
        public static TransactionDetail Load(dynamic dyn)
        {
            Func <dynamic, TransactionDetail> func = (d) =>
            {
                var result = new TransactionDetail
                {
                    AccountId             = d.account_id,
                    AccountName           = d.account_name,
                    Amount                = d.amount,
                    Approved              = d.approved,
                    CategoryId            = d.category_id,
                    CategoryName          = d.category_name,
                    Cleared               = d.cleared,
                    Date                  = d.date,
                    Deleted               = d.deleted,
                    FlagColor             = d.flag_color,
                    ImportId              = d.import_id,
                    Memo                  = d.memo,
                    PayeeId               = d.payee_id,
                    PayeeName             = d.payee_name,
                    TransactionId         = d.id,
                    TransferAccountId     = d.transfer_account_id,
                    TransferTransactionId = d.transfer_transaction_id,
                };
                foreach (var s in d.subtransactions)
                {
                    result.SubTransactions.Add(SubTransaction.Load(s));
                }

                return(result);
            };

            return(YnabApi.ProcessApiResult(dyn, func));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
        public static TransactionSummary Load(dynamic dyn)
        {
            Func <dynamic, TransactionSummary> func = (d) =>
            {
                return(new TransactionSummary
                {
                    AccountId = d.account_id,
                    Amount = d.amount,
                    Approved = d.approved,
                    CategoryId = d.category_id,
                    Cleared = d.cleared,
                    Date = d.date,
                    Deleted = d.deleted,
                    FlagColor = d.flag_color,
                    ImportId = d.import_id,
                    Memo = d.memo,
                    PayeeId = d.payee_id,
                    TransactionId = d.id,
                    TransferAccountId = d.transfer_account_id,
                    TransferTransactionId = d.transfer_transaction_id,
                });
            };

            return(YnabApi.ProcessApiResult(dyn, func));
        }
コード例 #4
0
        public static MonthDetail Load(dynamic dyn)
        {
            Func <dynamic, MonthDetail> func = (d) =>
            {
                var month = new MonthDetail
                {
                    Activity     = d.activity,
                    AgeOfMoney   = d.age_of_money,
                    Budgeted     = d.budgeted,
                    Income       = d.income,
                    Month        = d.month,
                    Note         = d.note,
                    ToBeBudgeted = d.to_be_budgeted,
                };

                foreach (var mc in d.categories)
                {
                    month.Categories.Add(Category.Load(mc));
                }

                return(month);
            };

            return(YnabApi.ProcessApiResult(dyn, func));
        }
コード例 #5
0
        public static CategoryResponse Load(dynamic dyn)
        {
            Func <dynamic, CategoryResponse> func = (d) =>
            {
                return(new CategoryResponse
                {
                    Data = CategoryWrapper.Load(d.data)
                });
            };

            return(YnabApi.ProcessApiResult(dyn, func));
        }
コード例 #6
0
        public static TransactionResponse Load(dynamic dyn)
        {
            Func <dynamic, TransactionResponse> func = (d) =>
            {
                return(new TransactionResponse
                {
                    Data = TransactionWrapper.Load(d.data)
                });
            };

            return(YnabApi.ProcessApiResult(dyn, func));
        }
コード例 #7
0
        public static UserWrapper Load(dynamic dyn)
        {
            Func <dynamic, UserWrapper> func = (d) =>
            {
                return(new UserWrapper
                {
                    User = User.Load(d.user)
                });
            };

            return(YnabApi.ProcessApiResult(dyn, func));
        }
コード例 #8
0
        public static TransactionWrapper Load(dynamic dyn)
        {
            Func <dynamic, TransactionWrapper> func = (d) =>
            {
                return(new TransactionWrapper
                {
                    Transaction = TransactionDetail.Load(d.transaction)
                });
            };

            return(YnabApi.ProcessApiResult(dyn, func));
        }
コード例 #9
0
        public static DateFormat Load(dynamic dyn)
        {
            Func <dynamic, DateFormat> func = (d) =>
            {
                return(new DateFormat
                {
                    Format = d.format
                });
            };

            return(YnabApi.ProcessApiResult(dyn, func));
        }
コード例 #10
0
ファイル: User.cs プロジェクト: leistnerm/MyBudgetExplorer
        public static User Load(dynamic dyn)
        {
            Func <dynamic, User> func = (d) =>
            {
                return(new User
                {
                    UserId = d.id
                });
            };

            return(YnabApi.ProcessApiResult(dyn, func));
        }
コード例 #11
0
        public static PayeeLocationWrapper Load(dynamic dyn)
        {
            Func<dynamic, PayeeLocationWrapper> func = (d) =>
            {
                return new PayeeLocationWrapper
                {
                    PayeeLocation = PayeeLocation.Load(d.payee_location)
                };
            };

            return YnabApi.ProcessApiResult(dyn, func);
        }
コード例 #12
0
        public static PayeeLocationResponse Load(dynamic dyn)
        {
            Func <dynamic, PayeeLocationResponse> func = (d) =>
            {
                return(new PayeeLocationResponse
                {
                    Data = PayeeLocationsWrapper.Load(d.data)
                });
            };

            return(YnabApi.ProcessApiResult(dyn, func));
        }
コード例 #13
0
        public static BudgetSettingsWrapper Load(dynamic dyn)
        {
            Func <dynamic, BudgetSettingsWrapper> func = (d) =>
            {
                return(new BudgetSettingsWrapper
                {
                    Settings = BudgetSettings.Load(d.settings)
                });
            };

            return(YnabApi.ProcessApiResult(dyn, func));
        }
コード例 #14
0
        public static MonthSummariesResponse Load(dynamic dyn)
        {
            Func <dynamic, MonthSummariesResponse> func = (d) =>
            {
                return(new MonthSummariesResponse
                {
                    Data = MonthSummariesWrapper.Load(d.data)
                });
            };

            return(YnabApi.ProcessApiResult(dyn, func));
        }
コード例 #15
0
        public static ScheduledTransactionsResponse Load(dynamic dyn)
        {
            Func <dynamic, ScheduledTransactionsResponse> func = (d) =>
            {
                return(new ScheduledTransactionsResponse
                {
                    Data = ScheduledTransactionsWrapper.Load(d.data)
                });
            };

            return(YnabApi.ProcessApiResult(dyn, func));
        }
コード例 #16
0
        public static AccountWrapper Load(dynamic dyn)
        {
            Func <dynamic, AccountWrapper> func = (d) =>
            {
                return(new AccountWrapper
                {
                    Account = Account.Load(d.account)
                });
            };

            return(YnabApi.ProcessApiResult(dyn, func));
        }
コード例 #17
0
        public static BudgetDetailResponse Load(dynamic dyn)
        {
            Func <dynamic, BudgetDetailResponse> func = (d) =>
            {
                return(new BudgetDetailResponse
                {
                    Data = BudgetDetailWrapper.Load(d.data)
                });
            };

            return(YnabApi.ProcessApiResult(dyn, func));
        }
コード例 #18
0
        public static AccountResponse Load(dynamic dyn)
        {
            Func <dynamic, AccountResponse> func = (d) =>
            {
                return(new AccountResponse
                {
                    Data = AccountWrapper.Load(d.data)
                });
            };

            return(YnabApi.ProcessApiResult(dyn, func));
        }
コード例 #19
0
        public static UserResponse Load(dynamic dyn)
        {
            Func <dynamic, UserResponse> func = (d) =>
            {
                return(new UserResponse
                {
                    Data = UserWrapper.Load(d.data)
                });
            };

            return(YnabApi.ProcessApiResult(dyn, func));
        }
コード例 #20
0
        public static ScheduledTransactionWrapper Load(dynamic dyn)
        {
            Func <dynamic, ScheduledTransactionWrapper> func = (d) =>
            {
                return(new ScheduledTransactionWrapper
                {
                    ScheduledTransaction = ScheduledTransactionDetail.Load(d.scheduled_transaction)
                });
            };

            return(YnabApi.ProcessApiResult(dyn, func));
        }
コード例 #21
0
        public static PayeeWrapper Load(dynamic dyn)
        {
            Func <dynamic, PayeeWrapper> func = (d) =>
            {
                return(new PayeeWrapper
                {
                    Payee = Payee.Load(d.payee)
                });
            };

            return(YnabApi.ProcessApiResult(dyn, func));
        }
コード例 #22
0
        public static MonthDetailWrapper Load(dynamic dyn)
        {
            Func <dynamic, MonthDetailWrapper> func = (d) =>
            {
                return(new MonthDetailWrapper
                {
                    Month = MonthDetail.Load(d.month)
                });
            };

            return(YnabApi.ProcessApiResult(dyn, func));
        }
コード例 #23
0
        public static CategoryWrapper Load(dynamic dyn)
        {
            Func <dynamic, CategoryWrapper> func = (d) =>
            {
                return(new CategoryWrapper
                {
                    Category = Category.Load(d.category)
                });
            };

            return(YnabApi.ProcessApiResult(dyn, func));
        }
コード例 #24
0
        public static BudgetSettings Load(dynamic dyn)
        {
            Func <dynamic, BudgetSettings> func = (d) =>
            {
                return(new BudgetSettings
                {
                    CurrencyFormat = CurrencyFormat.Load(d.currency_format),
                    DateFormat = DateFormat.Load(d.date_format)
                });
            };

            return(YnabApi.ProcessApiResult(dyn, func));
        }
コード例 #25
0
        public static BudgetDetailWrapper Load(dynamic dyn)
        {
            Func <dynamic, BudgetDetailWrapper> func = (d) =>
            {
                return(new BudgetDetailWrapper
                {
                    ServerKnowledge = d.server_knowledge,
                    Budget = BudgetDetail.Load(d.budget)
                });
            };

            return(YnabApi.ProcessApiResult(dyn, func));
        }
コード例 #26
0
        public static Category Load(dynamic dyn)
        {
            Func <dynamic, Category> func = (d) =>
            {
                var category = new Category
                {
                    Activity               = d.activity,
                    Balance                = d.balance,
                    Budgeted               = d.budgeted,
                    CategoryGroupId        = d.category_group_id,
                    CategoryId             = d.id,
                    Deleted                = d.deleted,
                    GoalCreationMonth      = d.goal_creation_month,
                    GoalPercentageComplete = d.goal_percentage_complete,
                    GoalTarget             = 0,
                    GoalTargetMonth        = d.goal_target_month,
                    GoalType               = d.goal_type,
                    Hidden = d.hidden,
                    Name   = d.name,
                    Note   = d.note,
                    OriginalCategoryGroupId = d.original_category_group_id,
                };

                // Correct invalid goal target.  Ran into this once.
                if (d.goal_target != null)
                {
                    try
                    {
                        category.GoalTarget = d.goal_target;
                    }
                    catch (Exception ex)
                    {
                        string goalData = string.Empty;
                        try
                        {
                            goalData = d.goal_target.parent.ToString();
                        }
                        catch
                        {
                            goalData = d.goal_target.ToString();
                        }

                        throw new InvalidCastException($"Could not parse category goal_target.\n\nGoal data: ${goalData}", ex);
                    }
                }

                return(category);
            };

            return(YnabApi.ProcessApiResult(dyn, func));
        }
コード例 #27
0
        public static ScheduledTransactionsWrapper Load(dynamic dyn)
        {
            Func <dynamic, ScheduledTransactionsWrapper> func = (d) =>
            {
                var result = new ScheduledTransactionsWrapper();
                foreach (var t in d.scheduled_transactions)
                {
                    result.ScheduledTransactions.Add(ScheduledTransactionDetail.Load(t));
                }
                return(result);
            };

            return(YnabApi.ProcessApiResult(dyn, func));
        }
コード例 #28
0
        public static AccountsWrapper Load(dynamic dyn)
        {
            Func <dynamic, AccountsWrapper> func = (d) =>
            {
                var result = new AccountsWrapper();
                foreach (var a in d.accounts)
                {
                    result.Accounts.Add(Account.Load(a));
                }
                return(result);
            };

            return(YnabApi.ProcessApiResult(dyn, func));
        }
コード例 #29
0
        public static CategoryGroupsWrapper Load(dynamic dyn)
        {
            Func <dynamic, CategoryGroupsWrapper> func = (d) =>
            {
                var result = new CategoryGroupsWrapper();
                foreach (var c in d.category_groups)
                {
                    result.CategoryGroups.Add(CategoryGroupWithCategories.Load(c));
                }
                return(result);
            };

            return(YnabApi.ProcessApiResult(dyn, func));
        }
コード例 #30
0
        public static PayeeLocationsWrapper Load(dynamic dyn)
        {
            Func <dynamic, PayeeLocationsWrapper> func = (d) =>
            {
                var result = new PayeeLocationsWrapper();
                foreach (var l in d.payee_locations)
                {
                    result.PayeeLocations.Add(PayeeLocation.Load(l));
                }
                return(result);
            };

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