⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 product.cs

📁 进存销系统..适合书店的进销存..功能可以满足一般的需求.很简单
💻 CS
字号:
using System;
using System.Collections.Generic;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using BookStore.DataAccess;

namespace BookStore.BusinessRule
{
    class Product
    {
        private int proID=0;
        private string proName=null;
        private int categoryID;
        private int detailCategoryID;
        private int supplierID;
        private decimal unitCost=0;
        private decimal unitPrice=0;
        private int units;
        private int disContinued=0;
        private string description=null;
        private string fomat=null;

        #region 类的属性代码
        public int ProID
        {
            get { return proID; }
            set { proID = value; }
        }
        public string ProName
        {
            get { return proName; }
            set { proName = value; }
        }
        public int CategoryID
        {
            get { return categoryID; }
            set { categoryID = value; }
        }
        public int DetailCategoryID
        {
            get { return detailCategoryID;}
            set {detailCategoryID=value;}
        }
        public int SupplierID
        {
            get { return supplierID; }
            set { supplierID = value; }
        }
        public decimal UnitCost
        {
            get { return unitCost; }
            set { unitCost = value; }
        }
        public decimal UnitPrice
        {
            get { return unitPrice; }
            set { unitPrice = value; }
        }
        public int Units
        {
            get { return units; }
            set { units = value; }
        }
        public int DisContinued
        {
            get { return disContinued; }
            set { disContinued = value; }
        }
        public string Description
        {
            get { return description; }
            set { description = value; }
        }
        public string Fomat
        {
            get { return fomat; }
            set { fomat = value; }
        }
        #endregion

        //默认构造函数
        public Product()
        { 
        
        }

        //带proID参数的函数
        public Product(int proID)
        {
            this.proID = proID;
            SqlDataReader myDR = DataAccess.Narnu.GetProInfoByProID(proID);
            myDR.Read();
            this.ProName = myDR["ProductName"].ToString();
            this.categoryID = Convert.ToInt32(myDR["CategoryID"].ToString());
            this.detailCategoryID = Convert.ToInt32(myDR["DetailCategoryID"].ToString());
            this.supplierID =Convert.ToInt32(myDR["SupplierID"].ToString());
            this.unitCost = (int)myDR["UnitCost"];
            this.unitPrice=(int)myDR["UnitPrice"];
            this.disContinued=Convert.ToInt32(myDR["DisContinued"].ToString());
            this.description = myDR["Description"].ToString();
            this.fomat = myDR["Fomat"].ToString();
        }

        //添加商品信息
        public void InsertProduct()
        {
            string select = "insert into Products (ProductID,ProductName,CategoryID,SupplierID," +
                "UnitCost,UnitPrice,Units,DisContinued,Description,Fomart,DetailCategoryID) values (" + proID + ",'" +
                this.proName + "'," + this.categoryID + "," + this.supplierID + "," + this.unitCost +
                "," + this.unitPrice + "," + this.units + "," + this.disContinued + ",'" + this.description + "','" +
                this.fomat + "'," + this.detailCategoryID + ")";
            DataAccess.Narnu.DoSqlString(select);
        }
    }
}

⌨️ 快捷键说明

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