}//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 }
public void Stop() { ProcessPermission.ViewProcessPanel.AssertAuthorized(); ProcessRunnerLogic.Stop(); Thread.Sleep(1000); }
// 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); } } }
public ActionResult Stop() { ProcessPermission.ViewProcessPanel.AssertAuthorized(); ProcessRunnerLogic.Stop(); Thread.Sleep(1000); return(null); }
public new ActionResult View() { ProcessLogicState state = ProcessRunnerLogic.ExecutionState(); if (Request.IsAjaxRequest()) { return(PartialView(ProcessClient.ViewPrefix.FormatWith("ProcessPanelTable"), state)); } else { return(View(ProcessClient.ViewPrefix.FormatWith("ProcessPanel"), state)); } }
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); }
// 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); } }; }
public static void Register() { GetState = e => e.State; new Execute(ProcessOperation.Save) { FromStates = { ProcessState.Created }, ToStates = { ProcessState.Created }, CanBeNew = true, CanBeModified = true, Execute = (p, args) => { p.Save(); } }.Register(); new Execute(ProcessOperation.Plan) { FromStates = { ProcessState.Created, ProcessState.Canceled, ProcessState.Planned, ProcessState.Suspended }, ToStates = { ProcessState.Planned }, Execute = (p, args) => { p.MachineName = JustMyProcesses ? Environment.MachineName : ProcessEntity.None; p.ApplicationName = JustMyProcesses ? Schema.Current.ApplicationName : ProcessEntity.None; p.State = ProcessState.Planned; p.PlannedDate = args.GetArg <DateTime>(); } }.Register(); new Execute(ProcessOperation.Cancel) { FromStates = { ProcessState.Planned, ProcessState.Created, ProcessState.Suspended, ProcessState.Queued, ProcessState.Executing, ProcessState.Suspending }, ToStates = { ProcessState.Canceled }, Execute = (p, _) => { p.State = ProcessState.Canceled; p.CancelationDate = TimeZoneManager.Now; } }.Register(); new Execute(ProcessOperation.Execute) { FromStates = { ProcessState.Created, ProcessState.Planned, ProcessState.Canceled, ProcessState.Suspended }, ToStates = { ProcessState.Queued }, Execute = (p, _) => { p.MachineName = JustMyProcesses ? Environment.MachineName : ProcessEntity.None; p.ApplicationName = JustMyProcesses ? Schema.Current.ApplicationName : ProcessEntity.None; p.SetAsQueued(); ProcessRunnerLogic.WakeUp("Execute in this machine", null); } }.Register(); new Execute(ProcessOperation.Suspend) { FromStates = { ProcessState.Executing }, ToStates = { ProcessState.Suspending }, Execute = (p, _) => { p.State = ProcessState.Suspending; p.SuspendDate = TimeZoneManager.Now; } }.Register(); new ConstructFrom <ProcessEntity>(ProcessOperation.Retry) { CanConstruct = p => p.State.InState(ProcessState.Error, ProcessState.Canceled, ProcessState.Finished, ProcessState.Suspended), ToStates = { ProcessState.Created }, Construct = (p, _) => p.Algorithm.Create(p.Data, p) }.Register(); }
public ProcessLogicState View() { ProcessLogicState state = ProcessRunnerLogic.ExecutionState(); return(state); }
// 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); } } }