static void ExecutaProcedureTask(Object stateInfo) { Models.GAContext context = new Models.GAContext(); Parameter parameter = context.Parameter.FirstOrDefault(); ProcedureSchedule procedureSchedule = (ProcedureSchedule)stateInfo; GALibrary.GALogs.SaveLogProcedure(procedureSchedule, "Start", "Inicio do procedimento", 2, parameter); Lib.Updates.ExecuteProcedure(procedureSchedule); }
static void ExecutaUpdateTask(Object stateInfo) { Models.GAContext context = new Models.GAContext(); Parameter parameter = context.Parameter.FirstOrDefault(); UpdateGA update = (UpdateGA)stateInfo; GALibrary.GALogs.SaveLogUpdate(update, "Start", "Inicio da atualização", 2, parameter); UpdateGA updateStatus = Lib.Updates.UpdateApplication(update.Id); if (update.AlertUser) { CallSendMail(updateStatus); } }
static void CallSendMail(UpdateGA update) { Models.GAContext context = new Models.GAContext(); //Busca configuração de E-mails e LDAP var builder = new ConfigurationBuilder().SetBasePath(System.IO.Directory.GetCurrentDirectory()).AddJsonFile("appsettings.json", optional: true, reloadOnChange: true); IConfigurationRoot configuration = builder.Build(); var emailSettings = new EmailSettings(); configuration.GetSection("EmailSettings").Bind(emailSettings); var ldap = new Ldap(); configuration.GetSection("Ldap").Bind(ldap); //Busca parametros da aplicação Parameter parameter = context.Parameter.FirstOrDefault(); //Envia e-mail GALibrary.GAMail.SendMail(null, 1, update, emailSettings, parameter, "", ldap); }