示例#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));
        }
示例#2
0
 public LoginController(IUserService userService, IEmailMailService emailMailService,
                        IMenuService menuService, IHierarchyService hierarchyService)
 {
     _userService      = userService;
     _emailMailService = emailMailService;
     _menuService      = menuService;
     _hierarchyService = hierarchyService;
 }
示例#3
0
 public UserController(IUserService userService, IProfileService ProfileService,
                       IHierarchyService hierarchyService, IEmailMailService emailMailService, Pagination pagination)
 {
     _userService      = userService;
     _ProfileService   = ProfileService;
     _hierarchyService = hierarchyService;
     _emailMailService = emailMailService;
     _pagination       = pagination;
 }
示例#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));
        }
示例#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));
     }
 }
示例#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>());
        }
示例#7
0
 public ScenarioController(IHierarchyService hierarchyService,
                           IScenarioWebService scenarioWebService,
                           IRecommendationProductService recommendationProductService,
                           IFileUploadService fileUploadService,
                           IOrganisationDataProvider organisationDataProvider)
 {
     _hierarchyService             = hierarchyService;
     _scenarioWebService           = scenarioWebService;
     _recommendationProductService = recommendationProductService;
     _fileUploadService            = fileUploadService;
     _organisationDataProvider     = organisationDataProvider;
 }
示例#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);
                }
            }
        }
示例#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;
                }
            }
        }
示例#10
0
 public HoursWorkedController(ILDAPService ldapService, IHierarchyService hierarchyService)
 {
     _hierarchyService = hierarchyService;
     _ldapService = ldapService;
 }
示例#11
0
 public HoursWorkedController(ILDAPService ldapService, IHierarchyService hierarchyService)
 {
     _hierarchyService = hierarchyService;
     _ldapService      = ldapService;
 }
示例#12
0
 public HierarchyController(ILogger <HierarchyController> logger, IHierarchyService hierarchyService, IDbLoggerService dbLoggerService)
 {
     _logger           = logger;
     _hierarchyService = hierarchyService;
     _dbLoggerService  = dbLoggerService;
 }
示例#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)));
        }
示例#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());
        }
 public SafetyIncidentController(ILDAPService ldapService, IEmailService emailService, IHierarchyService hierarchyService)
 {
     _ldapService = ldapService;
     _emailService = emailService;
     _hierarchyService = hierarchyService;
 }
 public SafetyIncidentController(ILDAPService ldapService, IEmailService emailService, IHierarchyService hierarchyService)
 {
     _ldapService      = ldapService;
     _emailService     = emailService;
     _hierarchyService = hierarchyService;
 }
示例#17
0
 public HomeController(IHierarchyService hierarchyService,
                       ILogger <HomeController> logger)
 {
     this.hierarchyService = hierarchyService;
     this.logger           = logger;
 }
示例#18
0
 public HierarchyController(IHierarchyService hierarchyService)
 {
     _hierarchyService = hierarchyService;
 }
示例#19
0
 public VideoController(ISecurityService securityService, IHierarchyService hierarchyService)
 {
     _securityService  = securityService;
     _hierarchyService = hierarchyService;
 }
示例#20
0
 public VideoController(ISecurityService securityService, IHierarchyService hierarchyService)
 {
     _securityService = securityService;
     _hierarchyService = hierarchyService;
 }
示例#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);
        }
示例#22
0
 public HomeController(IHierarchyService hierarchyService,
                       IErrorLogService errorLogService)
 {
     this.hierarchyService = hierarchyService;
     this.errorLogService  = errorLogService;
 }
示例#23
0
 public HierarchyController(IHierarchyService hierarchyService, IDictionaryAllService dictionaryAllService)
 {
     _hierarchyService     = hierarchyService;
     _dictionaryAllService = dictionaryAllService;
 }