1 // Copyright 2004-2008 Castle Project - http://www.castleproject.org/
3 // Licensed under the Apache License, Version 2.0 (the "License");
4 // you may not use this file except in compliance with the License.
5 // You may obtain a copy of the License at
7 // http://www.apache.org/licenses/LICENSE-2.0
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
15 namespace TestSiteARSupport
.Model
18 using System
.Collections
.Generic
;
19 using Castle
.ActiveRecord
;
20 using Castle
.Components
.Validator
;
21 using Iesi
.Collections
.Generic
;
22 using ValidateEmailAttribute
=Castle
.Components
.Validator
.ValidateEmailAttribute
;
24 [ActiveRecord("TSAS_Account")]
25 public class Account
: ActiveRecordValidationBase
30 private String password
;
31 private String confirmationpassword
;
32 private ProductLicense productLicense
;
33 private ISet
<AccountPermission
> permissions
;
34 private IList
<User
> users
= new List
<User
>();
40 public Account(string name
, string email
, string password
)
44 this.password
= password
;
54 [Property
, ValidateNonEmpty
]
61 [Property
, ValidateNonEmpty
, ValidateEmail
]
65 set { email = value; }
68 [Property
, ValidateNonEmpty
]
69 public string Password
71 get { return password; }
72 set { password = value; }
75 [ValidateSameAs("Password")]
76 public string ConfirmationPassword
78 get { return confirmationpassword; }
79 set { confirmationpassword = value; }
82 [BelongsTo("license_id")]
83 public ProductLicense ProductLicense
85 get { return productLicense; }
86 set { productLicense = value; }
90 Table
="AccountAccountPermission",
91 ColumnRef
="permission_id", ColumnKey
="account_id", Inverse
=false)]
92 public ISet
<AccountPermission
> Permissions
94 get { return permissions; }
95 set { permissions = value; }
99 public IList
<User
> Users
101 get { return users; }
102 set { users = value; }
105 public override string ToString()
110 public static Account
[] FindAll()
112 return (Account
[]) FindAll(typeof(Account
));