protected void Application_Start()
        {
            // Create the container as usual.
            var container = new Container();

            container.Options.DefaultScopedLifestyle = new AsyncScopedLifestyle();

            // Register your types, for instance using the scoped lifestyle:
            container.Register <IBasicSearchService, BasicSearchService>(Lifestyle.Scoped);
            container.Register <IResourceService, ResourceService>(Lifestyle.Scoped);
            container.Register <IIndexingService, IndexingService>(Lifestyle.Scoped);
            container.Register <IDocumentRepository, DocumentRepository>(Lifestyle.Scoped);
            container.Register <IPatientRepository, PatientRepository>(Lifestyle.Scoped);
            container.Register <IContentService, ContentService>(Lifestyle.Scoped);
            container.Register <IConfigurationService, ConfigurationService>(Lifestyle.Scoped);

            // This is an extension method from the integration package.
            container.RegisterWebApiControllers(GlobalConfiguration.Configuration);

            container.Verify();

            GlobalConfiguration.Configuration.DependencyResolver =
                new SimpleInjectorWebApiDependencyResolver(container);

            GlobalConfiguration.Configure(WebApiConfig.Register);

            IPatientRepository    patientRepository    = new PatientRepository();
            IDocumentRepository   documentRepository   = new DocumentRepository();
            IIndexingService      indexingService      = new IndexingService(documentRepository);
            IConfigurationService configuretionService = new ConfigurationService();

            InternalDatabase database = new InternalDatabase(patientRepository, documentRepository, indexingService, configuretionService);

            database.Seed();
        }
Beispiel #2
0
        public void ConnectToMySQLDatabase(string dbconnection)
        {
            InternalDatabase.Clear();

            //MYSQLDatabase = new TVTSQLDatabase( dbconnection );
            //MYSQLDatabase.FillTVTDatabase( InternalDatabase );
        }
Beispiel #3
0
        public async Task Log(string action, bool status, int statusCode, string token, int externalUserId, int userId, string message = null)
        {
            var tokenId = InternalDatabase.Key
                          .Where(k => k.Content == token)
                          .Select(k => k.Id)
                          .FirstOrDefault();

            var externalUser = Database.Users
                               .Where(u => u.Id == externalUserId)
                               .FirstOrDefault();

            string content = $"<u>'{externalUser.Email}'</u> invoked action '{action}'";

            if (!status)
            {
                content += $"<br/><b class='error'>Message: {message}<br/>Status code: {statusCode}</b>";
            }


            var activity = new Data.Activity
            {
                Status         = status,
                KeyId          = tokenId,
                OccuredOn      = DateTime.Now,
                UserId         = userId,
                ExternalUserId = externalUser.Id,
                Content        = content
            };

            InternalDatabase.Activity.Add(activity);

            await InternalDatabase.SaveChangesAsync();
        }
Beispiel #4
0
        public void LoadXMLFile(string filename)
        {
            CurrentFilePath = filename;
            InternalDatabase.Clear();

            var persister = new XmlPersisterV3();

            persister.LoadXML(filename, InternalDatabase, DataStructure.FakeData);
        }
Beispiel #5
0
        public void SearchBlankShouldReturnAll()
        {
            configurationService.Setup(cm => cm.GetAppSetting("ResourcePath")).Returns(@"c:\resources");

            intenralDatabase = new InternalDatabase(patientRepository, documentRepository, indexingService, configurationService.Object);
            intenralDatabase.Seed();

            var query = string.Empty;
            int count = basicSearchService.Filter(query).Documents.Count;

            Assert.IsTrue(count > 0);
        }