-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathAttributeDefinition.cs
343 lines (316 loc) · 13.4 KB
/
AttributeDefinition.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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
//Copyright (c) 2004-2007
//by Engage Software ( http://www.engagesoftware.com )
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
//TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
//THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
//CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
//DEALINGS IN THE SOFTWARE.
using DotNetNuke.UI;
using DotNetNuke.UI.WebControls;
using DotNetNuke.Entities.Modules;
using System.Xml.Serialization;
using System.ComponentModel;
using DotNetNuke.Entities.Users;
using DotNetNuke.Common.Utilities;
namespace Engage.Dnn.Locator
{
/// <summary>
/// The AttributeDefinition class provides a Business Layer entity for
/// property Definitions
/// </summary>
/// -----------------------------------------------------------------------------
[XmlRoot("attributedefinition", IsNullable = false)]
public class AttributeDefinition
{
#region Properties
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private int _dataType = Null.NullInteger;
[Editor("DotNetNuke.UI.WebControls.DNNListEditControl, DotNetNuke", typeof(DotNetNuke.UI.WebControls.EditControl)), List("DataType", "", ListBoundField.Id, ListBoundField.Value), IsReadOnly(true), Required(true), SortOrder(1)]
[XmlIgnore()]
public int DataType
{
[System.Diagnostics.DebuggerStepThroughAttribute()]
get { return _dataType; }
set
{
if (_dataType != value)
_isDirty = true;
_dataType = value;
}
}
/// -----------------------------------------------------------------------------
/// <summary>
/// Gets and sets the Default Value of the Profile Property
/// </summary>
/// -----------------------------------------------------------------------------
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private string _defaultValue;
[SortOrder(4)]
[XmlIgnore()]
public string DefaultValue
{
[System.Diagnostics.DebuggerStepThroughAttribute()]
get { return _defaultValue; }
set
{
if (_defaultValue != value)
_isDirty = true;
_defaultValue = value;
}
}
/// -----------------------------------------------------------------------------
/// <summary>
/// Gets whether the Definition has been modified since it has been retrieved
/// </summary>
/// -----------------------------------------------------------------------------
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private bool _isDirty;
[Browsable(false)]
[XmlIgnore()]
public bool IsDirty
{
[System.Diagnostics.DebuggerStepThroughAttribute()]
get { return _isDirty; }
}
/// -----------------------------------------------------------------------------
/// <summary>
/// Gets and sets the Length of the Profile Property
/// </summary>
/// -----------------------------------------------------------------------------
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private int _length;
[SortOrder(3)]
[XmlElement("length")]
public int Length
{
[System.Diagnostics.DebuggerStepThroughAttribute()]
get { return _length; }
set
{
if (_length != value)
_isDirty = true;
_length = value;
}
}
/// -----------------------------------------------------------------------------
/// <summary>
/// Gets and sets the LocationTypeId
/// </summary>
/// -----------------------------------------------------------------------------
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private int _locationTypeId = Null.NullInteger;
[Browsable(false)]
[XmlIgnore()]
public int LocationTypeId
{
[System.Diagnostics.DebuggerStepThroughAttribute()]
get { return _locationTypeId; }
[System.Diagnostics.DebuggerStepThroughAttribute()]
set { _locationTypeId = value; }
}
/// -----------------------------------------------------------------------------
/// <summary>
/// Gets and sets the PortalId
/// </summary>
/// -----------------------------------------------------------------------------
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private int _portalId;
[Browsable(false)]
[XmlIgnore()]
public int PortalId
{
[System.Diagnostics.DebuggerStepThroughAttribute()]
get { return _portalId; }
[System.Diagnostics.DebuggerStepThroughAttribute()]
set { _portalId = value; }
}
/// -----------------------------------------------------------------------------
/// <summary>
/// Gets and sets the Id of the LocationAttributeDefinition
/// </summary>
/// -----------------------------------------------------------------------------
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private int _attributeDefinitionId = Null.NullInteger;
[Browsable(false)]
[XmlIgnore()]
public int AttributeDefinitionId
{
[System.Diagnostics.DebuggerStepThroughAttribute()]
get { return _attributeDefinitionId; }
[System.Diagnostics.DebuggerStepThroughAttribute()]
set { _attributeDefinitionId = value; }
}
/// -----------------------------------------------------------------------------
/// <summary>
/// Gets and sets the Name of the Profile Property
/// </summary>
/// -----------------------------------------------------------------------------
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private string _name;
[Required(true), IsReadOnly(true), SortOrder(0), RegularExpressionValidator("^[a-zA-Z0-9._%\\-+']+$")]
[XmlElement("attributename")]
public string AttributeName
{
[System.Diagnostics.DebuggerStepThroughAttribute()]
get { return _name; }
set
{
if (_name != value)
_isDirty = true;
_name = value;
}
}
/// -----------------------------------------------------------------------------
/// <summary>
/// Gets and sets the Value of the Profile Property
/// </summary>
/// -----------------------------------------------------------------------------
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private string _value;
[Browsable(false)]
[XmlIgnore()]
public string AttributeValue
{
[System.Diagnostics.DebuggerStepThroughAttribute()]
get { return _value; }
set
{
if (_value != value)
_isDirty = true;
_value = value;
}
}
/// -----------------------------------------------------------------------------
/// <summary>
/// Gets and sets whether the property is required
/// </summary>
/// -----------------------------------------------------------------------------
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private bool _required;
[SortOrder(6)]
[XmlIgnore()]
public bool Required
{
[System.Diagnostics.DebuggerStepThroughAttribute()]
get { return _required; }
set
{
if (_required != value)
_isDirty = true;
_required = value;
}
}
/// -----------------------------------------------------------------------------
/// <summary>
/// Gets and sets a Validation Expression (RegEx) for the Profile Property
/// </summary>
/// -----------------------------------------------------------------------------
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private string _validationExpression;
[SortOrder(5)]
[XmlIgnore()]
public string ValidationExpression
{
[System.Diagnostics.DebuggerStepThroughAttribute()]
get { return _validationExpression; }
set
{
if (_validationExpression != value)
_isDirty = true;
_validationExpression = value;
}
}
/// -----------------------------------------------------------------------------
/// <summary>
/// Gets and sets the View Order of the Property
/// </summary>
/// -----------------------------------------------------------------------------
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private int _viewOrder;
[Required(true), SortOrder(8)]
[XmlIgnore()]
public int ViewOrder
{
[System.Diagnostics.DebuggerStepThroughAttribute()]
get { return _viewOrder; }
set
{
if (_viewOrder != value)
_isDirty = true;
_viewOrder = value;
}
}
/// -----------------------------------------------------------------------------
/// <summary>
/// Gets and sets whether the property is visible
/// </summary>
/// -----------------------------------------------------------------------------
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private bool _visible;
[SortOrder(7)]
[XmlIgnore()]
public bool Visible
{
[System.Diagnostics.DebuggerStepThroughAttribute()]
get { return _visible; }
set
{
if (_visible != value)
_isDirty = true;
_visible = value;
}
}
/// -----------------------------------------------------------------------------
/// <summary>
/// Gets and sets whether the property is visible
/// </summary>
/// -----------------------------------------------------------------------------
[System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.Never)]
private UserVisibilityMode _visibility = UserVisibilityMode.AdminOnly;
[Browsable(false)]
[XmlIgnore()]
public UserVisibilityMode Visibility
{
[System.Diagnostics.DebuggerStepThroughAttribute()]
get { return _visibility; }
set
{
if (_visibility != value)
_isDirty = true;
_visibility = value;
}
}
#endregion
#region Methods
/// -----------------------------------------------------------------------------
/// <summary>
/// Clears the IsDirty Flag
/// </summary>
/// -----------------------------------------------------------------------------
public void ClearIsDirty()
{
_isDirty = false;
}
public AttributeDefinition Clone()
{
AttributeDefinition objClone = new AttributeDefinition();
objClone.DataType = this.DataType;
objClone.DefaultValue = this.DefaultValue;
objClone.Length = this.Length;
objClone.LocationTypeId = this.LocationTypeId;
objClone.PortalId = this.PortalId;
//objClone.AttributeCategory = this.AttributeCategory;
objClone.AttributeDefinitionId = this.AttributeDefinitionId;
objClone.AttributeName = this.AttributeName;
objClone.AttributeValue = this.AttributeValue;
objClone.Required = this.Required;
objClone.ValidationExpression = this.ValidationExpression;
objClone.ViewOrder = this.ViewOrder;
objClone.Visibility = this.Visibility;
objClone.Visible = this.Visible;
objClone.ClearIsDirty();
return objClone;
}
#endregion
}
}