Esempio n. 1
0
 public static BatchCreationResult RunImmediateBatchCreation(tblMessageSchedule Schedule, int Priority, ISqlLogic SqlLogic, MessagesModuleLogic Logic)
 {
     lock (ImmediateBatchCreation_L) {
         using (var manager = BatchCreationManager.NewInstance(SqlLogic, Logic)) {
             var creator = new BatchCreator(manager);
             var result  = creator.CreateBatch(Schedule, Priority);
             manager.SaveResultsToDB(new[] { result });
             return(result);
         }
     }
 }
Esempio n. 2
0
        public static void RunScheduledBatchCreation(DateTime StartDate, int minutesPeriod, ISqlLogic sqlLogic)
        {
            if (minutesPeriod < 1)
            {
                throw new ArgumentOutOfRangeException("minutesPeriod should be greater or equal to 1");
            }

            using (var manager = BatchCreationManager.NewInstance(StartDate, minutesPeriod, sqlLogic)) {
                var shedules = manager.GetActualMessageSchedules();
                var creator  = new BatchCreator(manager);
                var results  = new List <BatchCreationResult>();
                foreach (var sched in shedules)
                {
                    results.Add(creator.CreateBatch(sched, 0));
                }
                manager.SaveResultsToDB(results);
            }
        }