public void AddEmployee(EmployeeNode employee)
        {
            if (employee == null)

            {
                throw new ArgumentNullException(

                          "Cannot insert null value!");
            }



            if (employee.hasManager)

            {
                throw new ArgumentException(

                          "The Employee already has a Manager!");
            }



            employee.hasManager = true;

            this.juniors.Add(employee);
        }
        private long JuniorsSalarys(EmployeeNode root, string managerId)
        {
            EmployeeNode child       = root;
            bool         isRightNode = child.EmployeeId.Equals(managerId);


            if (isRightNode)
            {
                amount      = root.Salary;
                amount     += Salarys(root);
                amount     += root.juniors.Sum(t => t.Salary);
                isRightNode = false;
                return(amount);
            }
            else
            {
                foreach (var item in root.juniors)
                {
                    if (isRightNode)
                    {
                        break;
                    }
                    JuniorsSalarys(item, managerId);
                }
            }


            return(amount);
        }
 private long Salarys(EmployeeNode root)
 {
     foreach (var item in root.juniors)
     {
         amount += item.Salary;
     }
     return(amount);
 }
 public EmployeeHierarchy(int salary, string Id, string Manager)
 {
     boss = new EmployeeNode(salary, Id, Manager);
 }