This repository has been archived by the owner on Oct 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Person.cs
208 lines (189 loc) · 4.43 KB
/
Person.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
using System;
using DevExpress.Xpo;
using System.Drawing;
using System.IO;
using System.Drawing.Imaging;
namespace Contacts.Data
{
public class Person : XPObject
{
public Person()
: base()
{
// This constructor is used when an object is loaded from a persistent storage.
// Do not place any code here.
}
public Person(Session session)
: base(session)
{
// This constructor is used when an object is loaded from a persistent storage.
// Do not place any code here.
}
public override void AfterConstruction()
{
base.AfterConstruction();
// Place here your initialization code.
}
private string _Greeting;
public string Greeting
{
get
{
return _Greeting;
}
set
{
SetPropertyValue("Greeting", ref _Greeting, value);
}
}
[DisplayName("First Name")]
private string _FirstName;
public string FirstName
{
get
{
return _FirstName;
}
set
{
SetPropertyValue("FirstName", ref _FirstName, value);
}
}
[DisplayName("Last Name")]
private string _LastName;
public string LastName
{
get
{
return _LastName;
}
set
{
SetPropertyValue("LastName", ref _LastName, value);
}
}
private string _Address;
public string Address
{
get
{
return _Address;
}
set
{
SetPropertyValue("Address", ref _Address, value);
}
}
private string _City;
public string City
{
get
{
return _City;
}
set
{
SetPropertyValue("City", ref _City, value);
}
}
private string _State;
public string State
{
get
{
return _State;
}
set
{
SetPropertyValue("State", ref _State, value);
}
}
private int _Zip;
public int Zip
{
get
{
return _Zip;
}
set
{
SetPropertyValue("Zip", ref _Zip, value);
}
}
private byte[] _Picture;
public byte[] Picture
{
get
{
return _Picture;
}
set
{
SetPropertyValue("Picture", ref _Picture, value);
}
}
[NonPersistent]
public Image Image
{
get
{
if (Picture == null || Picture.Length == 0)
return null;
else
return Image.FromStream(new MemoryStream(Picture));
}
set
{
using (MemoryStream m = new MemoryStream())
{
value.Save(m, ImageFormat.Png);
_Picture = m.ToArray();
}
}
}
private string _Notes;
public string Notes
{
get
{
return _Notes;
}
set
{
SetPropertyValue("Notes", ref _Notes, value);
}
}
private DateTime _Added;
public DateTime Added
{
get
{
return _Added;
}
set
{
SetPropertyValue("Added", ref _Added, value);
}
}
private DateTime _Modified;
public DateTime Modified
{
get
{
return _Modified;
}
set
{
SetPropertyValue("Modified", ref _Modified, value);
}
}
[Association("PersonCategory")]
public XPCollection<Category> Categories
{
get
{
return GetCollection<Category>("Categories");
}
}
}
}