예제 #1
0
        }//RegisterRoutes

        protected void Application_Start()
        {
            Statics.SessionFactory = new ScopeSessionFactory(new AspNetSessionFactory());

            Starter.Start(UserConnections.Replace(Settings.Default.ConnectionString));

            using (AuthLogic.Disable())
                Schema.Current.Initialize();

            WebStart();

            ProcessRunnerLogic.StartRunningProcesses(5 * 1000);

            SchedulerLogic.StartScheduledTasks();

            AsyncEmailSenderLogic.StartRunningEmailSenderAsync(5 * 1000);

            RegisterRoutes(RouteTable.Routes);

            AuthLogic.UserLogingIn += user =>
            {
                AllowLogin required = ScopeSessionFactory.IsOverriden ? AllowLogin.WindowsOnly : AllowLogin.WebOnly;

                AllowLogin current = user.Mixin <UserEmployeeMixin>().AllowLogin;

                if (current != AllowLogin.WindowsAndWeb && current != required)
                {
                    throw new UnauthorizedAccessException("User {0} is {1}".FormatWith(user, current.NiceToString()));
                }
            }; //UserLogingIn
        }
예제 #2
0
        public void Stop()
        {
            AsyncEmailSenderPermission.ViewAsyncEmailSenderPanel.AssertAuthorized();

            AsyncEmailSenderLogic.Stop();

            Thread.Sleep(1000);
        }
예제 #3
0
        public AsyncEmailSenderState View()
        {
            AsyncEmailSenderPermission.ViewAsyncEmailSenderPanel.AssertAuthorized();

            AsyncEmailSenderState state = AsyncEmailSenderLogic.ExecutionState();

            return(state);
        }
예제 #4
0
파일: Startup.cs 프로젝트: oltur/AtTest
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime lifetime)
        {
            app.UseDeveloperExceptionPage();

            app.UseStaticFiles();

            //HeavyProfiler.Enabled = true;
            using (HeavyProfiler.Log("Startup"))
                using (var log = HeavyProfiler.Log("Initial"))
                {
                    VersionFilterAttribute.CurrentVersion = Assembly.GetExecutingAssembly().GetName().Version !.ToString();
                    Starter.Start(Configuration.GetConnectionString("ConnectionString"));

                    log.Switch("Initialize");
                    using (AuthLogic.Disable())
                        Schema.Current.Initialize();

                    Statics.SessionFactory = new ScopeSessionFactory(new VoidSessionFactory());

                    log.Switch("WebStart");
                    WebStart(app, env, lifetime);

                    log.Switch("UseEndpoints");
                    app.UseRouting();
                    app.UseEndpoints(routes =>
                    {
                        routes.MapControllerRoute(
                            name: "default",
                            pattern: "{controller=Home}/{action=Index}/{id?}");
                    });

                    app.MapWhen(x => !x.Request.Path.Value.StartsWith("/api"), builder =>
                    {
                        builder.UseRouting();
                        builder.UseEndpoints(routes =>
                        {
                            routes.MapControllerRoute(
                                name: "spa-fallback",
                                pattern: "{*url}",
                                defaults: new { controller = "Home", action = "Index" });
                        });
                    });


                    if (Configuration.GetValue <bool>("StartBackgroundProcesses"))
                    {
                        log.Switch("StartRunningProcesses");
                        ProcessRunnerLogic.StartRunningProcesses(5 * 1000);

                        log.Switch("StartScheduledTasks");
                        SchedulerLogic.StartScheduledTasks();

                        log.Switch("StartRunningEmailSenderAsync");
                        AsyncEmailSenderLogic.StartRunningEmailSenderAsync(5 * 1000);
                    }
                }
        }
예제 #5
0
        public ActionResult Stop()
        {
            AsyncEmailSenderPermission.ViewAsyncEmailSenderPanel.AssertAuthorized();

            AsyncEmailSenderLogic.Stop();

            Thread.Sleep(1000);

            return(null);
        }
예제 #6
0
        public new ActionResult View()
        {
            AsyncEmailSenderState state = AsyncEmailSenderLogic.ExecutionState();

            if (Request.IsAjaxRequest())
            {
                return(PartialView(MailingClient.ViewPrefix.FormatWith("AsyncEmailSenderDashboard"), state));
            }
            else
            {
                return(View(MailingClient.ViewPrefix.FormatWith("AsyncEmailSenderDashboard"), state));
            }
        }
예제 #7
0
        void Application_Start(object sender, EventArgs e)
        {
            Starter.Start(UserConnections.Replace(Settings.Default.ConnectionString));

            using (AuthLogic.Disable())
                Schema.Current.Initialize();

            // Code that runs on application startup
            AreaRegistration.RegisterAllAreas();
            GlobalConfiguration.Configure(WebStart);
            RegisterMvcRoutes(RouteTable.Routes);

            Statics.SessionFactory = new ScopeSessionFactory(new VoidSessionFactory());

            ProcessRunnerLogic.StartRunningProcesses(5 * 1000);

            SchedulerLogic.StartScheduledTasks();

            AsyncEmailSenderLogic.StartRunningEmailSenderAsync(5 * 1000);
        }
예제 #8
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime lifetime)
        {
            app.UseDeveloperExceptionPage();

            app.UseStaticFiles();

            //HeavyProfiler.Enabled = true;
            using (HeavyProfiler.Log("Startup"))
                using (var log = HeavyProfiler.Log("Initial"))
                {
                    DynamicCode.CodeGenDirectory = env.ContentRootPath + "/CodeGen";

                    Starter.Start(Configuration.GetConnectionString("ConnectionString"), Configuration.GetValue <bool>("IsPostgres"), detectSqlVersion: false);

                    Statics.SessionFactory = new ScopeSessionFactory(new VoidSessionFactory());

                    log.Switch("WebStart");
                    WebStart(app, env, lifetime);

                    log.Switch("UseEndpoints");

                    //Enable middleware to serve generated Swagger as a JSON endpoint.
                    app.UseSwagger();
                    app.UseSwaggerUI(c =>
                    {
                        c.SwaggerEndpoint("../swagger/v1/swagger.json", "Southwind API");
                    });//Swagger Configure

                    app.UseWhen(req => req.Request.Path.StartsWithSegments("/api/reflection/types"), builder =>
                    {
                        builder.UseResponseCompression();
                    });

                    app.UseRouting();
                    app.UseEndpoints(routes =>
                    {
                        routes.MapControllers();
                        routes.MapControllerRoute(
                            name: "spa-fallback",
                            pattern: "{*url}",
                            constraints: new { url = new NoAPIContraint() },
                            defaults: new { controller = "Home", action = "Index" });
                    });
                }

            SignumInitializeFilterAttribute.InitializeDatabase = () =>
            {
                using (HeavyProfiler.Log("Startup"))
                    using (var log = HeavyProfiler.Log("Initial"))
                    {
                        log.Switch("Initialize");
                        using (AuthLogic.Disable())
                            Schema.Current.Initialize();

                        if (Configuration.GetValue <bool>("StartBackgroundProcesses"))
                        {
                            log.Switch("StartRunningProcesses");
                            ProcessRunnerLogic.StartRunningProcesses(5 * 1000);

                            log.Switch("StartScheduledTasks");
                            SchedulerLogic.StartScheduledTasks();

                            log.Switch("StartRunningEmailSenderAsync");
                            AsyncEmailSenderLogic.StartRunningEmailSenderAsync(5 * 1000);
                        }

                        SystemEventServer.LogStartStop(app, lifetime);
                    }
            };
        }
예제 #9
0
        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env, IHostApplicationLifetime lifetime)
        {
            app.UseDeveloperExceptionPage();

            app.UseStaticFiles();

            //HeavyProfiler.Enabled = true;
            using (HeavyProfiler.Log("Startup"))
                using (var log = HeavyProfiler.Log("Initial"))
                {
                    DynamicCode.CodeGenDirectory = env.ContentRootPath + "/CodeGen";

                    Starter.Start(Configuration.GetConnectionString("ConnectionString"), Configuration.GetValue <bool>("IsPostgres"));

                    log.Switch("Initialize");
                    using (AuthLogic.Disable())
                        Schema.Current.Initialize();

                    Statics.SessionFactory = new ScopeSessionFactory(new VoidSessionFactory());

                    log.Switch("WebStart");
                    WebStart(app, env, lifetime);

                    log.Switch("UseEndpoints");

                    //Enable middleware to serve generated Swagger as a JSON endpoint.
                    app.UseSwagger();
                    app.UseSwaggerUI(c =>
                    {
                        c.SwaggerEndpoint("../swagger/v1/swagger.json", "Southwind API");
                    });//Swagger Configure

                    app.UseRouting();
                    app.UseEndpoints(routes =>
                    {
                        routes.MapControllerRoute(
                            name: "default",
                            pattern: "{controller=Home}/{action=Index}/{id?}");
                    });

                    app.MapWhen(x => !x.Request.Path.Value.StartsWith("/api"), builder =>
                    {
                        builder.UseRouting();
                        builder.UseEndpoints(routes =>
                        {
                            routes.MapControllerRoute(
                                name: "spa-fallback",
                                pattern: "{*url}",
                                defaults: new { controller = "Home", action = "Index" });
                        });
                    });


                    if (Configuration.GetValue <bool>("StartBackgroundProcesses"))
                    {
                        log.Switch("StartRunningProcesses");
                        ProcessRunnerLogic.StartRunningProcesses(5 * 1000);

                        log.Switch("StartScheduledTasks");
                        SchedulerLogic.StartScheduledTasks();

                        log.Switch("StartRunningEmailSenderAsync");
                        AsyncEmailSenderLogic.StartRunningEmailSenderAsync(5 * 1000);
                    }
                }
        }