public static void Agendar(string timeZone, string cronCode) { var processamentoOrdemCompra = InjetorDependencia.ObterServicos <IProcesssaOrdemCompraSolicitada>(); TimeZoneInfo southZone = TimeZoneInfo.FindSystemTimeZoneById(timeZone); RecurringJob.AddOrUpdate(() => processamentoOrdemCompra.Processar(), cronCode, southZone); }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { Thread.CurrentThread.CurrentCulture = new CultureInfo("pt-BR"); Thread.CurrentThread.CurrentUICulture = new CultureInfo("pt-BR"); InjetorDependencia.RegistrarServicos(services); InjetorDependencia.ConfigurarComponentesSeguranca(services, Configuration); services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_2); var configConexao = InjetorDependencia.ObterServicos <ConfiguracaoConexao>(); services.AddHangfire(x => x.UseSqlServerStorage(configConexao.conexaoHangFire)); services.AddHangfireServer(); }