/// <summary>
        /// Добавляется элемент в таблицу данных
        /// </summary>
        /// <param name="reportedDirective">Добавлямая директива</param>
        /// <param name="destinationDataSet">Таблица, в которую добавляется элемент</param>
        protected override void AddDirectiveToDataset(MaintenanceDirective reportedDirective, MaintenanceDirectivesDataSet destinationDataSet)
        {
            if (reportedDirective == null)
            {
                return;
            }

            string     status = "";
            Lifelength used   = Lifelength.Null;

            //string remarks = reportedDirective.LastPerformance != null ? reportedDirective.LastPerformance.Remarks : reportedDirective.Remarks;
            string remarks       = reportedDirective.Remarks;
            string directiveType = reportedDirective.WorkType.ShortName;
            double cost          = reportedDirective.Cost;
            double mh            = reportedDirective.ManHours;

            if (reportedDirective.Status == DirectiveStatus.Closed)
            {
                status = "C";
            }
            if (reportedDirective.Status == DirectiveStatus.Open)
            {
                status = "O";
            }
            if (reportedDirective.Status == DirectiveStatus.Repetative)
            {
                status = "R";
            }
            if (reportedDirective.Status == DirectiveStatus.NotApplicable)
            {
                status = "N/A";
            }

            string effectivityDate = UsefulMethods.NormalizeDate(reportedDirective.Threshold.EffectiveDate);
            string kits            = "";
            int    num             = 1;

            foreach (AccessoryRequired kit in reportedDirective.Kits)
            {
                kits += num + ": " + kit.PartNumber + "\n";
                num++;
            }

            //расчет остатка с даты производства и с эффективной даты
            //расчет остатка от выполнения с даты производтсва
            string firstPerformanceString    = "";
            string repeatPerformanceToString = reportedDirective.Threshold.RepeatPerformanceToStrings();

            if (reportedDirective.LastPerformance != null)
            {
                used.Add(Current);
                used.Substract(reportedDirective.LastPerformance.OnLifelength);
                if (!reportedDirective.Threshold.RepeatInterval.IsNullOrZero())
                {
                    used.Resemble(reportedDirective.Threshold.RepeatInterval);
                }
                else if (!reportedDirective.Threshold.FirstPerformanceSinceNew.IsNullOrZero())
                {
                    used.Resemble(reportedDirective.Threshold.FirstPerformanceSinceNew);
                }
            }
            else
            {
                firstPerformanceString = reportedDirective.Threshold.FirstPerformanceToStrings();
            }

            destinationDataSet.ItemsTable.AddItemsTableRow(reportedDirective.Applicability,
                                                           remarks,
                                                           reportedDirective.HiddenRemarks,
                                                           reportedDirective.Description.Replace("\r\n", " "),
                                                           reportedDirective.TaskNumberCheck,
                                                           reportedDirective.Access,
                                                           directiveType,
                                                           status,
                                                           effectivityDate,
                                                           firstPerformanceString,
                                                           reportedDirective.LastPerformance != null ? reportedDirective.LastPerformance.ToStrings() : "",
                                                           reportedDirective.NextPerformance != null ? reportedDirective.NextPerformance.ToStrings() : "",
                                                           reportedDirective.Remains.ToStrings(),
                                                           reportedDirective.Condition.ToString(),
                                                           mh,
                                                           cost,
                                                           kits,
                                                           reportedDirective.Zone,
                                                           reportedDirective.ATAChapter != null ? reportedDirective.ATAChapter.ShortName : "",
                                                           reportedDirective.ATAChapter != null ? reportedDirective.ATAChapter.FullName : "",
                                                           reportedDirective.TaskCardNumber,
                                                           reportedDirective.Program.ToString(),
                                                           repeatPerformanceToString,
                                                           used.ToStrings(),
                                                           reportedDirective.MaintenanceCheck != null ? reportedDirective.MaintenanceCheck.ToString() : "N/A");
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Добавляется элемент в таблицу данных
        /// </summary>
        /// <param name="reportedDirective">Добавлямая директива</param>
        /// <param name="destinationDataSet">Таблица, в которую добавляется элемент</param>
        private void AddDirectiveToDataset(object reportedDirective, DirectivesListDataSet destinationDataSet)
        {
            var detailDirective = (ComponentDirective)reportedDirective;
            var detail          = detailDirective.ParentComponent;

            var references = "";

            var title   = "";
            var eo      = "";
            var sb      = "";
            var remarks = detailDirective.LastPerformance != null ? detailDirective.LastPerformance.Remarks : detail.Remarks;


            string status = "";

            if (detailDirective.Status == DirectiveStatus.Closed)
            {
                status = "C";
            }
            if (detailDirective.Status == DirectiveStatus.Open)
            {
                status = "O";
            }
            if (detailDirective.Status == DirectiveStatus.Repetative)
            {
                status = "R";
            }
            if (detailDirective.Status == DirectiveStatus.NotApplicable)
            {
                status = "N/A";
            }
            //string effectivityDate = UsefulMethods.NormalizeDate(detailDirective.Threshold.);
            string equipment = "";//detailDirective.NonDestructiveTest ? "NDT" : "";
            string kits      = "";
            int    num       = 1;

            foreach (var kit in detailDirective.Kits)
            {
                kits += num + ": " + kit.PartNumber + "\n";
                num++;
            }

            //расчет остатка с даты производства и с эффективной даты
            Lifelength sinceNewThreshold = Lifelength.Null, sinceEffDateThreshold = Lifelength.Null;
            Lifelength sinceNewRemain = Lifelength.Null, sinceEffDateRemain = Lifelength.Null;

            Lifelength firstCompliance = Lifelength.Null,
                       lastCompliance  = Lifelength.Null,
                       repeatInterval  = Lifelength.Null,
                       nextCompliance,
                       remain          = Lifelength.Null;
            string firstComplianceDate = "",
                   lastComplianceDate  = "",
                   nextComplianceDate,
                   sinceNewComplianceDate = "";
            Lifelength used = Lifelength.Null;

            if (detailDirective.Threshold.FirstPerformanceSinceNew != null)
            {
                sinceNewThreshold = detailDirective.Threshold.FirstPerformanceSinceNew;
                if (sinceNewThreshold.Days != null)
                {
                    sinceNewComplianceDate =
                        _manufactureDate.AddDays(sinceNewThreshold.Days.Value).ToString(
                            new GlobalTermsProvider()["DateFormat"].ToString());
                }
                if (detailDirective.LastPerformance == null)
                {
                    sinceNewRemain.Add(detailDirective.Threshold.FirstPerformanceSinceNew);
                    sinceNewRemain.Substract(_current);
                    sinceNewRemain.Resemble(detailDirective.Threshold.FirstPerformanceSinceNew);
                }
            }

            GlobalObjects.PerformanceCalculator.GetNextPerformance(detailDirective);
            if (detailDirective.LastPerformance != null)
            {
                firstComplianceDate =
                    detailDirective.PerformanceRecords[0].RecordDate.ToString(
                        new GlobalTermsProvider()["DateFormat"].ToString());
                firstCompliance = detailDirective.PerformanceRecords[0].OnLifelength;

                if (detailDirective.Threshold.RepeatInterval != null)
                {
                    repeatInterval = detailDirective.Threshold.RepeatInterval;
                }

                lastComplianceDate =
                    detailDirective.LastPerformance.RecordDate.ToString(new GlobalTermsProvider()["DateFormat"].ToString());
                lastCompliance = detailDirective.LastPerformance.OnLifelength;

                used.Add(_current);
                used.Substract(detailDirective.LastPerformance.OnLifelength);

                if (detailDirective.NextPerformanceSource != null)
                {
                    remain.Add(detailDirective.NextPerformanceSource);
                    remain.Substract(_current);
                    remain.Resemble(detailDirective.Threshold.RepeatInterval);
                }
            }
            else
            {
                repeatInterval = detailDirective.Threshold.RepeatInterval;
            }

            nextComplianceDate = detailDirective.NextPerformanceDate != null
                                     ? ((DateTime)detailDirective.NextPerformanceDate).ToString(
                new GlobalTermsProvider()["DateFormat"].ToString())
                                     : "";
            nextCompliance = detailDirective.NextPerformanceSource ?? Lifelength.Null;

            var condition = detailDirective.Condition.ToString();

            destinationDataSet.ItemsTable.AddItemsTableRow("Applicability",
                                                           remarks,
                                                           detail.HiddenRemarks,
                                                           detail.Description,
                                                           title,
                                                           references,
                                                           detailDirective.DirectiveType.ToString(),
                                                           status,
                                                           "",
                                                           sinceNewThreshold.Hours ?? 0,
                                                           sinceNewThreshold.Cycles ?? 0,
                                                           sinceNewComplianceDate,
                                                           detailDirective.Threshold.FirstPerformanceConditionType == ThresholdConditionType.WhicheverFirst ? "W.O.F" : "W.O.L",
                                                           sinceNewRemain.Hours ?? 0,
                                                           sinceNewRemain.Cycles ?? 0,
                                                           sinceNewRemain.Days ?? 0,
                                                           sinceEffDateThreshold.Hours ?? 0,
                                                           sinceEffDateThreshold.Cycles ?? 0,
                                                           sinceEffDateThreshold.Days != null ? sinceEffDateThreshold.Days.ToString() : "",
                                                           detailDirective.Threshold.FirstPerformanceConditionType == ThresholdConditionType.WhicheverFirst ? "W.O.F" : "W.O.L",
                                                           sinceEffDateRemain.Hours ?? 0,
                                                           sinceEffDateRemain.Cycles ?? 0,
                                                           sinceEffDateRemain.Days ?? 0,
                                                           firstComplianceDate,
                                                           firstCompliance.Hours ?? 0,
                                                           firstCompliance.Cycles ?? 0,
                                                           firstCompliance.ToStrings(),
                                                           repeatInterval.Days ?? 0,
                                                           repeatInterval.Hours ?? 0,
                                                           repeatInterval.Cycles ?? 0,
                                                           repeatInterval.ToStrings(),
                                                           lastComplianceDate,
                                                           lastCompliance.Hours ?? 0,
                                                           lastCompliance.Cycles ?? 0,
                                                           lastCompliance.ToStrings(),
                                                           sinceNewThreshold.Days ?? 0,
                                                           firstCompliance.Days ?? 0,
                                                           lastCompliance.Days ?? 0,
                                                           nextComplianceDate,
                                                           nextCompliance.Hours ?? 0,
                                                           nextCompliance.Cycles ?? 0,
                                                           nextCompliance.ToStrings(),
                                                           remain.Days != null ? remain.Days.ToString() : "",
                                                           remain.Hours ?? 0,
                                                           remain.Cycles ?? 0,
                                                           remain.ToStrings(),
                                                           condition,
                                                           detailDirective.ManHours,
                                                           nextCompliance.Days ?? 0,
                                                           kits,
                                                           equipment,
                                                           detail.ATAChapter.ShortName,
                                                           detail.ATAChapter.FullName,
                                                           "",
                                                           sb,
                                                           eo != "" ?'(' + eo + ')' : "", "", "");
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Добавляется элемент в таблицу данных
        /// </summary>
        /// <param name="reportedDirective">Добавлямая директива</param>
        /// <param name="destinationDataSet">Таблица, в которую добавляется элемент</param>
        private void AddDirectiveToDataset(Directive reportedDirective, DirectivesListDataSet destinationDataSet)
        {
            string references = reportedDirective.Paragraph;
            string title;
            string eo;
            string sb;

            string s1 = reportedDirective.Title;

            if (!string.IsNullOrEmpty(reportedDirective.Paragraph.Trim()))
            {
                s1 += "\n§ " + reportedDirective.Paragraph;
            }

            if (_directiveType == DirectiveType.EngineeringOrders)
            {
                title = reportedDirective.EngineeringOrders;
                sb    = s1;
                eo    = reportedDirective.ServiceBulletinNo;
            }
            else if (_directiveType == DirectiveType.SB)
            {
                title = reportedDirective.ServiceBulletinNo;
                sb    = s1;
                eo    = reportedDirective.EngineeringOrders;
            }
            else
            {
                title = s1;
                eo    = reportedDirective.EngineeringOrders;
                sb    = reportedDirective.ServiceBulletinNo;
            }
            Lifelength sinceNewThreshold = Lifelength.Null, sinceEffDateThreshold = Lifelength.Null;
            Lifelength sinceEffDateCompliance = Lifelength.Null;
            Lifelength sinceNewRemain = Lifelength.Null, sinceEffDateRemain = Lifelength.Null;
            Lifelength firstCompliance = Lifelength.Null,
                       lastCompliance = Lifelength.Null,
                       repeatInterval = Lifelength.Null, remain = Lifelength.Null;
            string firstComplianceDate = "",
                   lastComplianceDate = "", sinceNewComplianceDate = "";
            Lifelength used = Lifelength.Null;

            string remarks  = reportedDirective.LastPerformance != null ? reportedDirective.LastPerformance.Remarks : reportedDirective.Remarks;
            string performanceType = reportedDirective.Threshold.FirstPerformanceConditionType == ThresholdConditionType.WhicheverFirst
                                         ? "W.O.F"
                                         : "W.O.L";
            string effectivityDate = SmartCore.Auxiliary.Convert.GetDateFormat(reportedDirective.Threshold.EffectiveDate, "/");
            string equipment       = reportedDirective.NDTType.ShortName;
            string kits            = "";
            int    num             = 1;

            foreach (AccessoryRequired kit in reportedDirective.Kits)
            {
                kits += num + ": " + kit.PartNumber + "\n";
                num++;
            }
            //TODO:(Evgenii Babak) расчетом ресурсов должен заниматься калькулятор
            //расчет остатка с даты производства и с эффективной даты
            //расчет остатка от выполнения с даты производтсва
            if (reportedDirective.Threshold.FirstPerformanceSinceNew != null)
            {
                sinceNewThreshold = reportedDirective.Threshold.FirstPerformanceSinceNew;
                if (sinceNewThreshold.Days != null)
                {
                    sinceNewComplianceDate =
                        _manufactureDate.AddDays(sinceNewThreshold.Days.Value).ToString(
                            new GlobalTermsProvider()["DateFormat"].ToString());
                }
                if (reportedDirective.LastPerformance == null)
                {
                    sinceNewRemain.Add(reportedDirective.Threshold.FirstPerformanceSinceNew);
                    sinceNewRemain.Substract(_current);
                    sinceNewRemain.Resemble(reportedDirective.Threshold.FirstPerformanceSinceNew);
                }
            }
            if (reportedDirective.Threshold.FirstPerformanceSinceEffectiveDate != null)
            {
                sinceEffDateThreshold = reportedDirective.Threshold.FirstPerformanceSinceEffectiveDate;
                if (reportedDirective.Threshold.EffectiveDate < DateTime.Today)
                {
                    sinceEffDateCompliance =
                        GlobalObjects.CasEnvironment.Calculator.
                        GetFlightLifelengthOnEndOfDay(_reportedBaseComponent, reportedDirective.Threshold.EffectiveDate);
                }

                sinceEffDateCompliance.Add(reportedDirective.Threshold.FirstPerformanceSinceEffectiveDate);
                sinceEffDateCompliance.Resemble(reportedDirective.Threshold.FirstPerformanceSinceEffectiveDate);


                sinceEffDateRemain.Add(reportedDirective.Remains);
            }

            GlobalObjects.PerformanceCalculator.GetNextPerformance(reportedDirective);
            if (reportedDirective.LastPerformance != null)
            {
                firstComplianceDate =
                    reportedDirective.PerformanceRecords[0].RecordDate.ToString(
                        new GlobalTermsProvider()["DateFormat"].ToString());
                firstCompliance = reportedDirective.PerformanceRecords[0].OnLifelength;

                if (reportedDirective.Threshold.RepeatInterval != null)
                {
                    repeatInterval = reportedDirective.Threshold.RepeatInterval;
                }

                lastComplianceDate =
                    reportedDirective.LastPerformance.RecordDate.ToString(new GlobalTermsProvider()["DateFormat"].ToString());
                lastCompliance = reportedDirective.LastPerformance.OnLifelength;

                used.Add(_current);
                used.Substract(reportedDirective.LastPerformance.OnLifelength);

                if (reportedDirective.NextPerformanceSource != null && !reportedDirective.NextPerformanceSource.IsNullOrZero())
                {
                    remain.Add(reportedDirective.NextPerformanceSource);
                    remain.Substract(_current);
                    remain.Resemble(reportedDirective.Threshold.RepeatInterval);
                }
            }

            var canadianTitle = "";

            if (reportedDirective.Title.Contains('/'))
            {
                var res = reportedDirective.Title.Split('/');
                canadianTitle = res[0];
                title         = res[1];
            }
            else if (reportedDirective.Title.StartsWith("C"))
            {
                canadianTitle = reportedDirective.Title;
                title         = "";
            }
            else
            {
                canadianTitle = "";
                title         = reportedDirective.Title;
            }



            string nextComplianceDate =
                reportedDirective.NextPerformanceDate != null
                    ? ((DateTime)reportedDirective.NextPerformanceDate).ToString(new GlobalTermsProvider()["DateFormat"].ToString())
                    : "";
            Lifelength      nextCompliance = reportedDirective.NextPerformanceSource;
            NextPerformance np             = reportedDirective.NextPerformance;

            destinationDataSet.ItemsTable.AddItemsTableRow(reportedDirective.Applicability,
                                                           reportedDirective.Remarks,
                                                           reportedDirective.HiddenRemarks,
                                                           reportedDirective.Description,
                                                           title,
                                                           references,
                                                           reportedDirective.WorkType.ToString(),
                                                           reportedDirective.Status.FullName,
                                                           effectivityDate,
                                                           sinceNewThreshold.Hours ?? 0,
                                                           sinceNewThreshold.Cycles ?? 0,
                                                           sinceNewComplianceDate,
                                                           performanceType,
                                                           sinceNewRemain.Hours ?? 0,
                                                           sinceNewRemain.Cycles ?? 0,
                                                           sinceNewRemain.Days ?? 0,
                                                           sinceEffDateThreshold.Hours ?? 0,
                                                           sinceEffDateThreshold.Cycles ?? 0,
                                                           sinceEffDateThreshold.Days != null ? sinceEffDateThreshold.Days.ToString() : "",
                                                           performanceType,
                                                           sinceEffDateRemain.Hours ?? 0,
                                                           sinceEffDateRemain.Cycles ?? 0,
                                                           sinceEffDateRemain.Days ?? 0,
                                                           firstComplianceDate,
                                                           firstCompliance.Hours ?? 0,
                                                           firstCompliance.Cycles ?? 0,
                                                           reportedDirective.Threshold.FirstPerformanceToStrings(),
                                                           repeatInterval.Days ?? 0,
                                                           repeatInterval.Hours ?? 0,
                                                           repeatInterval.Cycles ?? 0,
                                                           repeatInterval.ToStrings(),
                                                           lastComplianceDate,
                                                           lastCompliance.Hours ?? 0,
                                                           lastCompliance.Cycles ?? 0,
                                                           reportedDirective.LastPerformance != null
                                                                ? reportedDirective.LastPerformance.ToStrings("/")
                                                                : "",
                                                           used.Days ?? 0,
                                                           used.Hours ?? 0,
                                                           used.Cycles ?? 0,
                                                           nextComplianceDate,
                                                           nextCompliance.Hours ?? 0,
                                                           nextCompliance.Cycles ?? 0,
                                                           np != null ? np.ToStrings("/") : "",
                                                           remain.Days != null ? remain.Days.ToString() : "",
                                                           remain.Hours ?? 0,
                                                           remain.Cycles ?? 0,
                                                           reportedDirective.Remains.ToStrings(),
                                                           reportedDirective.Condition.ToString(),
                                                           reportedDirective.Cost,
                                                           reportedDirective.ManHours,
                                                           kits,
                                                           equipment,
                                                           reportedDirective.ATAChapter != null ? reportedDirective.ATAChapter.ShortName : "",
                                                           reportedDirective.ATAChapter != null ? reportedDirective.ATAChapter.FullName : "",
                                                           reportedDirective.ADType == ADType.Airframe ? "AF" : "AP",
                                                           sb,
                                                           eo != "" ?'(' + eo + ')' : "",
                                                           canadianTitle, reportedDirective.StcNo);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Добавляется элемент в таблицу данных
        /// </summary>
        /// <param name="reportedDirective">Добавлямая директива</param>
        /// <param name="destinationDataSet">Таблица, в которую добавляется элемент</param>
        private void AddDirectiveToDataset(Directive reportedDirective, DirectivesListDataSet destinationDataSet)
        {
            string title;
            string eo;
            string sb;

            if (_directiveType == DirectiveType.EngineeringOrders)
            {
                title = reportedDirective.EngineeringOrders;
                sb    = reportedDirective.Title;
                eo    = reportedDirective.ServiceBulletinNo;
            }
            else if (_directiveType == DirectiveType.SB)
            {
                title = reportedDirective.ServiceBulletinNo;
                sb    = reportedDirective.Title;
                eo    = reportedDirective.EngineeringOrders;
            }
            else
            {
                title = reportedDirective.Title;
                eo    = reportedDirective.EngineeringOrders;
                sb    = reportedDirective.ServiceBulletinNo;
            }

            string remarks = reportedDirective.LastPerformance != null
                ? reportedDirective.LastPerformance.Remarks
                : reportedDirective.Remarks;


            var status = "";

            if (reportedDirective.Status == DirectiveStatus.Closed ||
                reportedDirective.Status == DirectiveStatus.Open ||
                reportedDirective.Status == DirectiveStatus.Repetative ||
                reportedDirective.Status == DirectiveStatus.NotApplicable)
            {
                status = reportedDirective.Status.ShortName;
            }
            var effectivityDate = UsefulMethods.NormalizeDate(reportedDirective.Threshold.EffectiveDate);
            var equipment       = reportedDirective.NDTType.ShortName;
            var kits            = "";
            var num             = 1;

            foreach (AccessoryRequired kit in reportedDirective.Kits)
            {
                kits += num + ": " + kit.PartNumber + "\n";
                num++;
            }

            //расчет остатка с даты производства и с эффективной даты
            Lifelength sinceNewThreshold = Lifelength.Null, sinceEffDateThreshold = Lifelength.Null;
            var        sinceEffDateCompliance = Lifelength.Null;
            Lifelength sinceNewRemain = Lifelength.Null, sinceEffDateRemain = Lifelength.Null;

            Lifelength firstCompliance = Lifelength.Null,
                       lastCompliance = Lifelength.Null,
                       repeatInterval = Lifelength.Null, remain = Lifelength.Null;
            string firstComplianceDate = "",
                   lastComplianceDate = "", sinceNewComplianceDate = "";
            var used = Lifelength.Null;

            //TODO:(Evgenii Babak) расчетом ресурсов должен заниматься калькулятор
            //расчет остатка от выполнения с даты производтсва
            if (reportedDirective.Threshold.FirstPerformanceSinceNew != null)
            {
                sinceNewThreshold = reportedDirective.Threshold.FirstPerformanceSinceNew;
                if (sinceNewThreshold.Days != null)
                {
                    sinceNewComplianceDate =
                        _manufactureDate.AddDays(sinceNewThreshold.Days.Value).ToString(
                            new GlobalTermsProvider()["DateFormat"].ToString());
                }
                if (reportedDirective.LastPerformance == null)
                {
                    sinceNewRemain.Add(reportedDirective.Threshold.FirstPerformanceSinceNew);
                    sinceNewRemain.Substract(_current);
                    sinceNewRemain.Resemble(reportedDirective.Threshold.FirstPerformanceSinceNew);
                }
            }
            if (reportedDirective.Threshold.FirstPerformanceSinceEffectiveDate != null)
            {
                sinceEffDateThreshold = reportedDirective.Threshold.FirstPerformanceSinceEffectiveDate;
                if (reportedDirective.Threshold.EffectiveDate < DateTime.Today)
                {
                    sinceEffDateCompliance =
                        GlobalObjects.CasEnvironment.Calculator.
                        GetFlightLifelengthOnEndOfDay(_reportedBaseComponent, reportedDirective.Threshold.EffectiveDate);
                }

                sinceEffDateCompliance.Add(reportedDirective.Threshold.FirstPerformanceSinceEffectiveDate);
                sinceEffDateCompliance.Resemble(reportedDirective.Threshold.FirstPerformanceSinceEffectiveDate);

                if (reportedDirective.LastPerformance == null)
                {
                    sinceEffDateRemain.Add(sinceEffDateCompliance);
                    sinceEffDateRemain.Substract(_current);
                    sinceEffDateRemain.Resemble(sinceEffDateCompliance);
                }
            }

            GlobalObjects.PerformanceCalculator.GetNextPerformance(reportedDirective);
            if (reportedDirective.LastPerformance != null)
            {
                firstComplianceDate =
                    reportedDirective.PerformanceRecords[0].RecordDate.ToString(
                        new GlobalTermsProvider()["DateFormat"].ToString());
                firstCompliance = reportedDirective.PerformanceRecords[0].OnLifelength;

                if (reportedDirective.Threshold.RepeatInterval != null)
                {
                    repeatInterval = reportedDirective.Threshold.RepeatInterval;
                }

                lastComplianceDate =
                    reportedDirective.LastPerformance.RecordDate.ToString(new GlobalTermsProvider()["DateFormat"].ToString());
                lastCompliance = reportedDirective.LastPerformance.OnLifelength;

                used.Add(_current);
                used.Substract(reportedDirective.LastPerformance.OnLifelength);

                if (reportedDirective.NextPerformanceSource != null)
                {
                    remain.Add(reportedDirective.NextPerformanceSource);
                    remain.Substract(_current);
                    remain.Resemble(reportedDirective.Threshold.RepeatInterval);
                }
            }

            var nextComplianceDate = reportedDirective.NextPerformanceDate != null
                                            ? ((DateTime)reportedDirective.NextPerformanceDate).ToString(
                new GlobalTermsProvider()["DateFormat"].ToString())
                                            : "";
            var nextCompliance = reportedDirective.NextPerformanceSource;

            var condition = reportedDirective.Condition.ToString();
            var ata       = reportedDirective.ATAChapter;

            destinationDataSet.ItemsTable.AddItemsTableRow(reportedDirective.Applicability,
                                                           remarks,
                                                           reportedDirective.HiddenRemarks,
                                                           reportedDirective.Description,
                                                           title,
                                                           reportedDirective.Paragraph,
                                                           reportedDirective.WorkType.ToString(),
                                                           status,
                                                           effectivityDate,
                                                           sinceNewThreshold.Hours ?? 0,
                                                           sinceNewThreshold.Cycles ?? 0,
                                                           sinceNewComplianceDate,
                                                           reportedDirective.Threshold.FirstPerformanceConditionType == ThresholdConditionType.WhicheverFirst ? "W.O.F" : "W.O.L",
                                                           sinceNewRemain.Hours ?? 0,
                                                           sinceNewRemain.Cycles ?? 0,
                                                           sinceNewRemain.Days ?? 0,
                                                           sinceEffDateThreshold.Hours ?? 0,
                                                           sinceEffDateThreshold.Cycles ?? 0,
                                                           sinceEffDateThreshold.Days != null ? sinceEffDateThreshold.Days.ToString() : "",
                                                           reportedDirective.Threshold.FirstPerformanceConditionType == ThresholdConditionType.WhicheverFirst ? "W.O.F" : "W.O.L",
                                                           sinceEffDateRemain.Hours ?? 0,
                                                           sinceEffDateRemain.Cycles ?? 0,
                                                           sinceEffDateRemain.Days ?? 0,
                                                           firstComplianceDate,
                                                           firstCompliance.Hours ?? 0,
                                                           firstCompliance.Cycles ?? 0,
                                                           firstCompliance.ToStrings(),
                                                           repeatInterval.Days ?? 0,
                                                           repeatInterval.Hours ?? 0,
                                                           repeatInterval.Cycles ?? 0,
                                                           repeatInterval.ToStrings(),
                                                           lastComplianceDate,
                                                           lastCompliance.Hours ?? 0,
                                                           lastCompliance.Cycles ?? 0,
                                                           lastCompliance.ToStrings(),
                                                           used.Days ?? 0,
                                                           used.Hours ?? 0,
                                                           used.Cycles ?? 0,
                                                           nextComplianceDate,
                                                           nextCompliance.Hours ?? 0,
                                                           nextCompliance.Cycles ?? 0,
                                                           nextCompliance.ToStrings(),
                                                           remain.Days != null ? remain.Days.ToString() : "",
                                                           remain.Hours ?? 0,
                                                           remain.Cycles ?? 0,
                                                           remain.ToStrings(),
                                                           condition,
                                                           reportedDirective.ManHours,
                                                           reportedDirective.Cost,
                                                           kits,
                                                           equipment,
                                                           ata.ShortName,
                                                           ata.FullName,
                                                           reportedDirective.ADType == ADType.Airframe ? "AF" : "AP",
                                                           sb,
                                                           eo != "" ?'(' + eo + ')' : "", "", "");
        }