public static DataTableReader SelectBudget(int budget_id)
        {
            var attrValue = DB_IO.AttrValue();

            attrValue[DB_API.BudgetEnt.budget_id] = budget_id;
            return(DB_IO.SelectReader(DB_IO.DB_Interface.pr_select_budgets, attrValue));
        }
        public static DataTableReader SelectUserByEmail(string email)
        {
            var attrValue = DB_IO.AttrValue();

            attrValue[UserEnt.email] = email;
            return(DB_IO.SelectReader(DB_IO.DB_Interface.pr_select_users, attrValue));
        }
        public static DataTableReader SelectWallet(int wallet_id)
        {
            var attrValue = DB_IO.AttrValue();

            attrValue[DB_API.WalletEnt.wallet_id] = wallet_id;
            return(DB_IO.SelectReader(DB_IO.DB_Interface.pr_select_wallets, attrValue));
        }
        public static DataTableReader SelectUserMoneyAccounts(string email)
        {
            var attrValue = DB_IO.AttrValue();

            attrValue[MoneyAccountEnt.user_email] = email;
            return(DB_IO.SelectReader(DB_IO.DB_Interface.pr_select_user_money_accounts, attrValue));
        }
        // ----------------------------------------------------------------------------------------------
        // LOANS ----------------------------------------------------------------------------------------
        // ----------------------------------------------------------------------------------------------

        public static DataTableReader SelectAccountLoans(int account_id)
        {
            var attrValue = DB_IO.AttrValue();

            attrValue[CategoryEnt.account_id] = account_id;
            return(DB_IO.SelectReader(DB_IO.DB_Interface.pr_select_loans, attrValue));
        }
        // ----------------------------------------------------------------------------------------------
        // TRANSACTIONS ---------------------------------------------------------------------------------
        // ----------------------------------------------------------------------------------------------

        public static DataTableReader SelectAccountTransactions(int account_id)
        {
            var attrValue = DB_IO.AttrValue();

            attrValue[DB_API.TransactionEnt.account_id] = account_id;
            return(DB_IO.SelectReader(DB_IO.DB_Interface.pr_select_transactions, attrValue));
        }
        // ----------------------------------------------------------------------------------------------
        // STOCKS ---------------------------------------------------------------------------------------
        // ----------------------------------------------------------------------------------------------

        public static DataTableReader SelectAllAccountPurchasedStocks(int account_id)
        {
            var attrValue = DB_IO.AttrValue();

            attrValue[DB_API.StockEnt.account_id] = account_id;
            return(DB_IO.SelectReader(DB_IO.DB_Interface.pr_select_purchased_stocks, attrValue));
        }
        public static DataTableReader SelectCategory(int category_id)
        {
            var attrValue = DB_IO.AttrValue();

            attrValue[CategoryEnt.category_id] = category_id;
            return(DB_IO.SelectReader(DB_IO.DB_Interface.pr_select_categories, attrValue));
        }
        public static DataTableReader SelectMoneyAccountUsers(int account_id)
        {
            var attrValue = DB_IO.AttrValue();

            attrValue[MoneyAccountEnt.account_id] = account_id;
            return(DB_IO.SelectReader(DB_IO.DB_Interface.pr_select_user_money_accounts, attrValue));
        }
        public static DataTableReader SelectAccountGoals(int account_id)
        {
            var attrValue = DB_IO.AttrValue();

            attrValue[DB_API.GoalEnt.account_id] = account_id;
            return(DB_IO.SelectReader(DB_IO.DB_Interface.pr_select_goals, attrValue));
        }
        public static DataTableReader SelectWalletByName(int account_id, string name)
        {
            var attrValue = DB_IO.AttrValue();

            attrValue[DB_API.WalletEnt.account_id] = account_id;
            attrValue[DB_API.WalletEnt.name]       = name;
            return(DB_IO.SelectReader(DB_IO.DB_Interface.pr_select_wallets, attrValue));
        }
        public static DataTableReader SelectGoal(int account_id, string goal_name)
        {
            var attrValue = new Dictionary <System.Enum, Object>
            {
                { GoalEnt.account_id, account_id },
                { GoalEnt.name, goal_name }
            };

            return(DB_IO.SelectReader(DB_IO.DB_Interface.pr_select_goals, attrValue));
        }
        // ----------------------------------------------------------------------------------------------
        // BUDGETS --------------------------------------------------------------------------------------
        // ----------------------------------------------------------------------------------------------

        public static DataTableReader SelectUserCategoryBudgets(int account_id, int category_id)
        {
            var attrValue = new Dictionary <System.Enum, Object>
            {
                { BudgetEnt.account_id, account_id },
                { BudgetEnt.category_id, category_id }
            };

            return(DB_IO.SelectReader(DB_IO.DB_Interface.pr_select_budgets_by_category_id, attrValue));
        }
        public static DataTableReader SelectLoan(int account_id, string loan_name)
        {
            var attrValue = new Dictionary <System.Enum, Object>
            {
                { LoanEnt.account_id, account_id },
                { LoanEnt.name, loan_name }
            };

            return(DB_IO.SelectReader(DB_IO.DB_Interface.pr_select_loans, attrValue));
        }
        public static String SelectRecurrenceById(int id)
        {
            var attrValue = DB_IO.AttrValue();

            attrValue[RecurrenceEnt.periodicity] = id;
            var rdr = DB_IO.SelectReader(DB_IO.DB_Interface.pr_select_recurrences, attrValue);

            rdr.Read();
            return(rdr[RecurrenceEnt.designation.ToString()].ToString());
        }
        public static DataTableReader SelectFilteredTransactions(int?account_id    = null, int?category_id     = null,
                                                                 int?wallet_id     = null, int?transaction_id  = null, int?transaction_type_id = null, double?min_amount = null,
                                                                 double?max_amount = null, DateTime?start_date = null, DateTime?end_date       = null, string location   = null)
        {
            Console.WriteLine(account_id + ", " + category_id + ", " + wallet_id + ", " + transaction_id + ", " +
                              transaction_type_id + ", " + min_amount + ", " + max_amount + ", " + start_date + ", " + end_date + ", " +
                              location);
            var attrValue = new Dictionary <System.Enum, Object>
            {
                { DB_API.TransactionEnt.account_id, account_id },
                { DB_API.TransactionEnt.category_id, category_id },
                { DB_API.TransactionEnt.wallet_id, wallet_id },
                { DB_API.TransactionEnt.transaction_id, transaction_id },
                { DB_API.TransactionEnt.transaction_type_id, transaction_type_id },
                { DB_API.TransactionEnt.min_amount, min_amount },
                { DB_API.TransactionEnt.max_amount, max_amount },
                { DB_API.TransactionEnt.start_date, start_date },
                { DB_API.TransactionEnt.end_date, end_date },
                { DB_API.TransactionEnt.location, location }
            };

            return(DB_IO.SelectReader(DB_IO.DB_Interface.pr_select_transactions, attrValue));
        }
 public static DataTableReader SelectAllStocks()
 {
     return(DB_IO.SelectReader(DB_IO.DB_Interface.pr_select_stocks, DB_IO.AttrValue()));
 }
 public static DataTableReader SelectAllCategoryTypes()
 {
     return(DB_IO.SelectReader(DB_IO.DB_Interface.pr_select_category_types, DB_IO.AttrValue()));
 }
 public static DataTableReader SelectAllTransactionTypes()
 {
     return(DB_IO.SelectReader(DB_IO.DB_Interface.pr_select_transaction_types, DB_IO.AttrValue()));
 }
        // ----------------------------------------------------------------------------------------------
        // RECURRENCE -----------------------------------------------------------------------------------
        // ----------------------------------------------------------------------------------------------

        public static DataTableReader SelectAllRecurrences()
        {
            return(DB_IO.SelectReader(DB_IO.DB_Interface.pr_select_recurrences, DB_IO.AttrValue()));
        }