温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:中小企业网站系统前台源码(SmallBusinessStarterKit)
当前文件:
SmallBusinessStarterKit/App_Code/Testimonials/Testimonial.cs[3K,2009-6-12 11:54:21],打开代码结构图
SmallBusinessStarterKit/App_Code/Testimonials/Testimonial.cs[3K,2009-6-12 11:54:21],打开代码结构图1using System; 2
using System.Data; 3
using System.Configuration; 4
5
6
///<summary> 7
/// class Testimonial 8
/// represents a testimonial 9
///</summary> 10
public class Testimonial 11
{ 12
string _id; 13
bool _visible; 14
string _title; 15
DateTime _date; 16
string _content; 17
string _testifier; 18
string _testifierCompany; 19
string _imageUrl; 20
string _imageAltText; 21
22
23
public Testimonial( 24
string id, 25
bool visible, 26
string title, 27
DateTime date, 28
string content, 29
string testifier 30
) 31
{ 32
// exceptions thrown if reqd attributes are missing 33
// 34
if (String.IsNullOrEmpty(id)) throw new ArgumentException(Messages.TestimonialsIdUndefined); 35
if (String.IsNullOrEmpty(title)) throw new ArgumentException(Messages.TestimonialsTitleUndefined); 36
if (String.IsNullOrEmpty(content)) throw new ArgumentException(Messages.TestimonialsContentUndefined); 37
if (String.IsNullOrEmpty(testifier)) throw new ArgumentException(Messages.TestimonialsTestifierUndefined); 38
if (date.Equals(null)) throw new ArgumentException(Messages.TestimonialsDateUndefined); 39
40
_id = id; 41
_visible = visible; 42
_title = title; 43
_date = date; 44
_content = content; 45
_testifier = testifier; 46
} 47
48
public string Id 49
{ 50
get { return String.IsNullOrEmpty(_id) ? String.Empty : _id; } 51
} 52
53
54
public bool Visible 55
{ 56
get { return _visible; } 57
set { _visible = value; } 58
} 59
60
61
public string Title 62
{ 63
get { return String.IsNullOrEmpty(_title) ? String.Empty : _title; } 64
set 65
{ 66
if (String.IsNullOrEmpty(value)) 67
throw new InvalidOperationException(Messages.TitleUndefined); 68
_title = value; 69
} 70
} 71
72
73
public DateTime Date 74
{ 75
get { return _date; } 76
set { _date = value; } 77
} 78
79
public string Content 80
{ 81
get { return String.IsNullOrEmpty(_content) ? String.Empty : _content; } 82
set 83
{ 84
if (String.IsNullOrEmpty(value)) 85
throw new InvalidOperationException(Messages.ContentIsNull); 86
_content = value; 87
} 88
} 89
90
public string Testifier 91
{ 92
get { return String.IsNullOrEmpty(_testifier) ? String.Empty : _testifier; } 93
set { _testifier = value; } 94
} 95
96
public string TestifierCompany 97
{ 98
get { return String.IsNullOrEmpty(_testifierCompany) ? String.Empty : _testifierCompany; } 99
set { _testifierCompany = value; } 100
} 101
102
public string ImageUrl 103
{ 104
get { return String.IsNullOrEmpty(_imageUrl) ? String.Empty : _imageUrl; } 105
set { _imageUrl = value; } 106
} 107
108
public string ImageAltText 109
{ 110
get { return String.IsNullOrEmpty(_imageAltText) ? String.Empty : _imageAltText; } 111
set { _imageAltText = value; } 112
} 113
114
115
116
} 117








}