Example #1
0
        /// <summary>
        /// Добавляется элемент в таблицу данных
        /// </summary>
        /// <param name="directive">Добавлямая директива</param>
        /// <param name="destinationDataSet">Таблица, в которую добавляется элемент</param>
        public virtual void AddDirectiveToDataset(BaseDetailDirective directive, DirectiveListReportDataSet destinationDataSet)
        {
            if (!DefaultFilter.Acceptable(directive))
            {
                return;
            }
            string applicability = directive.Applicability;
            //if (applicability == null || string.IsNullOrEmpty(applicability)) applicability = "-";
            string remarks     = directive.Remarks;
            string description = directive.Description;
            string title       = directive.Title;
            string references  = directive.References;
            string condition   = directive.Condition.ToString();

            condition = condition.Substring(0, 5);
            if (directive.Closed)
            {
                condition = "Close";
            }
            string effectivityDate   = directive.EffectivityDate.ToString("MMM dd, yyyy");
            string ThresholdSinceNew =
                lifelengthFormatter.GetData(directive.FirstPerformSinceNew, "h\r\n", "cyc\r\n", "");
            string thresholdSInceEffectivityDate =
                lifelengthFormatter.GetData(directive.SinceEffectivityDatePerformanceLifelength, "h\r\n", "cyc\r\n", "");
            string repearIntervals = lifelengthFormatter.GetData(directive.RepeatPerform, "h\r\n", "cyc\r\n", "");
            string compliance      = lifelengthFormatter.GetData(directive.LastPerformanceLifelength, "h\r\n", "cyc\r\n", "");
            string complianceDate  = "-";

            if (directive.LastPerformance != null)
            {
                complianceDate = directive.LastPerformance.RecordsAddDate.ToString("MMM dd, yyyy");
            }
            string nextLifelength = lifelengthFormatter.GetData(directive.NextPerformance, "h\r\n", "cyc\r\n", "");
            string nextDate       = "-"; //todo
            string leftTillNext   = lifelengthFormatter.GetData(directive.LeftTillNextPerformance, "h\r\n", "cyc\r\n", "");
            int    parentID       = directive.Parent.ID;

            if (directive.Parent is AircraftContainer)
            {
                parentID = directive.Parent.Parent.ID;
            }
            destinationDataSet.ItemsTable.AddItemsTableRow(directive.ID,
                                                           destinationDataSet.BaseDetailTable.FindByBaseDetailID(
                                                               parentID), applicability,
                                                           remarks, description, title,
                                                           references, condition,
                                                           effectivityDate,
                                                           ThresholdSinceNew,
                                                           thresholdSInceEffectivityDate,
                                                           repearIntervals,
                                                           compliance, complianceDate,
                                                           nextLifelength,
                                                           nextDate,
                                                           leftTillNext);
        }
        /// <summary>
        /// Добавляется элемент в таблицу данных
        /// </summary>
        /// <param name="detail">Добавляемый агрегат</param>
        /// <param name="number">Порядковый номер агрегата</param>
        /// <param name="destinationDataSet">Таблица, в которую добавляется элемент</param>
        protected virtual void AddDetailToDataset(Detail detail, int number, DetailListDataSet destinationDataSet)
        {
            if (!DefaultFilter.Acceptable(detail))
            {
                return;
            }
            int    aircraftId         = ReportedAircraft.ID;
            string atachapter         = detail.AtaChapter.ShortName;
            string componentNumber    = number.ToString();
            string atachapterfull     = detail.AtaChapter.FullName;
            string partNumber         = detail.PartNumber;
            string description        = detail.Description;
            string serialNumber       = detail.SerialNumber;
            string positionNumber     = detail.PositionNumber;
            string maintanceType      = detail.MaintenanceType.ShortName;
            string instalationDate    = detail.InstallationDate.ToString("MMM dd, yyyy");
            string complianceTSN      = "";
            string complianceDate     = "";
            string complianceWorkType = "";

            if (detail.Limitation.LastPerformance != null)
            {
                complianceTSN = lifelengthFormatter.GetData(detail.Limitation.LastPerformance.Lifelength, "h\r\n", "cyc\r\n", "");
                DateTime tempDateTime = new DateTime(detail.Limitation.LastPerformance.Lifelength.Calendar.Ticks);
                complianceDate     = tempDateTime.ToString("MMM dd, yyyy");
                complianceWorkType = detail.Limitation.LastPerformance.DetailRecordType.ShortName;
            }
            string nextTSN      = "";
            string nextDate     = "";
            string nextRemains  = "";
            string nextWorkType = "";

            if (detail.Limitation.NextPerformance != null)
            {
            }
            string condition = detail.LimitationCondition.GetHashCode().ToString();


            destinationDataSet.ItemsTable.AddItemsTableRow(detail.ID, aircraftId, componentNumber,
                                                           atachapter, atachapterfull, partNumber, description,
                                                           serialNumber, positionNumber,
                                                           maintanceType,
                                                           instalationDate,
                                                           complianceTSN,
                                                           complianceDate,
                                                           complianceWorkType, nextTSN,
                                                           nextDate,
                                                           nextRemains,
                                                           nextWorkType, condition);
        }