Beispiel #1
0
        public static void Configure(IConfiguration configuration, IApplicationBuilder app, IHostingEnvironment env,
                                     ILoggerFactory loggerFactory,
                                     Web.Services.ApplicationDbContext dbContext)
        {
            loggerFactory.AddConsole(configuration.GetSection("Logging"));
            loggerFactory.AddDebug();

            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
                app.UseDatabaseErrorPage();
                app.UseBrowserLink();
            }

            app.UseDefaultFiles();
            app.UseStaticFiles();

            // ===== Use Authentication ======
            app.UseAuthentication();

            app.UseCors("AllowAllOrigins");

            app.UseMvc();

            dbContext.Database.EnsureCreated();

            Web.Constants.SCREEN_LIST = dbContext.GetScreenList();

            #region Initial Constants from config.

            List <Models.SystemConfigDo> configList = dbContext.GetSystemConfig();
            foreach (PropertyInfo prop in typeof(Web.Constants).GetProperties())
            {
                Models.SystemConfigDo config = configList.Find((x) => x.SystemCode == prop.Name);
                if (config != null)
                {
                    if (prop.PropertyType == typeof(int))
                    {
                        int i;
                        if (int.TryParse(config.SystemValue1, out i))
                        {
                            prop.SetValue(null, i, null);
                        }
                    }
                    else
                    {
                        prop.SetValue(null, config.SystemValue1, null);
                    }
                }
            }

            #endregion
        }
Beispiel #2
0
 public SCS021Controller(
     Web.Models.User.ApplicationUserManager userManager,
     Web.Models.User.ApplicationSignInManager signInManager,
     Web.Models.User.ApplicationRoleManager roleManager,
     Web.Services.ApplicationDbContext appDBContext,
     Common.DataSvc.CommonSvcDbContext commonSvcDbContext
     ) : base(userManager)
 {
     this._userManager        = userManager;
     this._signInManager      = signInManager;
     this._roleManager        = roleManager;
     this._appDbContext       = appDBContext;
     this._commonSvcDbContext = commonSvcDbContext;
 }
Beispiel #3
0
 public CMS010Controller(
     Web.Models.User.ApplicationUserManager userManager,
     Web.Models.User.ApplicationSignInManager signInManager,
     Web.Models.User.ApplicationRoleManager roleManager,
     Web.Services.ApplicationDbContext appDBContext,
     Common.DataSvc.CommonSvcDbContext commonSvcDbContext,
     IConfiguration configuration
     ) : base(userManager, configuration)
 {
     this._userManager        = userManager;
     this._signInManager      = signInManager;
     this._roleManager        = roleManager;
     this._appDbContext       = appDBContext;
     this._commonSvcDbContext = commonSvcDbContext;
     this._configuration      = configuration;
 }
Beispiel #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, ILoggerFactory loggerFactory,
                       Web.Services.ApplicationDbContext dbContext)
 {
     Web.Config.Startup.Configure(Configuration, app, env, loggerFactory, dbContext);
 }