コード例 #1
0
        public WorkingShift CreateShiftWithConfigParams(DateTime startDate)
        {
            var shiftStartTime = ShiftStartTimeConfigKey.ParseTimeSpan(ParsingTimeExceptionMessage);
            var shiftLength    = ShiftLengthConfigKey.ParseTimeSpan(ParsingTimeExceptionMessage);
            var shiftStart     = startDate.Add(shiftStartTime);
            var shiftEnd       = startDate.Add(shiftStartTime + shiftLength);
            var shiftSessions  = _sessionsService.GetSessionsForArincMetrics(
                ConfigurationManager.AppSettings.Get("UriForSessionRequest"),
                shiftStart,
                shiftEnd)
                                 .ToArray();
            var sessionsForLogs = _sessionsService.GetSessionsForLogs(
                ConfigurationManager.AppSettings.Get("UriForSessionRequest"),
                shiftStart,
                shiftEnd)
                                  .ToArray();
            var simulators = ConfigurationManager.AppSettings["Simulators"]?.Split(',');

            return(new WorkingShift
            {
                StartDate = DateTime.Today,
                ShiftLength = shiftLength,
                Sessions = shiftSessions,
                Statistic = _documentsService.GetSessionsStatistic(shiftSessions, simulators),
                ShiftLogs = _documentsService.GetTrainingLogs(sessionsForLogs, shiftEnd)
            });
        }