예제 #1
0
 public ExcelController(PLSODb context, ExcelTemplateRepo excelTemplateRepo, IEnumProperties enumProps, IHttpContextAccessor contextAccessor, ILoggerFactory loggerFactory) : base(contextAccessor)
 {
     this.excelTemplateRepo = excelTemplateRepo;
     base.logger            = loggerFactory.CreateLogger <ExcelController>();
     this.enumProps         = enumProps;
     DataContext            = context;
 }
예제 #2
0
        public RecordRepo(PLSODb context, IHttpContextAccessor contextAccessor, ILoggerFactory loggerFactory) : base(context, contextAccessor)
        {
            logger = loggerFactory.CreateLogger <ExcelTemplateRepo>();

            // TODO: The following can/should be put in a common method like the BaseController does
            var user = contextAccessor.HttpContext.User;

            UserID = user.HasClaim(x => x.Type == Constants.Claims.User.ID) ? Convert.ToInt32(user.FindFirst(Constants.Claims.User.ID).Value) : 0;
        }
예제 #3
0
 public PLSOSignInManager(
     UserManager <TUser> userManager,
     IHttpContextAccessor contextAccessor,
     IUserClaimsPrincipalFactory <TUser> claimsFactory,
     IOptions <IdentityOptions> optionsAccessor,
     ILogger <SignInManager <TUser> > logger,
     IAuthenticationSchemeProvider authenticationSchemeProvider,
     PLSODb dataContext)
     : base(userManager, contextAccessor, claimsFactory, optionsAccessor, logger, authenticationSchemeProvider)
 {
     _userManager     = userManager ?? throw new ArgumentNullException(nameof(userManager));
     _contextAccessor = contextAccessor ?? throw new ArgumentNullException(nameof(contextAccessor));
     _dataContext     = dataContext ?? throw new ArgumentNullException(nameof(dataContext));
 }
예제 #4
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IHostingEnvironment env, PLSODb context, IServiceScopeFactory scopeFactory, ILoggerFactory loggerFactory)
        {
            loggerFactory.AddConsole(Configuration.GetSection("Logging"));                             // https://docs.microsoft.com/en-us/aspnet/core/fundamentals/logging
            loggerFactory.AddDebug();
            loggerFactory.AddContext(LogLevel.Warning, Configuration.GetConnectionString("PLSOData")); // Should just save Warning, Error and Critical messages to the Database

            if (env.IsDevelopment())
            {
                app.UseBrowserLink();
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
            }

            app.UseStaticFiles();
            app.UseAuthentication();

            app.UseMvc(routes => {
                routes.MapRoute(
                    name: "default",
                    template: "{controller=Home}/{action=Index}/{id?}");
                routes.MapRoute(
                    name: "api",
                    template: "api/{controller=Home}/{action=Index}/{id?}");
            });

            // So we can create instances of DI items when you can not inject them naturally
            ServiceInstantiator.Instance = app.ApplicationServices;

            // Enable automatic migrations
            try {
                using (var serviceScope = app.ApplicationServices.GetRequiredService <IServiceScopeFactory>().CreateScope()) {
                    serviceScope.ServiceProvider.GetService <PLSODb>().Database.EnsureCreated();
                    serviceScope.ServiceProvider.GetService <PLSODb>().Database.Migrate();
                }
            } catch (Exception e) {
                logger.LogError(e, "Startup Migration Error");
            }
        }
예제 #5
0
 public BaseRepo(PLSODb context, IHttpContextAccessor contextAccessor)
 {
     this.DataContext     = context;
     this.contextAccessor = contextAccessor;
 }
예제 #6
0
        // TODO: Column E (Record.Township) is Required
        // Then at least one of the following 4 columns are required as well, but not on the object.  Must be business logic.
        // Record.OriginalLot, Record.Section, Record.Tract or Record.Range

        public ExcelTemplateRepo(PLSODb context, IHttpContextAccessor contextAccessor, ILoggerFactory loggerFactory) : base(context, contextAccessor)
        {
            logger = loggerFactory.CreateLogger <ExcelTemplateRepo>();
        }
예제 #7
0
 public EnumPropertiesService(PLSODb context)
 {
     this.context = context;
 }