public void Configure(IApplicationBuilder app) { app.UseQuartzmin(new QuartzminOptions() { Scheduler = DemoScheduler.Create().Result, }); }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IWebHostEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); } var scheduler = DemoScheduler.Create().Result; app.UseStaticFiles(); app.UseRouting(); app.UseAuthorization(); app.UseQuartzmin(new QuartzminOptions() { Scheduler = scheduler, VirtualPathRoot = "/", UseLocalTime = true, DefaultDateFormat = "yyyy-MM-dd", DefaultTimeFormat = "HH:mm:ss \"GMT\"zzz" }); app.UseEndpoints(endpoints => { endpoints.MapDefaultControllerRoute(); endpoints.MapRazorPages(); }); }
public void Configure(IApplicationBuilder app) { app.UseQuartzmin(new QuartzminOptions() { UseLocalTime = true, Scheduler = DemoScheduler.Create().Result, VirtualPathRoot = "/test", }); }
public void Configuration(IAppBuilder app) { app.UseQuartzmin(new QuartzminOptions() { Scheduler = DemoScheduler.Create().Result, DefaultDateFormat = "dd.MM.yyyy", VirtualPathRoot = "/test", }); }
static void Main(string[] args) { var scheduler = DemoScheduler.Create().Result; scheduler.Start(); while (!scheduler.IsShutdown) { Thread.Sleep(500); } }
public ActionResult Load() { // throw new Exception(); SchedulerLoadRequest loadRequest = null; ulong? requestId = null; try { string json = Request.QueryString.Get("q"); var scheduler = new DemoScheduler(); // decode request object try { loadRequest = JsonConvert.DeserializeObject<SchedulerLoadRequest>(json); } catch (Exception) { throw new Exception("Invalid load JSON"); } // get request identifier requestId = loadRequest.requestId; // initialize response object var loadResponse = new SchedulerLoadResponse(requestId); if (loadRequest.events != null) loadResponse.setEvents(scheduler.getEvents("Guest")); if (loadRequest.resources != null) loadResponse.setResources( scheduler.getResources(Convert.ToInt32(loadRequest.resources["page"]), Convert.ToInt32(loadRequest.resources["pageSize"])), scheduler.getResourceCount() ); // put current server revision to the response loadResponse.revision = scheduler.getRevision(); // just in case we make any changes during load request processing scheduler.context.SaveChanges(); return Content(JsonConvert.SerializeObject(loadResponse, new JsonSerializerSettings { ReferenceLoopHandling = ReferenceLoopHandling.Ignore }), "application/json"); } catch (Exception e) { return Content(JsonConvert.SerializeObject(new ErrorResponse(e, requestId)), "application/json"); } }
// This method gets called by the runtime. Use this method to configure the HTTP request pipeline. public void Configure(IApplicationBuilder app, IHostingEnvironment env) { if (env.IsDevelopment()) { app.UseDeveloperExceptionPage(); } else { app.UseExceptionHandler("/Error"); // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts. app.UseHsts(); } app.UseHttpsRedirection(); app.UseStaticFiles(); app.UseSpaStaticFiles(); app.UseMvc(routes => { routes.MapRoute( name: "default", template: "{controller}/{action=Index}/{id?}"); }); app.UseSpa(spa => { // To learn more about options for serving an Angular SPA from ASP.NET Core, // see https://go.microsoft.com/fwlink/?linkid=864501 spa.Options.SourcePath = "ClientApp"; if (env.IsDevelopment()) { //spa.UseAngularCliServer(npmScript: "start"); } }); app.UseQuartzmin(new QuartzminOptions() { Scheduler = DemoScheduler.Create().Result, }); }
public static void Main(string[] args) { var scheduler = DemoScheduler.Create().Result; var host = WebHost.CreateDefaultBuilder(args).Configure(app => { app.UseQuartzmin(new QuartzminOptions() { Scheduler = scheduler }); }).ConfigureServices(services => { services.AddQuartzmin(); }) .Build(); host.Start(); while (!scheduler.IsShutdown) { Thread.Sleep(250); } }
void CreateScheduler() { scheduler = DemoScheduler.Create(start: false).Result; }
/// <summary> /// Back-end test handler providing database cleanup. /// TODO: WARNING! This code clears the database. Please get rid of this code before running it on production. /// </summary> /// <returns>Empty string.</returns> public string Reset() { var scheduler = new DemoScheduler(); scheduler.Reset(); scheduler.context.SaveChanges(); return ""; }
public ActionResult Sync() { ulong? requestId = null; SchedulerSyncRequest<RoomBooking, Room> syncRequest = null; try { string json = getPostBody(); var scheduler = new DemoScheduler(); // decode request object try { syncRequest = JsonConvert.DeserializeObject<SchedulerSyncRequest<RoomBooking, Room>>(json, new Newtonsoft.Json.Converters.IsoDateTimeConverter { DateTimeFormat = dateFormat }); } catch (Exception) { throw new Exception("Invalid sync JSON"); } // initialize phantom to real Id maps scheduler.InitRowsHolders(); // get request identifier requestId = syncRequest.requestId; // initialize response object var syncResponse = new SchedulerSyncResponse(requestId); // Here we reject client's changes if we suspect that they are out-dated // considering difference between server and client revisions. // You can get rid of this call if you don't need such behavior. scheduler.checkRevision(syncRequest.revision); // if a corresponding store modified data are provided then we handle them ResourceSyncHandler<RoomBooking, Room> resourcesHandler = null; if (syncRequest.resources != null) { resourcesHandler = new ResourceSyncHandler<RoomBooking, Room>(scheduler); syncResponse.resources = resourcesHandler.Handle(syncRequest.resources, ResourceSyncHandler<RoomBooking, Room>.Rows.AddedAndUpdated); } EventSyncHandler<RoomBooking, Room> eventsHandler = null; if (syncRequest.events != null) { eventsHandler = new EventSyncHandler<RoomBooking, Room>(scheduler, dateFormat); syncResponse.events = eventsHandler.Handle(syncRequest.events, EventSyncHandler<RoomBooking, Room>.Rows.AddedAndUpdated); } if (syncRequest.events != null) syncResponse.events = eventsHandler.HandleRemoved(syncRequest.events, syncResponse.events); if (syncRequest.resources != null) syncResponse.resources = resourcesHandler.HandleRemoved(syncRequest.resources, syncResponse.resources); syncResponse.events = AddModifiedRows(scheduler, "events", syncResponse.events); syncResponse.resources = AddModifiedRows(scheduler, "resources", syncResponse.resources); // put current server revision to the response syncResponse.revision = scheduler.getRevision(); scheduler.context.SaveChanges(); return Content(JsonConvert.SerializeObject(syncResponse), "application/json"); } catch (Exception e) { return Content(JsonConvert.SerializeObject(new ErrorResponse(e, requestId)), "application/json"); } }