Exemplo n.º 1
0
        /// <summary>
        /// Retrieves the descendant children of specified object.
        /// </summary>
        /// <param name="service"></param>
        /// <param name="o"></param>
        /// <returns></returns>
        public static IEnumerable <T> GetDescendants <T>(this IHierarchyService <T> service, T o)
        {
            ThrowIfInvalidArgs(service, o);

            var stack = new Stack <T>(service.GetChildren(o).Reverse());

            return(GetDescendantsAndSelf(service, stack));
        }
Exemplo n.º 2
0
 public LoginController(IUserService userService, IEmailMailService emailMailService,
                        IMenuService menuService, IHierarchyService hierarchyService)
 {
     _userService      = userService;
     _emailMailService = emailMailService;
     _menuService      = menuService;
     _hierarchyService = hierarchyService;
 }
Exemplo n.º 3
0
 public UserController(IUserService userService, IProfileService ProfileService,
                       IHierarchyService hierarchyService, IEmailMailService emailMailService, Pagination pagination)
 {
     _userService      = userService;
     _ProfileService   = ProfileService;
     _hierarchyService = hierarchyService;
     _emailMailService = emailMailService;
     _pagination       = pagination;
 }
Exemplo n.º 4
0
        /// <summary>
        /// Returns a collection of objects that contain the specified object and all descendant objects.
        /// </summary>
        /// <param name="service"></param>
        /// <param name="o"></param>
        /// <returns></returns>
        public static IEnumerable <T> GetDescendantsAndSelf <T>(this IHierarchyService <T> service, T o)
        {
            ThrowIfInvalidArgs(service, o);

            var stack = new Stack <T>();

            stack.Push(o);
            return(GetDescendantsAndSelf(service, stack));
        }
Exemplo n.º 5
0
 private static void ThrowIfInvalidArgs <T>(IHierarchyService <T> service, T o)
 {
     if (service == null)
     {
         throw new ArgumentNullException(nameof(service));
     }
     if (o == null)
     {
         throw new ArgumentNullException(nameof(o));
     }
 }
Exemplo n.º 6
0
        /// <summary>
        /// Returns a collection of the siblings after specified object.
        /// </summary>
        /// <param name="service"></param>
        /// <param name="o"></param>
        /// <returns></returns>
        public static IEnumerable <T> GetObjectsAfterSelf <T>(this IHierarchyService <T> service, T o) where T : class
        {
            ThrowIfInvalidArgs(service, o);

            var parent = service.GetParent(o);

            if (parent != null)
            {
                return(service.GetChildren(parent).SkipWhile(c => c != o).Skip(1));
            }
            return(Enumerable.Empty <T>());
        }
Exemplo n.º 7
0
 public ScenarioController(IHierarchyService hierarchyService,
                           IScenarioWebService scenarioWebService,
                           IRecommendationProductService recommendationProductService,
                           IFileUploadService fileUploadService,
                           IOrganisationDataProvider organisationDataProvider)
 {
     _hierarchyService             = hierarchyService;
     _scenarioWebService           = scenarioWebService;
     _recommendationProductService = recommendationProductService;
     _fileUploadService            = fileUploadService;
     _organisationDataProvider     = organisationDataProvider;
 }
Exemplo n.º 8
0
        private static IEnumerable <T> GetDescendantsAndSelf <T>(this IHierarchyService <T> service, Stack <T> stack)
        {
            while (stack.Count > 0)
            {
                var o = stack.Pop();
                yield return(o);

                foreach (var child in service.GetChildren(o).Reverse())
                {
                    stack.Push(child);
                }
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// Returns a collection of ancestors of specified object.
        /// </summary>
        /// <param name="service"></param>
        /// <param name="o"></param>
        /// <returns></returns>
        public static IEnumerable <T> GetAncestors <T>(this IHierarchyService <T> service, T o)
        {
            ThrowIfInvalidArgs(service, o);

            while (true)
            {
                o = service.GetParent(o);
                if (o != null)
                {
                    yield return(o);
                }
                else
                {
                    break;
                }
            }
        }
Exemplo n.º 10
0
 public HoursWorkedController(ILDAPService ldapService, IHierarchyService hierarchyService)
 {
     _hierarchyService = hierarchyService;
     _ldapService = ldapService;
 }
Exemplo n.º 11
0
 public HoursWorkedController(ILDAPService ldapService, IHierarchyService hierarchyService)
 {
     _hierarchyService = hierarchyService;
     _ldapService      = ldapService;
 }
Exemplo n.º 12
0
 public HierarchyController(ILogger <HierarchyController> logger, IHierarchyService hierarchyService, IDbLoggerService dbLoggerService)
 {
     _logger           = logger;
     _hierarchyService = hierarchyService;
     _dbLoggerService  = dbLoggerService;
 }
Exemplo n.º 13
0
        /// <summary>
        /// Determines whether the object has grandchildren.
        /// </summary>
        /// <param name="service"></param>
        /// <param name="o"></param>
        /// <returns></returns>
        public static bool HasGrandchildren <T>(this IHierarchyService <T> service, T o)
        {
            ThrowIfInvalidArgs(service, o);

            return(service.GetChildren(o).Any(c => !service.IsLeaf(c)));
        }
Exemplo n.º 14
0
        /// <summary>
        /// Determines whether the object is a leaf object, meaning it has no children.
        /// </summary>
        /// <param name="service"></param>
        /// <param name="o"></param>
        /// <returns></returns>
        public static bool IsLeaf <T>(this IHierarchyService <T> service, T o)
        {
            ThrowIfInvalidArgs(service, o);

            return(!service.GetChildren(o).Any());
        }
Exemplo n.º 15
0
 public SafetyIncidentController(ILDAPService ldapService, IEmailService emailService, IHierarchyService hierarchyService)
 {
     _ldapService = ldapService;
     _emailService = emailService;
     _hierarchyService = hierarchyService;
 }
Exemplo n.º 16
0
 public SafetyIncidentController(ILDAPService ldapService, IEmailService emailService, IHierarchyService hierarchyService)
 {
     _ldapService      = ldapService;
     _emailService     = emailService;
     _hierarchyService = hierarchyService;
 }
Exemplo n.º 17
0
 public HomeController(IHierarchyService hierarchyService,
                       ILogger <HomeController> logger)
 {
     this.hierarchyService = hierarchyService;
     this.logger           = logger;
 }
Exemplo n.º 18
0
 public HierarchyController(IHierarchyService hierarchyService)
 {
     _hierarchyService = hierarchyService;
 }
Exemplo n.º 19
0
 public VideoController(ISecurityService securityService, IHierarchyService hierarchyService)
 {
     _securityService  = securityService;
     _hierarchyService = hierarchyService;
 }
Exemplo n.º 20
0
 public VideoController(ISecurityService securityService, IHierarchyService hierarchyService)
 {
     _securityService = securityService;
     _hierarchyService = hierarchyService;
 }
Exemplo n.º 21
0
        /// <summary>
        /// Determines whether specified object is the root object.
        /// </summary>
        /// <param name="service"></param>
        /// <param name="o"></param>
        /// <returns></returns>
        public static bool IsRoot <T>(this IHierarchyService <T> service, T o)
        {
            ThrowIfInvalidArgs(service, o);

            return(service.GetParent(o) == null);
        }
Exemplo n.º 22
0
 public HomeController(IHierarchyService hierarchyService,
                       IErrorLogService errorLogService)
 {
     this.hierarchyService = hierarchyService;
     this.errorLogService  = errorLogService;
 }
Exemplo n.º 23
0
 public HierarchyController(IHierarchyService hierarchyService, IDictionaryAllService dictionaryAllService)
 {
     _hierarchyService     = hierarchyService;
     _dictionaryAllService = dictionaryAllService;
 }