Exemplo n.º 1
0
        public FilterManagerFromChildProvider(CatalogueRepository repository, ICoreChildProvider childProvider) : base(repository)
        {
            _containersToFilters = new From1ToM <IContainer, IFilter>(f => f.FilterContainer_ID.Value, childProvider.AllAggregateFilters.Where(f => f.FilterContainer_ID.HasValue));

            var server = repository.DiscoveredServer;

            using (var con = repository.GetConnection())
            {
                var r = server.GetCommand("SELECT [AggregateFilterContainer_ParentID],[AggregateFilterContainer_ChildID]  FROM [AggregateFilterSubContainer]", con).ExecuteReader();
                while (r.Read())
                {
                    var parentId       = Convert.ToInt32(r["AggregateFilterContainer_ParentID"]);
                    var subcontainerId = Convert.ToInt32(r["AggregateFilterContainer_ChildID"]);

                    if (!_subcontainers.ContainsKey(parentId))
                    {
                        _subcontainers.Add(parentId, new List <AggregateFilterContainer>());
                    }

                    _subcontainers[parentId].Add(childProvider.AllAggregateContainersDictionary[subcontainerId]);
                }
                r.Close();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Fetches all containers and filters out of the <paramref name="repository"/> and sets the class up to provide
        /// fast access to them.
        /// </summary>
        /// <param name="repository"></param>
        /// <param name="childProvider"></param>
        public DataExportFilterManagerFromChildProvider(DataExportRepository repository, DataExportChildProvider childProvider) : base(repository)
        {
            _containersToFilters = new From1ToM <IContainer, IFilter>(f => f.FilterContainer_ID.Value, childProvider.AllDeployedExtractionFilters.Where(f => f.FilterContainer_ID.HasValue));

            var server = repository.DiscoveredServer;

            using (var con = repository.GetConnection())
            {
                var r = server.GetCommand("SELECT *  FROM FilterContainerSubcontainers", con).ExecuteReader();
                while (r.Read())
                {
                    var parentId       = Convert.ToInt32(r["FilterContainer_ParentID"]);
                    var subcontainerId = Convert.ToInt32(r["FilterContainerChildID"]);

                    if (!_subcontainers.ContainsKey(parentId))
                    {
                        _subcontainers.Add(parentId, new List <FilterContainer>());
                    }

                    _subcontainers[parentId].Add(childProvider.AllContainers[subcontainerId]);
                }
                r.Close();
            }
        }