Thứ Sáu, 21 tháng 2, 2014

5. Tạo lớp BusinessLayer

5. Tạo lớp BusinessLayer

- Tạo thư mục BusinessLayer

- Tạo lớp thao tác dữ liệu với sách BookBLL

- File BookBLL.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BookShop.Entities;
using BookShop.DataLayer;

namespace BookShop.BusinessLayer
{
    class BookBLL
    {
        BookDAL dal = new BookDAL();
        public static List<Book> GetList()
        {
            return BookDAL.GetList();
        }

        public static List<Book> GetListByName(string keyword)
        {
            return BookDAL.GetListByName(keyword);
        }

        public bool Insert(Book bk)
        {
            return dal.Insert(bk);
        }

        public bool Update(Book bk)
        {
            return dal.Update(bk);
        }

        public bool Delete(Book bk)
        {
            return dal.Delete(bk);
        }

        public Book GetBookByID(int bookID)
        {
            return dal.GetBookByID(bookID);
        }
    }
}

- Tạo lớp thao tác dữ liệu với hóa đơn OrderDLL

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BookShop.Entities;
using BookShop.DataLayer;

namespace BookShop.BusinessLayer
{
    class OrderBLL
    {
        OrderDAL dal = new OrderDAL();
        public void InsertOrder(Order od)
        {
            dal.Insert(od);
        }

        public List<Order> GetListOrders()
        {
            return dal.GetListOrders();
        }

        public List<Order> GetListOrdersByDate(DateTime orderDate)
        {
            return dal.GetListOrderByDate(orderDate);
        }
    }
}


Không có nhận xét nào:

Đăng nhận xét