private void ExecuteServiceActions() { logger.Info(""); logger.Info("*********************************************************************************************"); logger.Info("Service execution triggered"); if (ProcessorHelper.IsExecutionCompleted(ServiceProcessors.WindowsServices.DailyAllocationsUpdater)) { logger.Info("Service execution completed already. It will not be processed again."); return; } try { AllocationsUpdaterServiceProcessor processor = new AllocationsUpdaterServiceProcessor(); logger.Info("Processing allocations"); int newEntries = processor.ProcessAllocations(); logger.Info($"There are {newEntries} entries had been processed"); processor.ProcessExpiredAllocations(); } catch (Exception exp) { logger.Error("Error while executing the service"); logger.Error(exp); } finally { logger.Info("Execution completed"); logger.Info("*********************************************************************************************"); } }
private void ExecuteServiceActions() { logger.Info(""); logger.Info("*********************************************************************************************"); logger.Info($"Service execution triggered on {DateTime.Today.DayOfWeek}"); if (ProcessorHelper.IsExecutionCompleted(ServiceProcessors.WindowsServices.WeeklyAllocationsMailer)) { logger.Info("Service execution completed already. It will not be processed again."); return; } try { if (dayOfWeek != (int)DateTime.Today.DayOfWeek) { logger.Info($"Skipping service execution as it is {DateTime.Today.DayOfWeek.ToString()}."); return; } logger.Info("Initiating processor"); AllocationsMessengerServiceProcessor processor = new AllocationsMessengerServiceProcessor(); processor.GenerateResourceAllocationReport(appTempDirectory); } catch (Exception exp) { logger.Error("Error while executing the service"); logger.Error(exp); } finally { logger.Info("Execution completed"); logger.Info("*********************************************************************************************"); } }
private void ExecuteServiceActions() { logger.Info("*********************************************************************************************"); logger.Info("Service execution triggered"); if (ProcessorHelper.IsExecutionCompleted(ServiceProcessors.WindowsServices.ManagementNotifications)) { logger.Info("Service execution completed already. It will not be processed again."); return; } try { if (dayOfExecution != DateTime.Today.Day) { logger.Info($"Service will not be processed today as today is not {dayOfExecution} as configured"); return; } int reportingDay = 27; if (DateTime.Today.DayOfWeek == DayOfWeek.Thursday) { reportingDay += 1; } else if (DateTime.Today.DayOfWeek == DayOfWeek.Friday) { reportingDay += 2; } ManagementNotificationsProcessor processor = new ManagementNotificationsProcessor(); processor.GenerateManagementNotifications(appTempDirectory, reportingDay); } catch (Exception exp) { logger.Error("Error while executing the service"); logger.Error(exp); } finally { logger.Info("Service execution completed"); logger.Info("*********************************************************************************************"); } }