product.cs

来自「很好的技术」· CS 代码 · 共 122 行

CS
122
字号
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

/// <summary>
/// Summary description for Product
/// </summary>
public class ProductEntity
{
    CodeList list = new CodeList();
    public ProductEntity()
	{
		//
		// TODO: Add constructor logic here
		//
      
	}
    private string _ProductCode;

    public string ProductCode
    {
        get { return _ProductCode; }
        set { _ProductCode = value; }
    }

    private string _ProductName;

    public string ProductName
    {
        get { return _ProductName; }
        set { _ProductName = value; }
    }

    private string _UnitCode;

    public string UnitCode
    {
        get {

            return list.Unit[_UnitCode]; 
        }
        set {
            _UnitCode = value;
            foreach (KeyValuePair<string, string> p in list.Unit)
            {
                if (p.Value == _UnitCode)
                    _UnitCode= p.Key;
            }
            //_UnitCode= "";
        }
    }

    private string _CountryCode;

    public string CountryCode
    {
        get { return _CountryCode; }
        set { _CountryCode = value; }
    }

    private string _CurrCode;

    public string CurrCode
    {
        get { return _CurrCode; }
        set { _CurrCode = value; }
    }

    private System.Nullable<decimal> _Qty;

    public System.Nullable<decimal> Qty
    {
        get { return _Qty; }
        set { _Qty = value; }
    }

    private System.Nullable<decimal> _Price;

    public System.Nullable<decimal> Price
    {
        get { return _Price; }
        set { _Price = value; }
    }
}

public class CodeList
{
    Dictionary<string, string> curr = new Dictionary<string, string>();
    Dictionary<string, string> unit = new Dictionary<string, string>();
    Dictionary<string, string> contry = new Dictionary<string, string>();
    public CodeList()
    {
        curr.Add("1","人民币");
        curr.Add("2", "美元");
        unit.Add("1", "千克");
        unit.Add("2", "个");
        contry.Add("1", "中国");
        contry.Add("2", "美国");
    }
    public Dictionary<string, string> Curr
    {
        get {
            return curr;
        }
    }
    public Dictionary<string, string> Unit
    {
        get
        {
            return unit;
        }
    }
    public Dictionary<string, string> Contry
    {
        get
        {
            return contry;
        }
    }
}

⌨️ 快捷键说明

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