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

📄 invoiceitem.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 InvoiceItem
/// </summary>
public class InvoiceItem
{

    #region Properties

    private Product _invoiceItemProduct = new Product();

    private string _invoiceId = "";
    /// <summary>
    /// SessionId unless pulling database ID
    /// </summary>
    public string InvoiceId
    {
        get
        {
            return _invoiceId;
        }
        set
        {
            _invoiceId = value;
        }
    }

    public int ProductId
    {
        get
        {
            return _invoiceItemProduct.ProductId;
        }
        set
        {
            _invoiceItemProduct = new Product(value);
        }
    }

    public string ProductName
    {
        get
        {
            return _invoiceItemProduct.Name;
        }
    }

    private int _quantity = 0;
    public int Quantity
    {
        get
        {
            return _quantity;
        }
        set
        {
            _quantity = value;
        }
    }

    public decimal Price
    {
        get
        {
            return _invoiceItemProduct.Price * Quantity;
        }
    }

    public decimal UnitPrice
    {
        get
        {
            return _invoiceItemProduct.Price;
        }
    }

    public decimal ShippingCost
    {
        get
        {
            return _invoiceItemProduct.Shipping;
        }
    }

    public decimal HandlingCost
    {
        get
        {
            return _invoiceItemProduct.Handling;
        }
    }

    private decimal _taxRate = decimal.Parse(System.Web.Configuration.WebConfigurationManager.AppSettings["taxRate"].ToString());
    
    /// <summary>
    /// Retrieve taxes - if this is a taxable product
    /// </summary>
    public decimal Taxes
    {
        get
        {
            if (_invoiceItemProduct.Taxable)
            {
                return this.UnitPrice * (_taxRate / 100M) * this.Quantity;
            }
            else
            {
                return 0M;
            }
        }
    }

    #endregion

    public InvoiceItem()
	{
		//
		// TODO: Add constructor logic here
		//
	}

    public InvoiceItem(string invoiceId, int productId, int quantity)
    {
        this.InvoiceId = invoiceId;
        this.ProductId = productId;
        this.Quantity = quantity;
    }

    public void UpdateQuantity(int quantity)
    {
        this.Quantity = quantity;
    }

    public void AddToQuantity(int quantity)
    {
        this.Quantity += quantity;
    }
    
}

⌨️ 快捷键说明

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