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 using Castle
.Components
.Validator
;
17 namespace Common
.Models
21 using Castle
.ActiveRecord
;
22 using Iesi
.Collections
;
24 [ActiveRecord("TSAS_Account")]
25 public class Account
: ActiveRecordValidationBase
30 private String password
;
31 private String confirmationpassword
;
32 private ProductLicense productLicense
;
33 private ISet permissions
;
46 [Property
, ValidateNonEmpty
]
53 [Property
, ValidateNonEmpty
, ValidateEmail
]
57 set { email = value; }
60 [Property
, ValidateNonEmpty
, ValidateSameAs("ConfirmationPassword")]
61 public string Password
63 get { return password; }
64 set { password = value; }
68 public string ConfirmationPassword
70 get { return confirmationpassword; }
71 set { confirmationpassword = value; }
74 [BelongsTo("license_id")]
75 public ProductLicense ProductLicense
77 get { return productLicense; }
78 set { productLicense = value; }
81 [HasAndBelongsToMany( typeof(AccountPermission
), Table
="AccountAccountPermission",
82 ColumnRef
="permission_id", ColumnKey
="account_id", Inverse
=false)]
83 public ISet Permissions
85 get { return permissions; }
86 set { permissions = value; }
89 public override string ToString()
94 public static Account
[] FindAll()
96 return (Account
[]) ActiveRecordBase
.FindAll(typeof(Account
));