public static BusinessCalendar isProcessingDay(IEntityFramework entityFramework) { JsonTextReader reader =null; BusinessCalendar current = null; try { var currentDate = DateTime.Today; var jSon = entityFramework.GetBusinessCalendar.FirstOrDefault(); var serializer = JsonSerializerFactory.Get(); if (jSon != null) { reader = new JsonTextReader(new StringReader(jSon.ref_value)); current = (BusinessCalendar)serializer.Deserialize(reader, typeof(BusinessCalendar)); Log.Debug("[TaskHelper]:[isProcessingDay]: BusinessCalendar Object is obtained."); } } catch(Exception ex) { Log.Error("[TaskHelper]:[isProcessingDay]: An error occurred in deserialising value from {entityFramework}.",reader.ToString()); throw new InvalidOperationException(ex.ToString()); } return current; }
public TaskProcessor(IComponentContext container) { Log.Information("Task Processor is started."); entityFramework = container.Resolve<IEntityFramework>(); BusinessCalendar currentValue = TaskHelper.isProcessingDay(entityFramework); if (currentValue == null) throw new InvalidOperationException(); if (currentValue.businessDay.Date != DateTime.Today.Date || currentValue.inEndOfDay == true) { Log.Information("TaskProcessor: Either it is a non processing day or End of Day Process did not run. Business Day {entityFrameWorkValue}, InEndProcessing Day {finishedEndOfDay}, Today's date {today}", currentValue.businessDay.ToString(), currentValue.inEndOfDay, DateTime.Today.ToString()); } else { var schedulerHelper = container.Resolve<ISchedulerHelper>(); schedulerHelper.ScheduleStartOfDayProcess(schedulerHelper.GetSchedulerReference()); } }
public SchedulerHelper(IEntityFramework entityFramework) { this.entityFramework = entityFramework; }
public RunEntityFramework(IEntityFramework entityFramework) { _entityFramework = entityFramework; }