Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.83 KB | None | 0 0
  1. using System.Collections.Generic;
  2.  
  3. namespace TaskKernel.DomainModel
  4. {
  5.     //public class Roles
  6.     //{
  7.     //    public IList<RoleEnum> roles { get; protected set; }
  8.     //  //  public IList<Role>
  9.     //}
  10.     public class Account : AbstractEntity//, IEquatable<Account>
  11.     {
  12.         //   protected readonly IList<Roles> roles;
  13.         public virtual string Login { get; protected set; }
  14.         public virtual Account Manager { get; protected set; }
  15.         public virtual string Phone { get; protected set; }
  16.         public virtual string Mail { get; protected set; }
  17.         public virtual string FullName { get; protected set; }
  18.         public virtual string DepartmentName { get; protected set; }
  19.         public virtual string JobTitle { get; protected set; }
  20.         public virtual IList<Account> Managers { get; protected set; }
  21.         protected Account()
  22.         {
  23.             Managers = new List<Account>();
  24.         }
  25.  
  26.         public Account(string login)
  27.             : this()
  28.         {
  29.             Login = login;
  30.             //AddRole(Roles);
  31.         }
  32.         public virtual bool AddManager(Account account)
  33.         {
  34.             if (!Managers.Contains(account))
  35.             {
  36.                 Managers.Add(account);
  37.                 return true;
  38.             }
  39.             return false;
  40.         }
  41.         public virtual bool RemoveManager(Account account)
  42.         {
  43.             return Managers.Remove(account);
  44.         }
  45.         //public  IEnumerable<Roles> Roles
  46.         //{
  47.         //    get { return roles; }
  48.         //}
  49.  
  50.  
  51.         //public  void AddRole(RoleEnum role)
  52.         //{
  53.         //    //if (roles.Contains(role))
  54.         //    //    return;
  55.  
  56.         //    //roles.Add(role);
  57.         //}
  58.  
  59.         //  private readonly List<Role> roles;
  60.  
  61.         //protected User()
  62.         //{
  63.         //    roles = new List<Role>();
  64.         //}
  65.  
  66.         //public User(string name) : this()
  67.         //{
  68.         //    Name = name;
  69.         //}
  70.  
  71.         //public int Id { get; set; }
  72.  
  73.         //public string Name { get; private set; }
  74.  
  75.         //public IEnumerable<Role> Roles
  76.         //{
  77.         //    get { return roles; }
  78.         //}
  79.  
  80.         //public void AddRole(Role role)
  81.         //{
  82.         //    roles.Add(role);
  83.         //}
  84.         public override int GetHashCode()
  85.         {
  86.             int hashCode = 0;
  87.             hashCode = hashCode ^ Login.GetHashCode();
  88.             return hashCode;
  89.         }
  90.  
  91.         public override bool Equals(object obj)
  92.         {
  93.             var toCompare = obj as Account;
  94.             if (toCompare == null)
  95.             {
  96.                 return false;
  97.             }
  98.             return (this.GetHashCode() == toCompare.GetHashCode());
  99.         }
  100.         //public virtual bool Equals(Account other)
  101.  
  102.         //{ return (this.Login== other.Login); }
  103.  
  104.     }
  105. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement