Example #1
0
        /// <summary>
        /// Virtuelen metod GetChildren preku koj
        /// se polni lista od jazli na dinamickoto drvo pri sto
        /// se zapazuvaat relaciite pomegu korisnicite
        /// </summary>
        /// <param name="userId"></param>
        /// <returns>numerirana lista od jazli (IEnumerable(INBOTreeNode))</returns>
        public virtual IEnumerable <INBOTreeNode> GetChildren(int userId)
        {
            List <INBOTreeNode> result = new List <INBOTreeNode>();

            foreach (UsersParentship parentship in UsersParentship.GetChildren(this.ID))
            {
                User u = User.Get(parentship.ChildID);
                if (this.Role.Name == RolesInfo.SIMTAdmin && u.Role.Name == RolesInfo.BROKERAdmin)
                {
                    result.Add(u);
                }
                if (this.Role.Name == RolesInfo.BROKERAdmin && u.Role.Name == RolesInfo.Broker)
                {
                    result.Add(u);
                }
                if (this.Role.Name == RolesInfo.SIMTAdmin && u.Role.Name == RolesInfo.Broker)
                {
                    result.Add(u);
                }
                if (this.Role.Name == RolesInfo.SIMTAdmin && u.Role.Name == RolesInfo.SEAdmin)
                {
                    result.Add(u);
                }
                if (this.Role.Name == RolesInfo.SEAdmin && u.Role.Name == RolesInfo.Broker)
                {
                    result.Add(u);
                }
            }
            return(result);
        }
Example #2
0
        /// <summary>
        /// Metod so koj se vrsi override na funkcijata GetChildren
        /// i se polni lista od jazli na dinamickoto drvo pri sto
        /// se zapazuvaat relaciite pomegu korisnicite
        /// </summary>
        /// <param name="userId"></param>
        /// <returns>numerirana lista od jazli (IEnumerable(INBOTreeNode))</returns>
        public override IEnumerable <INBOTreeNode> GetChildren(int userId)
        {
            List <INBOTreeNode> result = new List <INBOTreeNode>();

            foreach (UsersParentship parentship in UsersParentship.GetChildren(this.ID))
            {
                User         user = (User)base.GetById(parentship.ChildID);
                OrdinaryUser u    = new OrdinaryUser(user);

                if (this.Role.Name == RolesInfo.SIMTAdmin && u.Role.Name == RolesInfo.BROKERAdmin)
                {
                    result.Add(u);
                }

                if (this.Role.Name == RolesInfo.SIMTAdmin && u.Role.Name == RolesInfo.Broker)
                {
                    result.Add(u);
                }

                if (this.Role.Name == RolesInfo.SIMTAdmin && u.Role.Name == RolesInfo.SEAdmin)
                {
                    result.Add(u);
                }

                if (this.Role.Name == RolesInfo.SEAdmin && u.Role.Name == RolesInfo.Broker)
                {
                    result.Add(u);
                }

                if (this.Role.Name == RolesInfo.BROKERAdmin && u.Role.Name == RolesInfo.Broker)
                {
                    result.Add(u);
                }
            }
            return(result);
        }
Example #3
0
 /// <summary>
 /// Metod koj vraka vrednost vistina
 /// dokolku specificiraniot korisnik ima deca
 /// </summary>
 /// <param name="userId"></param>
 /// <returns>bool</returns>
 public bool HasChildren(int userId)
 {
     return(UsersParentship.HasChildren(this.ID));
 }