productselectdal.cs

来自「c#三层架构项目开发的全过程」· CS 代码 · 共 37 行

CS
37
字号
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
using Model;
namespace DAL.Goods
{
    public class ProductSelectDal
    {
        #region 商品表查询
        public List<Model.Goods.ProductModel> GetProduct()
        {
            string getpro = "Product_select";
            DataSet ds = new DataSet();
            SqlHelper.FillDataSet(SqlHelper.conStr, CommandType.StoredProcedure, getpro, ds, new string[] {  }, null);
            List<Model.Goods.ProductModel> list = new List<Model.Goods.ProductModel>();
            foreach (DataRow  item in ds.Tables[0].Rows)
            {
                Model.Goods.ProductModel pro = new Model.Goods.ProductModel();
                pro.product_id = item["product_id"].ToString();
                pro.brand_id = (int)item["brand_id"];
                pro.product_saleprice = (decimal)item["product_saleprice"];
                pro.Product_costprice = (decimal)item["Product_CostPrice"];
                pro.Product_tradeprice = (decimal)item["Product_TradePrice"];
                pro.product_name = item["product_name"].ToString();
                list.Add(pro);

            }
            return list;
        }
        #endregion
    }
}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?