예제 #1
0
        //public decimal CalculateAccountBalance(int accountNo)
        //{
        //    string sql = string.Format(@"
        //        select
        //            Accounts.BalanceBroughtForwardAmount +
        //         (
        //          select isnull(SUM(Amount), 0)
        //          from
        //                    AccountTransactions
        //                where AccountNo = {0}
        //         ) as BalanceAmount
        //        from Accounts
        //        where No = {0}", accountNo);

        //    return decimal.Parse(Connection.GetScalar(sql).ToString());
        //}

        public CategoryCollection GetSubCategories()
        {
            string sql = @"
                select *
                from Categories c1
                where
                    IsArchived <> 1 and
                    (
                        select count(*)
                        from Categories c2
                        where c2.ParentCategoryNo = c1.No
                    ) = 0
                order by
                    Type desc,
                    Name asc";

            CategoryTable categoryTable = new CategoryTable();

            Connection.GetTable(categoryTable, sql);
            return(CategoryCollection.CreateCategoryCollection(categoryTable));
        }