Example #1
0
        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;
        }
Example #2
0
        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());
            }
        }
Example #3
0
 public SchedulerHelper(IEntityFramework entityFramework)
 {
     this.entityFramework = entityFramework;
 }
Example #4
0
 public RunEntityFramework(IEntityFramework entityFramework)
 {
     _entityFramework = entityFramework;
 }