Esempio n. 1
0
        public void Start()
        {
            pathToScheduleFolder = Directory.CreateDirectory(DateTime.Now.ToString("dd.MM.yyyy(HH.mm)")).FullName;

            Core core = new Core(CurrentBase.EStorage, CurrentBase.Factors);
            core.SaveCreatedSchedule = SaveCreatedSchedule;
            core.logger = loggingService;
            core.FixedClasses = vip.GetVipClasses();
            loggingService.Info("Загружено ядро. Запуск...");

            List<FullSchedule> schedules = core.Run().ToList<FullSchedule>();

            loggingService.Info("Итоговое расписание готово");

            //ScheduleExcel excel = new ScheduleExcel(schedules[0], storage);
            //ScheduleExcelTeacher excelTeach = new ScheduleExcelTeacher(schedules[0], storage);
            //Parallel.Invoke(
            //() =>
            //{
            //    loggingService.Info("Выгрузка в Excel расписания студентов...");
            //    excel.LoadToExcel();
            //    loggingService.Info("Расписание студентов выгружено в Excel");
            //},
            //() =>
            //{
            //    loggingService.Info("Выгрузка в Excel расписания преподавателей...");
            //    excelTeach.LoadToExcel();
            //    loggingService.Info("Расписание преподавателей выгружено в Excel");
            //});

            //ScheduleLoader.SaveSchedule("schedule.dat", new Schedule(schedules[0]));
        }
Esempio n. 2
0
 public static void Run()
 {
     AllocConsole();
     List<FactorSettings> factors = FactorsEditors.GetFactorsForCreateSchedule().ToList();
     Core core = new Core(CurrentBase.EStorage, factors);
     core.logger = new NLogLoggingService();
     core.FixedClasses = GetFixedClasses(factors);
     core.logger.Info("Загружено ядро. Запуск...");
     List<FullSchedule> schedules = core.Run().ToList<FullSchedule>();
     int scheduleNumber = 0;
     for (int scheduleIndex = 0; scheduleIndex < schedules.Count; scheduleIndex++)
     {
         string scheduleKey = "Расписание " + scheduleNumber;
         if (!CurrentBase.Schedules.Keys.Contains(scheduleKey))
         {
             CurrentBase.Schedules.Add(scheduleKey, new Schedule(schedules[scheduleIndex]) { Date = DateTime.Now });
         }
         else
         {
             scheduleIndex--;
             scheduleNumber++;
         }
     }
     core.logger.Info("Расписание сформировано");
     FreeConsole();
 }