// This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(
            ILoggerFactory loggerFactory,
            IApplicationBuilder app,
            IHostingEnvironment env,
            IServiceProvider serviceProvider,
            IOptions <ConfigSettingsBase> configSettingsBase,
            ISchedulesContainer schedulesContainer)
        {
            app.UseHangfireServer();
            app.UseAuthentication();
            app.UseHangfireDashboard("/jobs", new DashboardOptions
            {
                Authorization = new[] { new AuthoritionDashboardFilter() }
            });

            loggerFactory.AddConsole();

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

            app.UseStaticFiles();
            app.UseMvcWithDefaultRoute();

            // Configure hangfire to use the new JobActivator we defined.
            GlobalConfiguration.Configuration.UseActivator(new HangfireActivator(serviceProvider));

            //Sample HTTP JOB
            var apiEndPoint       = configSettingsBase.Value.ApiEndPoint;
            var authorityEndPoint = configSettingsBase.Value.AuthorityEndPoint;

            RecurringJob.AddOrUpdate(() => ExecuteCallHttProcess(authorityEndPoint, apiEndPoint), Cron.Daily);
            ConfigureJobs(serviceProvider, schedulesContainer, env);
        }
        private void ConfigureJobs(IServiceProvider serviceProvider, ISchedulesContainer schedulesContainer, IHostingEnvironment env)
        {
            schedulesContainer.Add(serviceProvider.GetService <ISchedules <SampleJob> >());

            var minutesInDay  = 1440;
            var minutesInWeek = 7200;

            foreach (var job in schedulesContainer.GetJobs())
            {
                if (job.GetMinutesInterval() >= minutesInWeek)
                {
                    RecurringJob.AddOrUpdate(() => job.Execute(), Cron.Weekly(DayOfWeek.Saturday));
                }
                else if (job.GetMinutesInterval() >= minutesInDay)
                {
                    RecurringJob.AddOrUpdate(() => job.Execute(), Cron.DayInterval(job.GetMinutesInterval() / minutesInDay));
                }
                else
                {
                    RecurringJob.AddOrUpdate(() => job.Execute(), Cron.MinuteInterval(job.GetMinutesInterval()));
                }
            }
        }