Example #1
0
        public void Find_FindsSubscriptionsEntityCI()
        {
            IQueue subscription = Substitute.For <IQueue, IEntity>();

            subscription.Name.Returns("sub");
            var subscriptions = new Dictionary <string, IQueue>
            {
                [subscription.Name] = subscription
            };
            ITopic topic = Substitute.For <ITopic, IEntity>();

            topic.Name.Returns("T");
            topic.Subscriptions.Returns(subscriptions);
            var topics = new Dictionary <string, ITopic>
            {
                [topic.Name] = topic
            };
            IServiceBusSimulator fakeSimulator = Substitute.For <IServiceBusSimulator>();

            fakeSimulator.Topics.Returns(topics);
            var lookup = new EntityLookup(fakeSimulator);

            lookup.Find("T/Subscriptions/sub").ShouldBeSameAs(subscription);
            lookup.Find("t/subscriptions/sub").ShouldBeSameAs(subscription);
        }
Example #2
0
        public int Run()
        {
            int total = 0;

            if (ClearCharacters)
            {
                int count = EntityLookup.PurgeRecords(EntityType.Character);
                Console.WriteLine($"{count} character record(s) purged.");
                total += count;
            }
            if (ClearCorporations)
            {
                int count = EntityLookup.PurgeRecords(EntityType.Corporation);
                Console.WriteLine($"{count} corporation record(s) purged.");
                total += count;
            }
            if (ClearAlliances)
            {
                int count = EntityLookup.PurgeRecords(EntityType.Alliance);
                Console.WriteLine($"{count} alliance record(s) purged.");
                total += count;
            }

            if (ClearMailingLists)
            {
                int count = EntityLookup.PurgeRecords(EntityType.Mailinglist);
                Console.WriteLine($"{count} mailinglist record(s) purged.");
                total += count;
            }

            Console.WriteLine($"{total} record(s) purged in total.");
            return(0);
        }
Example #3
0
        public void Find_FindsAllRegisteredEntities()
        {
            IQueue subscription = Substitute.For <IQueue, IEntity>();

            subscription.Name.Returns("bar");
            var subscriptions = new Dictionary <string, IQueue>
            {
                [subscription.Name] = subscription
            };
            ITopic topic = Substitute.For <ITopic, IEntity>();

            topic.Name.Returns("foo");
            topic.Subscriptions.Returns(subscriptions);
            var topics = new Dictionary <string, ITopic>
            {
                [topic.Name] = topic
            };
            IQueue queue = Substitute.For <IQueue, IEntity>();

            queue.Name.Returns("qux");
            var queues = new Dictionary <string, IQueue>
            {
                [queue.Name] = queue
            };
            IServiceBusSimulator fakeSimulator = Substitute.For <IServiceBusSimulator>();

            fakeSimulator.Topics.Returns(topics);
            fakeSimulator.Queues.Returns(queues);
            var lookup = new EntityLookup(fakeSimulator);

            lookup.Find("foo").ShouldBeSameAs(topic);
            lookup.Find("foo/Subscriptions/Bar").ShouldBeSameAs(subscription);
            lookup.Find("qux").ShouldBeSameAs(queue);
            lookup.Find("baz").ShouldBeNull();
        }
Example #4
0
        public void FinishLookups()
        {
            var array = mLookups.Values.ToArray();

            mLookups.Clear();
            EntityLookup.LookupIDs(array);
        }
Example #5
0
            public static void SwapEntities(EntityLookup left, EntityLookup right)
            {
                var tempEntities = left.m_entities;

                left.m_entities  = right.m_entities;
                right.m_entities = tempEntities;
            }
Example #6
0
        private void LoadProviders()
        {
            providerConcepts = new EntityLookup <Provider>(Settings.Current.Building.DestinationConnectionString, Settings.Current.Building.DestinationSchemaName);
            QueryDefinition provider = null;

            if (Settings.Current.Building.DestinationQueryDefinitions != null)
            {
                provider = Settings.Current.Building.DestinationQueryDefinitions.FirstOrDefault(qd => qd.Providers != null);
            }
            else
            {
                provider = Settings.Current.Building.CommonQueryDefinitions.FirstOrDefault(qd => qd.Providers != null);
            }

            if (provider != null)
            {
                //if (Settings.Current.Building.DestinationEngine.Database == Database.Redshift)
                //{
                //   providerConcepts.LoadFromS3(provider, provider.Providers[0], "PROVIDER.txt", new Dictionary<string, int>
                //   {
                //      {"PROVIDER_ID", 0},
                //      {"SPECIALTY_SOURCE_VALUE", 1},
                //      {"CARE_SITE_ID", 2},
                //      {"PROVIDER_SOURCE_VALUE", 3}
                //   });
                //}
                //else
                providerConcepts.Load(provider, provider.Providers[0]);
            }

            FlushProvidersToCommonVocab();
        }
Example #7
0
        public void AddEntity(IEntity entity)
        {
            EntityLookup.Add(entity.Id, entity);

            entityAdded.OnNext(new CollectionEntityEvent(entity, this));

            SubscribeToEntity(entity);
        }
Example #8
0
        public void GetEnumerator_ReturnsAllEntriesFromTopicAndSubscriptionsAndQueues([Values] bool genericEnumerator)
        {
            IQueue subscription1 = Substitute.For <IQueue, IEntity>();

            subscription1.Name.Returns("sub1");
            IQueue subscription2 = Substitute.For <IQueue, IEntity>();

            subscription2.Name.Returns("sub2");
            var subscriptions = new Dictionary <string, IQueue>
            {
                [subscription1.Name] = subscription1,
                [subscription2.Name] = subscription2
            };
            ITopic topic = Substitute.For <ITopic, IEntity>();

            topic.Name.Returns("topic");
            topic.Subscriptions.Returns(subscriptions);
            var topics = new Dictionary <string, ITopic>
            {
                [topic.Name] = topic
            };
            IQueue queue = Substitute.For <IQueue, IEntity>();

            queue.Name.Returns("que");
            var queues = new Dictionary <string, IQueue>
            {
                [queue.Name] = queue
            };
            IServiceBusSimulator fakeSimulator = Substitute.For <IServiceBusSimulator>();

            fakeSimulator.Topics.Returns(topics);
            fakeSimulator.Queues.Returns(queues);
            var lookup = new EntityLookup(fakeSimulator);
            var data   = new Dictionary <string, IEntity>();

            IEnumerator enumerator = genericEnumerator
                ? lookup.GetEnumerator()
                : ((IEnumerable)lookup).GetEnumerator();

            using (enumerator as IDisposable)
            {
                while (enumerator.MoveNext())
                {
                    (string address, IEntity entity) = ((string, IEntity))enumerator.Current;
                    data.Add(address, entity);
                }
            }

            data.ShouldSatisfyAllConditions(
                () => data.Count.ShouldBe(4),
                () => data["que"].ShouldBeSameAs(queue),
                () => data["topic"].ShouldBeSameAs(topic),
                () => data["topic/Subscriptions/sub1"].ShouldBeSameAs(subscription1),
                () => data["topic/Subscriptions/sub2"].ShouldBeSameAs(subscription2)
                );
        }
Example #9
0
 public EntityManager()
 {
     m_dispatcher        = Dispatcher.CurrentDispatcher;
     m_componentIdToType = new Dictionary <int, Type>();
     m_componentTypeToId = new Dictionary <Type, int>();
     m_displayLookup     = new EntityLookup(this);
     m_processingLookup  = new EntityLookup(this);
     m_nextEntityId      = 1;
     m_state             = State.StartingUp;
 }
Example #10
0
        private void LoadEntityLookup()
        {
            var connection       = Settings.Current.Building.SourceConnectionString;
            var queryDefinitions = Settings.Current.Building.SourceQueryDefinitions;
            var schemaName       = Settings.Current.Building.SourceSchemaName;

            locationConcepts     = new EntityLookup <Location>(connection, schemaName);
            organizationConcepts = new EntityLookup <Organization>(connection, schemaName);
            careSiteConcepts     = new EntityLookup <CareSite>(connection, schemaName);
            providerConcepts     = new EntityLookup <Provider>(connection, schemaName);

            var location = queryDefinitions.FirstOrDefault(qd => qd.Locations != null && qd.IsSuitable(qd.Query.Database, Settings.Current.Building.Vendor));

            if (location != null)
            {
                locationConcepts.Load(location, location.Locations[0]);
            }

            if (locationConcepts.Lookup.Count == 0)
            {
                locationConcepts.Lookup.Add("0", new Location {
                    Id = 1
                });
            }

            var organization = queryDefinitions.FirstOrDefault(qd => qd.Organizations != null && qd.IsSuitable(qd.Query.Database, Settings.Current.Building.Vendor));

            if (organization != null)
            {
                organizationConcepts.Load(organization, organization.Organizations[0]);
            }

            if (organizationConcepts.Lookup.Count == 0)
            {
                organizationConcepts.Lookup.Add("0",
                                                new Organization {
                    Id = 0, LocationId = 0, ConceptId = 0, SourceValue = string.Empty
                });
            }

            var careSite = queryDefinitions.FirstOrDefault(qd => qd.CareSites != null && qd.IsSuitable(qd.Query.Database, Settings.Current.Building.Vendor));

            if (careSite != null)
            {
                careSiteConcepts.Load(careSite, careSite.CareSites[0]);
            }

            if (careSiteConcepts.Lookup.Count == 0)
            {
                careSiteConcepts.Lookup.Add("0",
                                            new CareSite {
                    Id = 0, LocationId = 0, OrganizationId = 0, PlaceOfSvcSourceValue = null
                });
            }
        }
Example #11
0
        public void Dispose()
        {
            entityAdded.Dispose();
            entityRemoved.Dispose();
            entityComponentsAdded.Dispose();
            entityComponentsRemoving.Dispose();
            entityComponentsRemoved.Dispose();

            EntityLookup.Clear();
            EntitySubscriptions.RemoveAndDisposeAll();
        }
Example #12
0
        public EntityCollection(int id, IEntityFactory entityFactory)
        {
            EntityLookup        = new EntityLookup();
            EntitySubscriptions = new Dictionary <int, IDisposable>();
            Id            = id;
            EntityFactory = entityFactory;

            _onEntityAdded              = new Subject <CollectionEntityEvent>();
            _onEntityRemoved            = new Subject <CollectionEntityEvent>();
            _onEntityComponentsAdded    = new Subject <ComponentsChangedEvent>();
            _onEntityComponentsRemoving = new Subject <ComponentsChangedEvent>();
            _onEntityComponentsRemoved  = new Subject <ComponentsChangedEvent>();
        }
Example #13
0
        public bool AddRecipient(string name, Common.EntityType type)
        {
            var entities = EntityLookup.Search(name, SearchOptions.ExactMatch | SearchOptions.Online, type);

            if (entities == null || entities.Length == 0)
            {
                return(false);
            }

            AddRecipients(entities);

            return(true);
        }
Example #14
0
        protected ComputedGroup(IObservableGroup internalObservableGroup)
        {
            InternalObservableGroup = internalObservableGroup;
            CachedEntities          = new EntityLookup();
            Subscriptions           = new List <IDisposable>();

            _onEntityAdded    = new Subject <IEntity>();
            _onEntityRemoved  = new Subject <IEntity>();
            _onEntityRemoving = new Subject <IEntity>();

            MonitorChanges();
            RefreshEntities();
        }
Example #15
0
        public IEntity CreateEntity(IBlueprint blueprint = null)
        {
            var entity = EntityFactory.Create(null);

            EntityLookup.Add(entity.Id, entity);

            entityAdded.OnNext(new CollectionEntityEvent(entity, this));

            SubscribeToEntity(entity);

            blueprint?.Apply(entity);

            return(entity);
        }
Example #16
0
 internal ServiceBusSimulator(ServiceBusBuilder builder)
 {
     Settings = new ServiceBusSimulatorSettings(builder);
     Topics   = builder.Topics
                .Select(topic => (ITopic) new TopicEntity(topic.Name, topic.Subscriptions.Select(subscription => subscription.Name)))
                .ToDictionary(entity => entity.Name, StringComparer.OrdinalIgnoreCase)
                .AsReadOnly();
     Queues = builder.Queues
              .Select(queue => (IQueue) new QueueEntity(queue.Name))
              .ToDictionary(entity => entity.Name, StringComparer.OrdinalIgnoreCase)
              .AsReadOnly();
     _securityContext   = SecurityContext.Default;
     _cbsTokenValidator = CbsTokenValidator.Default;
     _entityLookup      = new EntityLookup(this);
     _logger            = Settings.LoggerProvider.CreateLogger(nameof(ServiceBusSimulator));
 }
Example #17
0
        public int Run()
        {
            EntityInfo[] infos = (from x in EntityIds select new EntityInfo {
                EntityID = x
            }).ToArray();
            EntityLookup.LookupIDs(infos);
            ConsoleTable table = new ConsoleTable(3, 2);

            table.SetTitle("ID", "Name", "Type");
            foreach (var i in infos)
            {
                table.AddRow(i.EntityID.ToString(), i.Name, i.EntityType.ToString());
            }
            table.Print();
            return(0);
        }
Example #18
0
        public void Initialize()
        {
            var folder = Settings.Current.Builder.Folder;

            lookups        = new Dictionary <string, MultiLookup>();
            sourceLookups  = new Dictionary <string, SourceLookup>();
            rfLookups      = new Dictionary <string, ReferenceFileLookup>();
            genderConcepts = new GenderLookup();
            genderConcepts.Load();

            ingredientLevel = string.IsNullOrEmpty(folder)
            ? new MultiLookup(Settings.Current.Building.VocabularyConnectionString,
                              @"Common\Lookups\IngredientLevel.sql")
            : new MultiLookup(Settings.Current.Building.VocabularyConnectionString,
                              Path.Combine(folder, @"Common\Lookups\IngredientLevel.sql"));
            ingredientLevel.Load();

            foreach (var qd in Settings.Current.Building.SourceQueryDefinitions)
            {
                if (qd.Persons != null)
                {
                    foreach (var d in qd.Persons)
                    {
                        d.Vocabulary = this;
                    }
                }
                Load(folder, qd.ConditionOccurrence);
                Load(folder, qd.DrugExposure);
                Load(folder, qd.ProcedureOccurrence);
                Load(folder, qd.Observation);
                Load(folder, qd.VisitOccurrence);
                Load(folder, qd.CareSites);
                Load(folder, qd.Providers);
                Load(folder, qd.ProcedureCost);
                Load(folder, qd.Death);
            }

            locationConcepts = new EntityLookup <Location>(Settings.Current.Building.DestinationConnectionString);

            var location = Settings.Current.Building.CommonQueryDefinitions.FirstOrDefault(qd => qd.Locations != null);

            if (location != null)
            {
                locationConcepts.Load(location, location.Locations[0]);
            }
        }
Example #19
0
        public void Find_FindsQueueEntityCI()
        {
            IQueue queue = Substitute.For <IQueue, IEntity>();

            queue.Name.Returns("myQue");
            var queues = new Dictionary <string, IQueue>
            {
                [queue.Name] = queue
            };
            IServiceBusSimulator fakeSimulator = Substitute.For <IServiceBusSimulator>();

            fakeSimulator.Queues.Returns(queues);
            var lookup = new EntityLookup(fakeSimulator);

            lookup.Find("myQue").ShouldBeSameAs(queue);
            lookup.Find("myque").ShouldBeSameAs(queue);
        }
Example #20
0
        public void Find_FindsTopicEntityCI()
        {
            ITopic topic = Substitute.For <ITopic, IEntity>();

            topic.Name.Returns("myTopic");
            var topics = new Dictionary <string, ITopic>
            {
                [topic.Name] = topic
            };
            IServiceBusSimulator fakeSimulator = Substitute.For <IServiceBusSimulator>();

            fakeSimulator.Topics.Returns(topics);
            var lookup = new EntityLookup(fakeSimulator);

            lookup.Find("myTopic").ShouldBeSameAs(topic);
            lookup.Find("mytopic").ShouldBeSameAs(topic);
        }
Example #21
0
        public void RemoveEntity(int id, bool disposeOnRemoval = true)
        {
            var entity = GetEntity(id);

            EntityLookup.Remove(id);

            var entityId = entity.Id;

            if (disposeOnRemoval)
            {
                entity.Dispose();
                EntityFactory.Destroy(entityId);
            }

            UnsubscribeFromEntity(entityId);

            entityRemoved.OnNext(new CollectionEntityEvent(entity, this));
        }
Example #22
0
        public ObservableGroup(ObservableGroupToken token, IEnumerable <IEntity> initialEntities, IEnumerable <INotifyingEntityCollection> notifyingCollections)
        {
            Token = token;
            NotifyingCollections = notifyingCollections;

            _onEntityAdded    = new Subject <IEntity>();
            _onEntityRemoved  = new Subject <IEntity>();
            _onEntityRemoving = new Subject <IEntity>();

            Subscriptions = new List <IDisposable>();
            var applicableEntities = initialEntities.Where(x => Token.LookupGroup.Matches(x));

            CachedEntities = new EntityLookup();

            foreach (var applicableEntity in applicableEntities)
            {
                CachedEntities.Add(applicableEntity);
            }

            NotifyingCollections.ForEachRun(MonitorEntityChanges);
        }
        private void LoadProviders()
        {
            providerConcepts = new EntityLookup <Provider>(Settings.Current.Building.DestinationConnectionString, Settings.Current.Building.DestinationSchemaName);
            QueryDefinition provider = null;

            if (Settings.Current.Building.DestinationQueryDefinitions != null)
            {
                provider = Settings.Current.Building.DestinationQueryDefinitions.FirstOrDefault(qd => qd.Providers != null);
            }
            else
            {
                provider = Settings.Current.Building.CommonQueryDefinitions.FirstOrDefault(qd => qd.Providers != null);
            }

            if (provider != null)
            {
                providerConcepts.Load(provider, provider.Providers[0]);
            }

            FlushProvidersToCommonVocab();
        }
Example #24
0
            public static void UpdateEntities(EntityLookup source, EntityLookup destination)
            {
                var sourceIds   = source.m_entities.Keys.ToHashSet();
                var idsToAdd    = new HashSet <EntityId>();
                var idsToDelete = destination.m_entities.Keys.ToHashSet();
                var idsToUpdate = new HashSet <EntityId>();

                foreach (var id in sourceIds)
                {
                    if (idsToDelete.Contains(id))
                    {
                        idsToUpdate.Add(id);
                        idsToDelete.Remove(id);
                    }
                    else
                    {
                        idsToAdd.Add(id);
                    }
                }

                foreach (var id in idsToUpdate)
                {
                    var sourceEntity      = source.GetEntity(id);
                    var destinationEntity = destination.GetEntity(id);
                    destinationEntity.CloneFrom(sourceEntity);
                }

                foreach (var id in idsToDelete)
                {
                    destination.m_entities.Remove(id);
                }

                foreach (var id in idsToAdd)
                {
                    var entity = new Entity(source.GetEntity(id));
                    destination.m_entities.Add(entity.Id, entity);
                }
            }
Example #25
0
        public IActionResult GetMMMEntities([FromBody] EntityLookup lookup)
        {
            var result = _repository.GetMMMEntitiesAsync(lookup);

            return(Helper.CheckResult(result));
        }
Example #26
0
        public void Initialize()
        {
            var folder = Settings.Current.Builder.Folder;
             lookups = new Dictionary<string, MultiLookup>();
             sourceLookups = new Dictionary<string, SourceLookup>();
             rfLookups = new Dictionary<string, ReferenceFileLookup>();
             genderConcepts = new GenderLookup();
             genderConcepts.Load();

             ingredientLevel = string.IsNullOrEmpty(folder)
            ? new MultiLookup(Settings.Current.Building.VocabularyConnectionString,
               @"Common\Lookups\IngredientLevel.sql")
            : new MultiLookup(Settings.Current.Building.VocabularyConnectionString,
               Path.Combine(folder, @"Common\Lookups\IngredientLevel.sql"));
             ingredientLevel.Load();

             foreach (var qd in Settings.Current.Building.SourceQueryDefinitions)
             {
            if (qd.Persons != null)
            {
               foreach (var d in qd.Persons)
               {
                  d.Vocabulary = this;
               }
            }
            Load(folder, qd.ConditionOccurrence);
            Load(folder, qd.DrugExposure);
            Load(folder, qd.ProcedureOccurrence);
            Load(folder, qd.Observation);
            Load(folder, qd.VisitOccurrence);
            Load(folder, qd.CareSites);
            Load(folder, qd.Providers);
            Load(folder, qd.ProcedureCost);
            Load(folder, qd.Death);
             }

             locationConcepts = new EntityLookup<Location>(Settings.Current.Building.DestinationConnectionString);

             var location = Settings.Current.Building.CommonQueryDefinitions.FirstOrDefault(qd => qd.Locations != null);
             if (location != null)
             {
            locationConcepts.Load(location, location.Locations[0]);
             }
        }
Example #27
0
        private void LoadProviders()
        {
            providerConcepts = new EntityLookup<Provider>(Settings.Current.Building.DestinationConnectionString);
             QueryDefinition provider = null;
             if (Settings.Current.Building.DestinationQueryDefinitions != null)
             {
            provider = Settings.Current.Building.DestinationQueryDefinitions.FirstOrDefault(qd => qd.Providers != null);
             }
             else
             {
            provider = Settings.Current.Building.CommonQueryDefinitions.FirstOrDefault(qd => qd.Providers != null);
             }

             if (provider != null)
             {
            providerConcepts.Load(provider, provider.Providers[0]);
             }

             FlushProvidersToCommonVocab();
        }
Example #28
0
        private void LoadEntityLookup()
        {
            var connection = Settings.Current.Building.SourceConnectionString;
             var queryDefinitions = Settings.Current.Building.SourceQueryDefinitions;

             locationConcepts = new EntityLookup<Location>(connection);
             organizationConcepts = new EntityLookup<Organization>(connection);
             careSiteConcepts = new EntityLookup<CareSite>(connection);
             providerConcepts = new EntityLookup<Provider>(connection);

             var location = queryDefinitions.FirstOrDefault(qd => qd.Locations != null);
             if (location != null)
             {
            locationConcepts.Load(location, location.Locations[0]);
             }

             if (locationConcepts.Lookup.Count == 0)
            locationConcepts.Lookup.Add("0", new Location {Id = 1});

             var organization = queryDefinitions.FirstOrDefault(qd => qd.Organizations != null);
             if (organization != null)
             {
            organizationConcepts.Load(organization, organization.Organizations[0]);
             }

             if (organizationConcepts.Lookup.Count == 0)
            organizationConcepts.Lookup.Add("0",
               new Organization {Id = 0, LocationId = 0, ConceptId = 0, SourceValue = string.Empty});

             var careSite = queryDefinitions.FirstOrDefault(qd => qd.CareSites != null);
             if (careSite != null)
             {
            careSiteConcepts.Load(careSite, careSite.CareSites[0]);
             }

             if (careSiteConcepts.Lookup.Count == 0)
            careSiteConcepts.Lookup.Add("0",
               new CareSite {Id = 0, LocationId = 0, OrganizationId = 0, PlaceOfSvcSourceValue = null});
        }
Example #29
0
 public void SwapDisplayWithProcessing()
 {
     m_dispatcher.VerifyCurrent();
     EntityLookup.SwapEntities(m_displayLookup, m_processingLookup);
 }
Example #30
0
        public void Initialize()
        {
            var folder = Settings.Current.Builder.Folder;

            lookups        = new Dictionary <string, MultiLookup>();
            sourceLookups  = new Dictionary <string, SourceLookup>();
            rfLookups      = new Dictionary <string, ReferenceFileLookup>();
            genderConcepts = new GenderLookup();
            genderConcepts.Load();

            var ingredientLevelFile       = Settings.Current.Building.CDM.GetAttribute <IngredientLevelFileAttribute>().Value;
            var vendorIngredientLevelFile =
                Settings.Current.Building.Vendor.GetAttribute <IngredientLevelFileAttribute>();

            if (vendorIngredientLevelFile != null)
            {
                ingredientLevelFile = vendorIngredientLevelFile.Value;
            }

            ingredientLevel = string.IsNullOrEmpty(folder)
            ? new MultiLookup(Settings.Current.Building.VocabularyConnectionString,
                              @"Common\Lookups\" + ingredientLevelFile, Settings.Current.Building.VocabularySchemaName)
            : new MultiLookup(Settings.Current.Building.VocabularyConnectionString,
                              Path.Combine(folder, @"Common\Lookups\" + ingredientLevelFile), Settings.Current.Building.VocabularySchemaName);
            ingredientLevel.Load();

            foreach (var qd in Settings.Current.Building.SourceQueryDefinitions)
            {
                if (qd.Persons != null)
                {
                    foreach (var d in qd.Persons)
                    {
                        d.Vocabulary = this;
                    }
                }
                Load(folder, qd.ConditionOccurrence);
                Load(folder, qd.DrugExposure);
                Load(folder, qd.ProcedureOccurrence);
                Load(folder, qd.Observation);
                Load(folder, qd.VisitOccurrence);
                Load(folder, qd.CareSites);
                Load(folder, qd.Providers);
                Load(folder, qd.Death);
                Load(folder, qd.Measurement);
                Load(folder, qd.DeviceExposure);
                Load(folder, qd.Note);

                Load(folder, qd.VisitCost);
                Load(folder, qd.ProcedureCost);
                Load(folder, qd.DeviceCost);
                Load(folder, qd.ObservationCost);
                Load(folder, qd.MeasurementCost);
                Load(folder, qd.DrugCost);
            }

            locationConcepts = new EntityLookup <Location>(Settings.Current.Building.DestinationConnectionString, Settings.Current.Building.DestinationSchemaName);
            var location = Settings.Current.Building.CommonQueryDefinitions.FirstOrDefault(qd => qd.Locations != null);

            if (location != null)
            {
                //if (Settings.Current.Building.DestinationEngine.Database == Database.Redshift)
                //{
                //   locationConcepts.LoadFromS3(location, location.Locations[0], "LOCATION.txt", new Dictionary<string, int>
                //   {
                //      {"LOCATION_ID", 0},
                //      {"STATE", 1},
                //      {"LOCATION_SOURCE_VALUE", 2}
                //   });
                //}
                //else
                {
                    locationConcepts.Load(location, location.Locations[0]);
                }
            }
        }
Example #31
0
        //public async System.Threading.Tasks.Task<IEnumerable<MMMEntitiesShort>> GetAsync([FromBody] EntityLookup lookup)
        public async System.Threading.Tasks.Task <List <MMMEntitiesShort> > GetMMMEntitiesAsync([FromBody] EntityLookup lookup)
        {
            try
            {
                string sp = "usp_GetEntities_sel";

                using (var sqlCmd = _context.Database.GetDbConnection().CreateCommand())
                {
                    sqlCmd.CommandText = sp;
                    sqlCmd.CommandType = CommandType.StoredProcedure;

                    sqlCmd.Parameters.Add(new SqlParameter("@DateEnteredFrom", SqlDbType.Date)
                    {
                        Value = lookup.DateEnteredFrom
                    });
                    sqlCmd.Parameters.Add(new SqlParameter("@DateEnteredTo", SqlDbType.Date)
                    {
                        Value = lookup.DateEnteredTo
                    });
                    sqlCmd.Parameters.Add(new SqlParameter("@DateUpdatedFrom", SqlDbType.Date)
                    {
                        Value = lookup.DateUpdatedFrom
                    });
                    sqlCmd.Parameters.Add(new SqlParameter("@DateUpdatedTo", SqlDbType.Date)
                    {
                        Value = lookup.DateUpdatedTo
                    });
                    sqlCmd.Parameters.Add(new SqlParameter("@LastReviewedDateFrom", SqlDbType.Date)
                    {
                        Value = lookup.LastReviewedDateFrom
                    });
                    sqlCmd.Parameters.Add(new SqlParameter("@LastReviewedDateTo", SqlDbType.Date)
                    {
                        Value = lookup.LastReviewedDateTo
                    });
                    sqlCmd.Parameters.Add(new SqlParameter("@EnteredBy", SqlDbType.VarChar)
                    {
                        Value = lookup.EnteredBy
                    });
                    sqlCmd.Parameters.Add(new SqlParameter("@UpdatedBy", SqlDbType.VarChar)
                    {
                        Value = lookup.UpdatedBy
                    });
                    sqlCmd.Parameters.Add(new SqlParameter("@ReviewedBy", SqlDbType.VarChar)
                    {
                        Value = lookup.ReviewedBy
                    });
                    sqlCmd.Parameters.Add(new SqlParameter("@DOB", SqlDbType.Bit)
                    {
                        Value = lookup.DOB
                    });
                    sqlCmd.Parameters.Add(new SqlParameter("@DOB2", SqlDbType.Bit)
                    {
                        Value = lookup.DOB2
                    });

                    sqlCmd.Parameters.Add(new SqlParameter("@NationalID", SqlDbType.Bit)
                    {
                        Value = lookup.NationalID
                    });
                    sqlCmd.Parameters.Add(new SqlParameter("@OtherID", SqlDbType.Bit)
                    {
                        Value = lookup.OtherID
                    });
                    sqlCmd.Parameters.Add(new SqlParameter("@PassportID", SqlDbType.Bit)
                    {
                        Value = lookup.PassportID
                    });

                    sqlCmd.Parameters.Add(new SqlParameter("@EntitiesSourceID", SqlDbType.Int)
                    {
                        Value = lookup.EntitiesSourceID
                    });
                    sqlCmd.Parameters.Add(new SqlParameter("@CountryID", SqlDbType.VarChar)
                    {
                        Value = lookup.CountryID
                    });
                    sqlCmd.Parameters.Add(new SqlParameter("@EntryCategoryID", SqlDbType.Int)
                    {
                        Value = lookup.EntryCategoryID
                    });
                    sqlCmd.Parameters.Add(new SqlParameter("@EntrySubCategoryID", SqlDbType.Int)
                    {
                        Value = lookup.EntrySubCategoryID
                    });
                    sqlCmd.Parameters.Add(new SqlParameter("@EntitiesLevelsId", SqlDbType.Int)
                    {
                        Value = lookup.EntitiesLevelsId
                    });

                    sqlCmd.Parameters.Add(new SqlParameter("@Positions", SqlDbType.VarChar)
                    {
                        Value = lookup.Positions
                    });
                    sqlCmd.Parameters.Add(new SqlParameter("@Remarks", SqlDbType.VarChar)
                    {
                        Value = lookup.Remarks
                    });

                    if (sqlCmd.Connection.State != ConnectionState.Open)
                    {
                        sqlCmd.Connection.Open();
                    }

                    using (var dataReader = await sqlCmd.ExecuteReaderAsync())
                    {
                        List <MMMEntitiesShort> ShortEntityList = new List <MMMEntitiesShort>();
                        while (await dataReader.ReadAsync())
                        {
                            MMMEntitiesShort shortentity = new MMMEntitiesShort()
                            {
                                Ent_ID           = Convert.ToInt32(dataReader["Ent_ID"]),
                                Name             = dataReader["Name"].ToString(),
                                EntryCategory    = dataReader["EntryCategory"].ToString(),
                                EntrySubCategory = dataReader["EntrySubCategory"].ToString(),
                                Country          = dataReader["Country"].ToString()
                            };

                            ShortEntityList.Add(shortentity);
                        }

                        return(ShortEntityList);
                    }
                }
            }
            catch (Exception e)
            {
                // TODO: log
                var logInfo = e.Message;

                return(new List <MMMEntitiesShort>());
            }

            //return new List<MMMEntitiesShort>();
        }
Example #32
0
 public void UpdateProcessingEntitiesFromDisplay()
 {
     m_dispatcher.VerifyNotCurrent();
     EntityLookup.UpdateEntities(m_displayLookup, m_processingLookup);
 }
Example #33
0
 public bool ContainsEntity(int entityId) => EntityLookup.ContainsKey(entityId);