Пример #1
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            HangfireAspNet.Use(GetHangfireServers);
            ScheduleContext context = new ScheduleContext();

            //string UserName = "******";
            //    string Password = "******";
            if (context.Users.Count(x => x.Username == "ash.barbour") == 0)
            {
                var user = new User
                {
                    Username      = "******",
                    RoleId        = (int)Roles.Admin,
                    Email         = "*****@*****.**",
                    Password      = "******",
                    FirstName     = "Ash",
                    LastName      = "Barbour",
                    EmailVerified = true,
                    InActive      = false
                };
                context.Users.Add(user);
                context.SaveChanges();
            }
        }
Пример #2
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            System.Web.Http.GlobalConfiguration.Configure(WebApiConfig.Register);
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);
            HangfireAspNet.Use(GetHangfireServers);


            //BackgroundJob.Enqueue(() => CrawlerJobs.RemoveAll());
            //BackgroundJob.Enqueue(() => CrawlerJobs.GetDiscounts());

            //using (var connection = JobStorage.Current.GetConnection())
            //{

            //    foreach (var recurringJob in StorageConnectionExtensions.GetRecurringJobs(connection))
            //    {
            //        RecurringJob.RemoveIfExists(recurringJob.Id);
            //    }
            //}
            // BackgroundJob.Enqueue(() => CrawlerJobs.AddGame());


            //RecurringJob.AddOrUpdate(() => CrawlerJobs.RemoveAll(), Cron.Daily);
            var manager = new RecurringJobManager();

            manager.RemoveIfExists("500");
            manager.AddOrUpdate("500", () => CrawlerJobs.GetDiscounts(), Cron.Daily);
            manager.Trigger("500");
        }
Пример #3
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     HangfireAspNet.Use(GetHangfireServers);
 }
Пример #4
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);

            HangfireAspNet.Use(GetHangfireServers);

            // Let's also create a sample background job
            RecurringJob.AddOrUpdate(() => new CategoryController().SendMail(), "* */12 * * *");
        }
Пример #5
0
 protected void Application_Start()
 {
     AreaRegistration.RegisterAllAreas();
     FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
     RouteConfig.RegisterRoutes(RouteTable.Routes);
     BundleConfig.RegisterBundles(BundleTable.Bundles);
     HangfireAspNet.Use(GetHangfireServers);
     ApiDohvatPrognoza dohvat = new ApiDohvatPrognoza();
     var dretvaId             = BackgroundJob.Enqueue(() => dohvat.ApiPriprema());
 }
        private static IKernel CreateKernel()
        {
            var modules = new INinjectModule[] { new ServiceModule("Context", "SyncContext") };
            var kernel  = new StandardKernel(modules);

            try
            {
                kernel.Bind <Func <IKernel> >().ToMethod(ctx => () => new Bootstrapper().Kernel);
                kernel.Bind <IHttpModule>().To <HttpApplicationInitializationHttpModule>();
                RegisterServices(kernel);
                //Hangfire init
                GlobalConfiguration.Configuration.UseNinjectActivator(kernel);
                HangfireAspNet.Use(GetHangfireServers);
                return(kernel);
            }
            catch
            {
                kernel.Dispose();
                throw;
            }
        }
        public void Start()
        {
            lock (_lockObject)
            {
                if (_started)
                {
                    return;
                }

                _started = true;

                HostingEnvironment.RegisterObject(this);

                //GlobalConfiguration.Configuration
                //    .UseSqlServerStorage(System.Configuration.ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
                //// Specify other options here

                //_backgroundJobServer = new BackgroundJobServer();
                HangfireAspNet.Use(GetHangfireServers);
            }
        }
Пример #8
0
        protected void Application_Start()
        {
            AreaRegistration.RegisterAllAreas();
            FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
            RouteConfig.RegisterRoutes(RouteTable.Routes);
            BundleConfig.RegisterBundles(BundleTable.Bundles);


            // Parsing background job initialization

            HangfireAspNet.Use(GetHangfireServers);

            // If of the job used to identify parsing activity
            var jobId = ConfigurationManager.AppSettings["ParsingJobId"] ?? "parsing";

            // Schedule parsing as it is written in the config file
            // or at 3am UTC
            var cronStr = ConfigurationManager.AppSettings["ParsingCron"] ?? "0 3 * * *";

            RecurringJob.AddOrUpdate(jobId, () => Models.Parser.Start(), cronStr);
        }
Пример #9
0
 public void Preload(string[] parameters)
 {
     HangfireAspNet.Use(Startup.GetHangfireConfiguration);
 }
Пример #10
0
 public void Preload(string[] parameters)
 {
     Database.SetInitializer(new MigrateDatabaseToLatestVersion <HighlighterDbContext, Configuration>());
     HangfireAspNet.Use(Startup.GetHangfireConfiguration);
 }