protected virtual void AddForecastToDataSet(MaintenanceStatusDataSet destinationDataSet)
        {
            var avgUtilizationCycles = _forecastData != null ? _forecastData.AverageUtilization.Cycles : 0;
            var avgUtilizationHours  = _forecastData != null ? _forecastData.AverageUtilization.Hours : 0;
            var avgUtilizationType   = _forecastData != null
                                            ? _forecastData.AverageUtilization.SelectedInterval.ToString()
                                            : "";

            var forecastCycles = _forecastData != null
                ? _forecastData.ForecastLifelength.Cycles != null ? (int)_forecastData.ForecastLifelength.Cycles : 0
                : 0;
            var forecastHours = _forecastData != null
                ? _forecastData.ForecastLifelength.Hours != null ? (int)_forecastData.ForecastLifelength.Hours : 0
                : 0;
            var forecastDays = _forecastData != null
                ? _forecastData.ForecastLifelength.Days != null ? (int)_forecastData.ForecastLifelength.Days : 0
                : 0;
            var forecastDate = _forecastData != null
                ? _forecastData.ForecastDate.ToString(new GlobalTermsProvider()["DateFormat"].ToString())
                : "";

            destinationDataSet.ForecastTable.AddForecastTableRow(avgUtilizationCycles,
                                                                 avgUtilizationHours,
                                                                 avgUtilizationType,
                                                                 forecastCycles,
                                                                 forecastHours,
                                                                 forecastDays,
                                                                 forecastDate);
        }
        /// <summary>
        /// Добавление дополнительной информации
        /// </summary>
        /// <param name="destinationDateSet"></param>
        private void AddAdditionalDataToDataSet(MaintenanceStatusDataSet destinationDateSet)
        {
            string reportFooter         = new GlobalTermsProvider()["ReportFooter"].ToString();
            string reportFooterPrepared = new GlobalTermsProvider()["ReportFooterPrepared"].ToString();
            string reportFooterLink     = new GlobalTermsProvider()["ProductWebsite"].ToString();

            destinationDateSet.AdditionalDataTAble.AddAdditionalDataTAbleRow(_reportTitle, OperatorLogotype, _filterSelection?"Schedule":"Unschedule", DateAsOf, reportFooter, reportFooterPrepared, reportFooterLink);
        }
        /// <summary>
        /// Добавление директив в таблицу данных
        /// </summary>
        /// <param name="dataset">Таблица, в которую добавляются данные</param>
        protected virtual void AddDirectivesToDataSet(MaintenanceStatusDataSet dataset)
        {
            GlobalObjects.MaintenanceCheckCalculator.GetNextPerformanceGroup(_reportedDirectives, _filterSelection);

            foreach (MaintenanceCheck t in _reportedDirectives)
            {
                var        hiddenRemark   = "";
                Lifelength lastCompliance = Lifelength.Null,
                           repeatInterval = Lifelength.Null;
                var lastComplianceDate    = "";
                var used = Lifelength.Null;

                var remarks = t.LastPerformance != null ? t.LastPerformance.Remarks : "";
                //расчет остатка от выполнения с даты производтсва
                var next      = t.NextPerformanceSource;
                var remains   = t.Remains;
                var condition = t.Condition;

                if (t.LastPerformance != null)
                {
                    if (t.Interval != null)
                    {
                        repeatInterval = t.Interval;
                    }

                    lastComplianceDate = t.LastPerformance.RecordDate.ToString(new GlobalTermsProvider()["DateFormat"].ToString());
                    lastCompliance     = t.LastPerformance.OnLifelength;
                    used.Add(_current);
                    used.Substract(lastCompliance);
                }
                var nextComplianceDate = t.NextPerformanceDate != null
                                                ? ((DateTime)t.NextPerformanceDate).ToString(new GlobalTermsProvider()["DateFormat"].ToString())
                                                : "";

                dataset.ItemsTable.AddItemsTableRow(remarks,
                                                    hiddenRemark,
                                                    "",
                                                    t.Name,
                                                    repeatInterval.Days != null ? repeatInterval.Days.ToString() : "",
                                                    repeatInterval.Hours != null ? repeatInterval.Hours.ToString() : "",
                                                    repeatInterval.Cycles != null ? repeatInterval.Cycles.ToString() : "",
                                                    lastComplianceDate,
                                                    lastCompliance.Hours != null ? lastCompliance.Hours.ToString() : "",
                                                    lastCompliance.Cycles != null ? lastCompliance.Cycles.ToString() : "",
                                                    used.Days != null ? used.Days.ToString() : "",
                                                    used.Hours != null ? used.Hours.ToString() : "",
                                                    used.Cycles != null ? used.Cycles.ToString() : "",
                                                    nextComplianceDate,
                                                    next.Hours != null ? next.Hours.ToString() : "",
                                                    next.Cycles != null ? next.Cycles.ToString() : "",
                                                    remains.Days != null ? remains.Days.ToString() : "",
                                                    remains.Hours != null ? remains.Hours.ToString() : "",
                                                    remains.Cycles != null ? remains.Cycles.ToString() : "",
                                                    condition.ToString());
            }
        }
        /// <summary>
        /// Построить источник данных (DataSet) для вывода в отчет
        /// </summary>
        /// <returns></returns>
        public virtual MaintenanceStatusDataSet GenerateDataSet()
        {
            MaintenanceStatusDataSet dataset = new MaintenanceStatusDataSet();

            AddAircraftToDataset(dataset);
            AddStatusToDataset(dataset);
            AddDirectivesToDataSet(dataset);
            AddAdditionalDataToDataSet(dataset);
            AddForecastToDataSet(dataset);
            return(dataset);
        }
        /// <summary>
        /// Добавляется элемент в таблицу данных
        /// </summary>
        /// <param name="destinationDataSet">Таблица, в которую добавляется элемент</param>
        private void AddAircraftToDataset(MaintenanceStatusDataSet destinationDataSet)
        {
            if (_reportedAircraft == null)
            {
                return;
            }

            var reportAircraftLifeLenght = GlobalObjects.CasEnvironment.Calculator.GetCurrentFlightLifelength(_reportedAircraft);

            var    manufactureDate    = _reportedAircraft.ManufactureDate.ToString(new GlobalTermsProvider()["DateFormat"].ToString());
            var    serialNumber       = ReportedAircraft.SerialNumber;
            var    model              = _reportedAircraft.Model.ToString();
            var    sinceNewHours      = reportAircraftLifeLenght.Hours != null ? (int)reportAircraftLifeLenght.Hours : 0;
            var    sinceNewCycles     = reportAircraftLifeLenght.Cycles != null ? (int)reportAircraftLifeLenght.Cycles : 0;
            var    registrationNumber = ReportedAircraft.RegistrationNumber;
            int    averageUtilizationHours;
            int    averageUtilizationCycles;
            string averageUtilizationType;

            if (_forecastData == null)
            {
                var aircraftFrame      = GlobalObjects.ComponentCore.GetBaseComponentById(_reportedAircraft.AircraftFrameId);
                var averageUtilization = GlobalObjects.AverageUtilizationCore.GetAverageUtillization(aircraftFrame);

                averageUtilizationHours  = (int)averageUtilization.Hours;
                averageUtilizationCycles = (int)averageUtilization.Cycles;
                averageUtilizationType   = averageUtilization.SelectedInterval == UtilizationInterval.Dayly ? "Day" : "Month";
            }
            else
            {
                averageUtilizationHours  = (int)_forecastData.AverageUtilization.Hours;
                averageUtilizationCycles = (int)_forecastData.AverageUtilization.Cycles;
                averageUtilizationType   =
                    _forecastData.AverageUtilization.SelectedInterval == UtilizationInterval.Dayly ? "Day" : "Month";
            }

            var lineNumber     = (ReportedAircraft).LineNumber;
            var variableNumber = (ReportedAircraft).VariableNumber;

            destinationDataSet.AircraftDataTable.AddAircraftDataTableRow(serialNumber,
                                                                         manufactureDate,
                                                                         sinceNewHours,
                                                                         sinceNewCycles,
                                                                         registrationNumber, model, lineNumber, variableNumber,
                                                                         averageUtilizationHours, averageUtilizationCycles, averageUtilizationType);
        }
        /// <summary>
        /// Добавляется элемент в таблицу данных
        /// </summary>
        /// <param name="destinationDataSet">Таблица, в которую добавляется элемент</param>
        private void AddStatusToDataset(MaintenanceStatusDataSet destinationDataSet)
        {
            if (_reportedAircraft == null)
            {
                return;
            }

            MaintenanceCheckComplianceGroup lastComplianceGroup =
                _reportedDirectives.GetLastComplianceCheckGroup(_filterSelection, _reportedAircraft.ItemId);
            MaintenanceCheckGroupByType nextComplianceGroup =
                GlobalObjects.MaintenanceCheckCalculator.GetNextCheckComplianceGroup(_reportedDirectives, _filterSelection, _reportedAircraft);
            MaintenanceCheck minStepCheck = _reportedDirectives != null
                                                ? _reportedDirectives.GetMinStepCheck(_filterSelection)
                                                : null;

            Lifelength reportAircraftLifeLenght =
                GlobalObjects.CasEnvironment.Calculator.GetCurrentFlightLifelength(_reportedBaseComponent);
            Lifelength minStep = minStepCheck != null ? minStepCheck.Interval : Lifelength.Null;
            Lifelength used    = new Lifelength(reportAircraftLifeLenght);
            Lifelength remain  = Lifelength.Null;

            string lastComplianceDate = "", lastComplianceHours = "", lastComplianceCycles = "";
            string nextComplianceDate = "", nextComplianceHours = "", nextComplianceCycles = "";
            string remarks = "";

            if (lastComplianceGroup != null)
            {
                lastComplianceDate   = lastComplianceGroup.LastGroupComplianceDate.ToString(new GlobalTermsProvider()["DateFormat"].ToString());
                lastComplianceCycles = lastComplianceGroup.LastGroupComplianceLifelength.Cycles != null
                                           ? lastComplianceGroup.LastGroupComplianceLifelength.Cycles.ToString()
                                           : "";

                lastComplianceHours = lastComplianceGroup.LastGroupComplianceLifelength.Hours != null
                                           ? lastComplianceGroup.LastGroupComplianceLifelength.Hours.ToString()
                                           : "";

                used.Substract(lastComplianceGroup.LastGroupComplianceLifelength);
                remarks = lastComplianceGroup.Remarks;
            }
            if (nextComplianceGroup != null)
            {
                nextComplianceDate   = nextComplianceGroup.GroupComplianceDate.ToString(new GlobalTermsProvider()["DateFormat"].ToString());
                nextComplianceCycles = nextComplianceGroup.GroupComplianceLifelength.Cycles != null
                                           ? nextComplianceGroup.GroupComplianceLifelength.Cycles.ToString()
                                           : "";

                nextComplianceHours = nextComplianceGroup.GroupComplianceLifelength.Hours != null
                                           ? nextComplianceGroup.GroupComplianceLifelength.Hours.ToString()
                                           : "";

                remain.Add(nextComplianceGroup.GroupComplianceLifelength);
                remain.Substract(reportAircraftLifeLenght);
            }

            string usedHours = used.Hours != null?used.Hours.ToString() : "";

            string usedCycles = used.Cycles != null?used.Cycles.ToString() : "";

            string usedDays = used.Days != null?used.Days.ToString() : "";

            string remainHours = remain.Hours != null?remain.Hours.ToString() : "";

            string remainCycles = remain.Cycles != null?remain.Cycles.ToString() : "";

            string remainDays = remain.Days != null?remain.Days.ToString() : "";

            destinationDataSet.StatusTable.AddStatusTableRow(_filterSelection ? "Schedule" : "Unschedule",
                                                             lastComplianceGroup != null
                                                                ? lastComplianceGroup.ToStringCheckNames()
                                                                : "",
                                                             nextComplianceGroup != null
                                                                ? nextComplianceGroup.ToStringCheckNames()
                                                                : "",
                                                             minStep.Hours != null ? minStep.Hours.ToString() : "",
                                                             minStep.Cycles != null ? minStep.Cycles.ToString() : "",
                                                             minStep.Days != null ? minStep.Days.ToString() : "",
                                                             lastComplianceDate,
                                                             lastComplianceHours,
                                                             lastComplianceCycles,
                                                             usedDays,
                                                             usedHours,
                                                             usedCycles,
                                                             nextComplianceDate,
                                                             nextComplianceHours,
                                                             nextComplianceCycles,
                                                             remainDays,
                                                             remainHours,
                                                             remainCycles,
                                                             remarks);
        }