3C数码商城——三层架构BLL层

  • Post author:
  • Post category:其他


三层中比较简单的就是BLL层,BLL层的用处将DAL传送数据进行逻辑判断分折,并进行传送正确的值,

只需要稍做引用即可。

创建与DAL,Model层相同,在DAL中写了什么方法就引用什么方法。(记得不要忘记添加引用)

ProductCategoryManager.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL;
using System.Data;

namespace BLL
{
    public class ProductCategoryManager
    {
        /// <summary>
        /// 查找
        /// </summary>
        /// <returns></returns>
        public static DataTable Select()
        {
            return ProductCategoryService.Select();
        }
    }
}

ProductManager.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL;
using Model;
using System.Data;
using System.Data.SqlClient;

namespace BLL
{
    public class ProductManager
    {
        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="name"></param>
        /// <param name="category"></param>
        /// <returns></returns>
        public static DataTable Select(string name = "", int category = 0)
        {
            return ProductService.Select(name,category);
        }
        /// <summary>
        /// 查询id
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static Product Selectid(int id)
        {
            return ProductService.Selectid(id);
        }
        /// <summary>
        /// 删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public static int Delete(int id)
        {
            return ProductService.Delete(id);
        }
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="product"></param>
        /// <returns></returns>
        public static int Update(Product product)
        {
            return ProductService.Update(product);
        }
    }
}



版权声明:本文为weixin_48673140原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。