Asp.net源码专业站
首页->企业网站->中小企业网站系统前台源码(SmallBusinessStarterKit)>>App-Code/Catalog/Item.cs>>源码在线查看
温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:中小企业网站系统前台源码(SmallBusinessStarterKit)
当前文件:文件类型 SmallBusinessStarterKit/App_Code/Catalog/Item.cs[2K,2009-6-12 11:54:21]打开代码结构图
普通视图
		            
1using System; 2///<summary> 3//业务对象,表示产品。 4///</summary> 5public class Item 6{ 7 //---------------------------------------------- 8 //私有字段区,定义属性内部使用的字段 9 //---------------------------------------------- 10 private string _id; 11 private string _title; 12 private bool _visible; 13 private string _description; 14 private double _price; 15 private bool _inStock; 16 private string _imageUrl; 17 private string _imageAltText; 18 //构造函数,为实体对象指定初始参数 19 public Item(string id, 20 bool visible, 21 string title) 22 { 23 if (String.IsNullOrEmpty(id)) throw new ArgumentException(Messages.ItemIdUndefined); 24 if (String.IsNullOrEmpty(title)) throw new ArgumentException(Messages.ItemTitleUndefined); 25 _id = id; 26 _visible = visible; 27 _title = title; 28 29 } 30 //---------------------------------------------- 31 //属性定义区,为不同的实体属性定义访问方法。 32 //---------------------------------------------- 33 //主键ID 34 public string Id 35 { 36 get { return String.IsNullOrEmpty(_id) ? String.Empty : _id; } 37 } 38 //产品是否可见 39 public bool Visible 40 { 41 get { return _visible; } 42 set { _visible = value; } 43 } 44 //产品标题 45 public string Title 46 { 47 get { return String.IsNullOrEmpty(_title) ? String.Empty : _title; } 48 set 49 { if (String.IsNullOrEmpty(value)) 50 throw new InvalidOperationException(Messages.ItemTitleIsNull); 51 _title = value; 52 } 53 } 54 //产品描述 55 public string Description 56 { 57 get { return _description; } 58 set { _description = value; } 59 } 60 // 61 public double Price 62 { 63 get { return _price; } 64 set { _price = value; } 65 } 66 //产品价格 67 public bool InStock 68 { 69 get { return _inStock; } 70 set { _inStock = value; } 71 } 72 //产品图片链接 73 public string ImageUrl 74 { 75 get { return String.IsNullOrEmpty(_imageUrl) ? String.Empty : _imageUrl; } 76 set { _imageUrl = value; } 77 } 78 //产品图片显示交替文本。 79 public string ImageAltText 80 { 81 get { return String.IsNullOrEmpty(_imageAltText) ? String.Empty : _imageAltText; } 82 set { _imageAltText = value; } 83 } 84} 85
还没有找到您心仪的内容?请用.net源码大搜捕
代码片断 打包下载该项目完整源码:中小企业网站系统前台源码(SmallBusinessStarterKit)
51Aspx.com 版权所有 CopyRight © 2006-2010. 京ICP备06046876号 本站法律顾问:ITlaw-庄毅雄律师
返回顶部
客户服务:点击这里进行客户咨询 业务合作:点击这里洽谈业务合作 合作热线:010-68880146