Пример #1
0
        public ItemControl[] GetPageBooks(int pageNum, int pageBookNum)
        {
            Book[] books = DBInteraction.GetPageBooks(pageBookNum, pageNum);

            ItemControl[] bookControls = new ItemControl[books.Length];

            for (int i = 0; i < books.Length; i++)
            {
                ItemControl bookControl = new ItemControl(ShowType.Book);
                bookControl.Book = books[i];
                bookControls[i] = bookControl;
            }

            return bookControls;
        }
        public ItemControl[] GetSubCategories(Category parentCategory)
        {
            Category[] categories = DBInteraction.GetSubCategories(parentCategory);
            ItemControl[] categoryControls = new ItemControl[categories.Length + parentCategory.Books.Length];

            for (int i = 0; i < categories.Length; i++)
            {
                ItemControl bookControl = new ItemControl(ShowType.Category);

                bookControl.Category = categories[i];

                categoryControls[i] = bookControl;
            }
            for (int j = 0; j < parentCategory.Books.Length; j++)
            {
                ItemControl bookControl = new ItemControl(ShowType.Book);
                bookControl.Book = parentCategory.Books[j];
                categoryControls[categories.Length + j] = bookControl;
            }

            return categoryControls;
        }