C# 简易POS零售系统架构设计源码(3)
C# 简易POS零售系统架构设计源码(3)
PosStocks.cs
C# Code:
using System;
using System.Collections.Generic;
using System.Text;
namespace CSFramework.Tech2011.PosTerminal
{
/// <summary>
/// 由收银台输入货品编号,返回Stock实体对象。
/// 这里可以从SQL Server取数。
/// </summary>
public class StockData
{
//测试用.可创建两个货品对象
public static Stock GetStock(string code)
{
code = code.ToUpper();
if (code == "Vit.C".ToUpper())
return new Stock("Vit.C", decimal.Parse("5.8"));
else if (code == "Panicilin".ToUpper())
return new Stock("Panicilin", decimal.Parse("15.20"));
else
return null;
}
// 这里可以从SQL Server取数。
public static Stock GetStockFromSQL(string code)
{
//连接SQL Server.查询记录,返回Datarow,将Datarow 转换为Stock
return null;
}
}
/// <summary>
/// 货品项目,收银台输入多少货品,注意Stock,Quantity属性
/// </summary>
public class StockItem
{
private Stock _Stock;
private int _qty;
public StockItem(Stock stock, int qty)
{
_Stock = stock;
_qty = qty;
}
public Stock Stock { get { return _Stock; } set { _Stock = value; } }
public int Quantity { get { return _qty; } set { _qty = value; } }
public override string ToString()
{
return _Stock.Name " X " _qty.ToString();
}
}
/// <summary>
/// 货品类
/// </summary>
public class Stock
{
private string _Name = string.Empty;
private decimal _Price = 0;
public Stock(string name, decimal price)
{
_Name = name;
_Price = price;
}
public string Name
{
get { return _Name; }
set { _Name = value; }
}
public decimal Price
{
get { return _Price; }
set { _Price = value; }
}
}
}
//来源:C/S框架网(www.csframework.com) QQ:1980854898
using System;
using System.Collections.Generic;
using System.Text;
namespace CSFramework.Tech2011.PosTerminal
{
/// <summary>
/// 由收银台输入货品编号,返回Stock实体对象。
/// 这里可以从SQL Server取数。
/// </summary>
public class StockData
{
//测试用.可创建两个货品对象
public static Stock GetStock(string code)
{
code = code.ToUpper();
if (code == "Vit.C".ToUpper())
return new Stock("Vit.C", decimal.Parse("5.8"));
else if (code == "Panicilin".ToUpper())
return new Stock("Panicilin", decimal.Parse("15.20"));
else
return null;
}
// 这里可以从SQL Server取数。
public static Stock GetStockFromSQL(string code)
{
//连接SQL Server.查询记录,返回Datarow,将Datarow 转换为Stock
return null;
}
}
/// <summary>
/// 货品项目,收银台输入多少货品,注意Stock,Quantity属性
/// </summary>
public class StockItem
{
private Stock _Stock;
private int _qty;
public StockItem(Stock stock, int qty)
{
_Stock = stock;
_qty = qty;
}
public Stock Stock { get { return _Stock; } set { _Stock = value; } }
public int Quantity { get { return _qty; } set { _qty = value; } }
public override string ToString()
{
return _Stock.Name " X " _qty.ToString();
}
}
/// <summary>
/// 货品类
/// </summary>
public class Stock
{
private string _Name = string.Empty;
private decimal _Price = 0;
public Stock(string name, decimal price)
{
_Name = name;
_Price = price;
}
public string Name
{
get { return _Name; }
set { _Name = value; }
}
public decimal Price
{
get { return _Price; }
set { _Price = value; }
}
}
}
//来源:C/S框架网(www.csframework.com) QQ:1980854898
版权声明:本文为开发框架文库发布内容,转载请附上原文出处连接
NewDoc C/S框架网