Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections.Generic;
- namespace TaskKernel.DomainModel
- {
- //public class Roles
- //{
- // public IList<RoleEnum> roles { get; protected set; }
- // // public IList<Role>
- //}
- public class Account : AbstractEntity//, IEquatable<Account>
- {
- // protected readonly IList<Roles> roles;
- public virtual string Login { get; protected set; }
- public virtual Account Manager { get; protected set; }
- public virtual string Phone { get; protected set; }
- public virtual string Mail { get; protected set; }
- public virtual string FullName { get; protected set; }
- public virtual string DepartmentName { get; protected set; }
- public virtual string JobTitle { get; protected set; }
- public virtual IList<Account> Managers { get; protected set; }
- protected Account()
- {
- Managers = new List<Account>();
- }
- public Account(string login)
- : this()
- {
- Login = login;
- //AddRole(Roles);
- }
- public virtual bool AddManager(Account account)
- {
- if (!Managers.Contains(account))
- {
- Managers.Add(account);
- return true;
- }
- return false;
- }
- public virtual bool RemoveManager(Account account)
- {
- return Managers.Remove(account);
- }
- //public IEnumerable<Roles> Roles
- //{
- // get { return roles; }
- //}
- //public void AddRole(RoleEnum role)
- //{
- // //if (roles.Contains(role))
- // // return;
- // //roles.Add(role);
- //}
- // private readonly List<Role> roles;
- //protected User()
- //{
- // roles = new List<Role>();
- //}
- //public User(string name) : this()
- //{
- // Name = name;
- //}
- //public int Id { get; set; }
- //public string Name { get; private set; }
- //public IEnumerable<Role> Roles
- //{
- // get { return roles; }
- //}
- //public void AddRole(Role role)
- //{
- // roles.Add(role);
- //}
- public override int GetHashCode()
- {
- int hashCode = 0;
- hashCode = hashCode ^ Login.GetHashCode();
- return hashCode;
- }
- public override bool Equals(object obj)
- {
- var toCompare = obj as Account;
- if (toCompare == null)
- {
- return false;
- }
- return (this.GetHashCode() == toCompare.GetHashCode());
- }
- //public virtual bool Equals(Account other)
- //{ return (this.Login== other.Login); }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement