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

📄 product.cs

📁 The purpose of this code is to assist developers get some good ideas for how to build a PayPal shop
💻 CS
字号:
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

/// <summary>
/// Summary description for Product
/// </summary>
public class Product
{
    public override string ToString()
    {
        return _name;
    }

    private int _productId = 0;
    /// <summary>
    /// The Product ID
    /// </summary>
    public int ProductId
    {
        get
        {
            return _productId;
        }
        set
        {
            _productId = value;
        }
    }

    private bool _taxable = true;
    public bool Taxable
    {
        get
        {
            return _taxable;
        }
        set
        {
            _taxable = value;
        }
    }

    private string _name = "";
    /// <summary>
    /// Product Name
    /// </summary>
    public string Name
    {
        get
        {
            return _name;
        }
        set
        {
            _name = value;
        }
    }

    private string _description = "";
    /// <summary>
    /// Product Name
    /// </summary>
    public string Description
    {
        get
        {
            return _description;
        }
        set
        {
            _description = value;
        }
    }

    private string _picture = "";
    /// <summary>
    /// Product Name
    /// </summary>
    public string Picture
    {
        get
        {
            return _picture;
        }
        set
        {
            _picture = value;
        }
    }

    private decimal _price = 0M;
    /// <summary>
    /// Price charging for product
    /// </summary>
    public decimal Price
    {
        get
        {
            return _price;
        }
        set
        {
            _price = value;
        }
    }

    private decimal _shipping = 0M;
    /// <summary>
    /// Price charging for shipping product
    /// </summary>
    public decimal Shipping
    {
        get
        {
            return _shipping;
        }
        set
        {
            _shipping = value;
        }
    }

    private decimal _handling = 0M;
    /// <summary>
    /// Price charging for handling/packing product
    /// </summary>
    public decimal Handling
    {
        get
        {
            return _handling;
        }
        set
        {
            _handling = value;
        }
    }

	public Product()
	{
		
	}

    public Product(int productId)
    {
        DataView products = new DataView(ProductsTable.Instance());
        products.Sort = "product_id";
        int idxFound = products.Find(productId);

        if (idxFound >= 0)
        {
            this.ProductId = int.Parse(products[idxFound]["product_id"].ToString());
            this.Name = products[idxFound]["name"].ToString();
            this.Description = products[idxFound]["description"].ToString();
            this.Picture = products[idxFound]["picture"].ToString();
            this.Price = decimal.Parse(products[idxFound]["price"].ToString());
            this.Shipping = decimal.Parse(products[idxFound]["shipping"].ToString());
            this.Handling = decimal.Parse(products[idxFound]["handling"].ToString());
            this.Taxable = bool.Parse(products[idxFound]["taxable"].ToString());
        }
    }
}

⌨️ 快捷键说明

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