public void SetUp()
        {
            var serverOpt = new MsSqlConnectionSettings()
            {
                ConnectionString = TestContextUtils.GetParameterOrDefault("sqlserver",
                                                                          "Data Source=.;Initial Catalog=AuctionhouseDatabase;Integrated Security=False;User ID=sa;PWD=Qwerty1234;")
            };

            userRepository = new MsSqlUserRepository(serverOpt);
            user           = new User();
            user.Register("test");
        }
Example #2
0
        public void SetUp()
        {
            var serverOpt = new MsSqlConnectionSettings()
            {
                ConnectionString = TestContextUtils.GetParameterOrDefault("sqlserver",
                                                                          "Data Source=.;Initial Catalog=AuctionhouseDatabase;Integrated Security=False;User ID=sa;PWD=Qwerty1234;")
            };

            auctionRepository = new MsSqlAuctionRepository(serverOpt);
            user = new User();
            user.Register("Test username");
            user.AddCredits(1000);
            user.MarkPendingEventsAsHandled();
        }
 private static void ConfigureServiceSettings(
     IServiceCollection serviceCollection, MsSqlConnectionSettings sqlServerConnectionSettings,
     RabbitMqSettings rabbitMqSettings, TimeTaskServiceSettings timeTaskServiceSettings,
     ImageDbSettings imageDbSettings,
     UserAuthDbContextOptions userAuthDbContextOptions,
     CategoryNameServiceSettings categoryNameServiceSettings)
 {
     serviceCollection.AddSingleton(sqlServerConnectionSettings);
     serviceCollection.AddSingleton(rabbitMqSettings);
     serviceCollection.AddSingleton(categoryNameServiceSettings);
     serviceCollection.AddSingleton(timeTaskServiceSettings);
     serviceCollection.AddSingleton(imageDbSettings);
     serviceCollection.AddSingleton(userAuthDbContextOptions);
 }
            public static void Configure <UserIdentityServiceImplT, AuctionCreateSessionServiceImplT, ResetLinkSenderServiceImplT>(
                IServiceCollection serviceCollection,
                MsSqlConnectionSettings eventStoreConnectionSettings,
                RabbitMqSettings rabbitMqSettings,
                TimeTaskServiceSettings timeTaskServiceSettings,
                ImageDbSettings imageDbSettings,
                UserAuthDbContextOptions userAuthDbContextOptions,
                CategoryNameServiceSettings categoryNameServiceSettings
                )
                where UserIdentityServiceImplT : class, IUserIdentityService
                where AuctionCreateSessionServiceImplT : class, IAuctionCreateSessionService
                where ResetLinkSenderServiceImplT : class, IResetLinkSenderService
            {
                ConfigureServiceSettings(serviceCollection, eventStoreConnectionSettings, rabbitMqSettings,
                                         timeTaskServiceSettings, imageDbSettings, userAuthDbContextOptions, categoryNameServiceSettings);
                ConfigureAuthDbServices(serviceCollection);
                ConfigureUserIdentitySessionService <UserIdentityServiceImplT>(serviceCollection);
                ConfigureAuctionCreateSessionService <AuctionCreateSessionServiceImplT>(serviceCollection);
                ConfigureImageServices(serviceCollection);
                ConfigureDomainRepositories(serviceCollection);
                ConfigureAuctionShedulerService(serviceCollection, timeTaskServiceSettings);
                ConfigureDecoratedCommandHandlers(serviceCollection);
                ConfigureResetLinkSenderService <ResetLinkSenderServiceImplT>(serviceCollection);
                serviceCollection.AddScoped <CreateAuctionCommandHandlerDepedencies>();


                serviceCollection.AddSingleton <IHTTPQueuedCommandStatusStorage, HTTPMemQueuedCommandStatusStorage>();
                serviceCollection.AddScoped <WSQueuedCommandHandler>();
                serviceCollection.AddScoped <HTTPQueuedCommandHandler>();
                serviceCollection.AddScoped <MediatRCommandHandlerMediator>();
                serviceCollection.AddScoped <EventBusCommandHandlerMediator>();
                serviceCollection.AddScoped <HTTPQueuedCommandHandlerMediator>();
                serviceCollection.AddScoped <ImmediateCommandMediator>();
                serviceCollection.AddScoped <WSQueuedCommandMediator>();
                serviceCollection.AddScoped <HTTPQueuedCommandMediator>();

                serviceCollection.AddScoped <HTTPQueuedCommandStatusService>();
            }
Example #5
0
        // IDisposable
        protected virtual void Dispose(bool disposing)
        {
            if (!this.disposedValue) {
                if (disposing) {
                    if (this.dbConnectionSettings != null)
                        this.dbConnectionSettings = null;

                    if (this.dbConnection != null) {
                        this.dbConnection.Dispose();
                        this.dbConnection = null;
                    }

                    if (this.dbCommand != null) {
                        this.dbCommand.Dispose();
                        this.dbCommand = null;
                    }
                }
            }
            this.disposedValue = true;
        }
Example #6
0
        private static void RemoveProcessedNotificationRecords(ReportNotification reportNotification)
        {
            try
            {
                MsSqlConnectionSettings staticDbConnectionSettings = new MsSqlConnectionSettings();
                staticDbConnectionSettings.DataSource = AppVars.dbSettings.DataSource;
                staticDbConnectionSettings.Catalog = AppVars.dbSettings.DatabaseName;
                staticDbConnectionSettings.User = AppVars.dbSettings.UserLogin;
                staticDbConnectionSettings.Password = AppVars.dbSettings.Password;

                using (MsSqlPersistence staticConnection = new MsSqlPersistence(staticDbConnectionSettings, true))
                {
                    if (staticConnection.IsConnected())
                    {
                        using (SqlCommand staticCommand = new SqlCommand())
                        {
                            staticCommand.CommandText = @"
                            DELETE
                            FROM report_notifications
                            WHERE report_notifications.id = @Id
                            ";
                            staticCommand.Parameters.Add("@Id", System.Data.SqlDbType.UniqueIdentifier).Value = reportNotification.Id;
                            staticConnection.ExecuteCommand(staticCommand);
                        }

                    }
                    else
                    {
                        throw new Exception("Unable to Connect");
                    }
                }
            }
            catch
            {
                throw;
            }
        }