Exemplo n.º 1
0
 /// <summary>
 /// —оздает форму дл¤ редактировани¤ свойств нестандартных работ
 /// </summary>
 /// <param name="currentNonRoutineJob">“екуща¤ нестандартна¤ работа</param>
 public NonRoutineJobForm(NonRoutineJob currentNonRoutineJob)
 {
     this.currentNonRoutineJob = currentNonRoutineJob;
     mode = ScreenMode.Edit;
     InitializeComponent();
     UpdateInformation();
 }
Exemplo n.º 2
0
 ///<summary>
 ///</summary>
 public NonRoutineJobForm(NonRoutineJob job) : this()
 {
     _currentJob = job;
     ataChapterComboBox.UpdateInformation();
     UpdateControl();
     UpdateInformation();
 }
Exemplo n.º 3
0
 /// <summary>
 /// —оздает форму дл¤ добавлени¤ нестандартной работы
 /// </summary>
 /// <param name="parentWorkPackage">–абочий пакет, к которому добавл¤етс¤ нестандартна¤ работа</param>
 public NonRoutineJobForm(WorkPackage parentWorkPackage)
 {
     this.parentWorkPackage = parentWorkPackage;
     currentNonRoutineJob   = new NonRoutineJob();
     mode = ScreenMode.Add;
     InitializeComponent();
 }
Exemplo n.º 4
0
 /// <summary>
 /// Создает вкладку для привязывания Non-Routine Job к рабочей карте
 /// </summary>
 /// <param name="nonRoutineJob">Non Routine Job</param>
 public JobCardTabPageControl(NonRoutineJob nonRoutineJob)
 {
     this.nonRoutineJob  = nonRoutineJob;
     currentJobCard      = new JobCard();
     currentJobCard.Date = DateTime.Today;
     mode = ScreenMode.Add;
     InitializeComponent();
     UpdateInformation();
 }
Exemplo n.º 5
0
        public void DeleteFromWorkPackageTest()
        {
            const int aircraftId = 2316;            //4LimaTest

            var enviroment    = GetEnviroment();
            var wrpDataAccess = new WorkPackageRecordsDataAccess(enviroment);

            var workPackage = new WorkPackage()
            {
                ParentId       = aircraftId,
                Title          = "TestWp",
                ClosingRemarks = "Test"
            };

            var directive = new Directive {
                Description = "Test"
            };
            var nrj = new NonRoutineJob {
                Description = "Test"
            };

            enviroment.NewKeeper.Save(workPackage);
            enviroment.NewKeeper.Save(directive);
            enviroment.NewKeeper.Save(nrj);

            workPackage.WorkPakageRecords.Add(new WorkPackageRecord
            {
                DirectiveId         = nrj.ItemId,
                WorkPakageId        = workPackage.ItemId,
                WorkPackageItemType = nrj.SmartCoreObjectType.ItemId
            });
            workPackage.WorkPakageRecords.Add(new WorkPackageRecord
            {
                DirectiveId         = directive.ItemId,
                WorkPakageId        = workPackage.ItemId,
                WorkPackageItemType = directive.SmartCoreObjectType.ItemId
            });

            foreach (var workPackageRecord in workPackage.WorkPakageRecords)
            {
                enviroment.NewKeeper.Save(workPackageRecord);
            }

            var forCheck = enviroment.NewLoader.GetObjectListAll <WorkPackageRecordDTO, WorkPackageRecord>(new Filter("WorkPakageId", workPackage.ItemId));

            Assert.AreEqual(forCheck.Count, 2, "Должно быть 2 записи в рабочем пакете");


            enviroment.NewKeeper.Delete(workPackage);
            enviroment.NewKeeper.Delete(directive);
            enviroment.NewKeeper.Delete(nrj);

            wrpDataAccess.DeleteFromWorkPackage(workPackage.ItemId, new BaseEntityObject[] { directive, nrj });
            forCheck = enviroment.NewLoader.GetObjectListAll <WorkPackageRecordDTO, WorkPackageRecord>(new Filter("WorkPakageId", workPackage.ItemId));
            Assert.AreEqual(forCheck.Count, 0, "Записей быть не должно");
        }
Exemplo n.º 6
0
        public static NonRoutineJobDTO Convert(NonRoutineJob nonRoutineJob)
        {
            var nonRoutineJobDTO = new NonRoutineJobDTO
            {
                ATAChapterId = nonRoutineJob.ATAChapter.ItemId,
                ItemId       = nonRoutineJob.ItemId,
                IsDeleted    = nonRoutineJob.IsDeleted,
                ManHours     = nonRoutineJob.ManHours,
                Title        = nonRoutineJob.Title,
                Cost         = nonRoutineJob.Cost,
                KitRequired  = nonRoutineJob.KitRequired,
                Description  = nonRoutineJob.Description
            };

            foreach (var kit in nonRoutineJob.Kits)
            {
                nonRoutineJobDTO.Kits.Add(new KitDTO
                {
                    ItemId       = kit.ItemId,
                    IsDeleted    = kit.IsDeleted,
                    Description  = kit.Description,
                    Manufacturer = kit.Manufacturer,
                    ParentTypeId = kit.ParentTypeId,
                    ParentId     = kit.ParentId,
                    Product      = kit.Product,
                    Quantity     = kit.Quantity,
                    PartNumber   = kit.PartNumber,
                });
            }

            if (nonRoutineJob.AttachedFile != null)
            {
                nonRoutineJobDTO.Files.Add(new ItemFileLinkDTO
                {
                    LinkType     = (short)FileLinkType.NonRoutineJobTaskCardFile,
                    ParentTypeId = SmartCoreType.NonRoutineJob.ItemId,
                    ParentId     = nonRoutineJob.ItemId,
                    File         = new AttachedFileDTO
                    {
                        ItemId    = nonRoutineJob.AttachedFile.ItemId,
                        IsDeleted = nonRoutineJob.AttachedFile.IsDeleted,
                        FileName  = nonRoutineJob.AttachedFile.FileName,
                        FileData  = nonRoutineJob.AttachedFile.FileData,
                        FileSize  = nonRoutineJob.AttachedFile.FileSize
                    }
                });
            }


            return(nonRoutineJobDTO);
        }
Exemplo n.º 7
0
        public static NonRoutineJob Convert(NonRoutineJobDTO nrjDTO, ICasEnvironment casEnvironment)
        {
            var nrj = new NonRoutineJob
            {
                ATAChapter  = (AtaChapter)casEnvironment.GetDictionary <AtaChapter>().GetItemById(nrjDTO.ATAChapterId),
                ItemId      = nrjDTO.ItemId,
                IsDeleted   = nrjDTO.IsDeleted,
                ManHours    = nrjDTO.ManHours,
                Title       = nrjDTO.Title,
                Cost        = nrjDTO.Cost,
                KitRequired = nrjDTO.KitRequired,
                Description = nrjDTO.Description
            };

            foreach (var kit in nrjDTO.Kits)
            {
                nrj.Kits.Add(new AccessoryRequired
                {
                    ItemId       = kit.ItemId,
                    IsDeleted    = kit.IsDeleted,
                    Description  = kit.Description,
                    Manufacturer = kit.Manufacturer,
                    ParentTypeId = kit.ParentTypeId,
                    ParentId     = kit.ParentId,
                    Product      = kit.Product,
                    Quantity     = kit.Quantity,
                    PartNumber   = kit.PartNumber,
                    ParentObject = nrj
                });
            }

            nrjDTO.Kits.Clear();

            var nrjDTOFile = nrjDTO.Files.SingleOrDefault();

            if (nrjDTOFile != null)
            {
                nrj.AttachedFile = new AttachedFile
                {
                    FileData = nrjDTOFile.File.FileData,
                    FileName = nrjDTOFile.File.FileName,
                    FileSize = nrjDTOFile.File.FileSize,
                    ItemId   = nrjDTOFile.File.ItemId
                };
            }

            nrjDTO.Files.Clear();

            return(nrj);
        }
Exemplo n.º 8
0
 public static NonRoutineJobDTO Convert(this NonRoutineJob nonrutinejob)
 {
     return(new NonRoutineJobDTO
     {
         ItemId = nonrutinejob.ItemId,
         IsDeleted = nonrutinejob.IsDeleted,
         Updated = nonrutinejob.Updated,
         CorrectorId = nonrutinejob.CorrectorId,
         ATAChapterId = nonrutinejob.ATAChapter?.ItemId,
         Title = nonrutinejob.Title,
         Description = nonrutinejob.Description,
         ManHours = nonrutinejob.ManHours,
         Cost = nonrutinejob.Cost,
         KitRequired = nonrutinejob.KitRequired,
     });
 }
Exemplo n.º 9
0
        private void WorkPackageListView_DisplayerRequested(object sender, ReferenceEventArgs e)
        {
            if (SelectedItem is NonRoutineJob)
            {
                e.Cancel = true;
                nonRoutineJobBeforeSaving = (NonRoutineJob)SelectedItem;
                NonRoutineJobForm form = new NonRoutineJobForm(nonRoutineJobBeforeSaving);
                form.Saved += form_Saved;
                form.ShowDialog();
            }
            else if (SelectedItem is JobCard)
            {
                e.Cancel            = true;
                jobCardBeforeSaving = (JobCard)SelectedItem;
                MaintenanceJobCardForm form = new MaintenanceJobCardForm(jobCardBeforeSaving);
                form.Saved += formJobCard_Saved;
                form.ShowDialog();
            }
            else if (SelectedItem is AbstractDetail || SelectedItem is DetailDirective)
            {
                AbstractDetail detail;
                if (SelectedItem is DetailDirective)
                {
                    detail = (AbstractDetail)SelectedItem.Parent;
                }
                else
                {
                    detail = (AbstractDetail)SelectedItem;
                }
                e.TypeOfReflection = ReflectionTypes.DisplayInNew;

                if (detail is Detail || detail is DetailReal)//todo
                {
                    e.DisplayerText = ((Aircraft)detail.Parent.Parent).RegistrationNumber + ". Component SN " + detail.SerialNumber;
                }
                else
                {
                    e.DisplayerText = ((Aircraft)detail.Parent).RegistrationNumber + ". Component SN " + detail.SerialNumber;
                }
                e.RequestedEntity = new DispatcheredDetailScreen(detail);
            }
            else
            {
                BaseDetailDirective directive = (BaseDetailDirective)SelectedItem;
                e.TypeOfReflection = ReflectionTypes.DisplayInNew;

                string regNumber = "";
                if (SelectedItem.Parent is AircraftFrame)
                {
                    regNumber = SelectedItem.Parent.ToString();
                }
                else
                {
                    if ((SelectedItem.Parent).Parent is Aircraft)
                    {
                        regNumber = ((Aircraft)((SelectedItem.Parent).Parent)).RegistrationNumber + ". " + SelectedItem.Parent;
                    }
                }
                e.DisplayerText = regNumber + ". " + directive.DirectiveType.CommonName + ". " + directive.Title;
                if (directive is EngineeringOrderDirective)
                {
                    e.RequestedEntity = new DispatcheredEngineeringOrderDirectiveScreen((EngineeringOrderDirective)directive);
                }
                else if (directive.DirectiveType == DirectiveTypeCollection.Instance.OutOffPhaseDirectiveType)
                {
                    e.RequestedEntity = new DispatcheredOutOffPhaseReferenceScreen(directive);
                }
                else if (directive.DirectiveType == DirectiveTypeCollection.Instance.CPCPDirectiveType)
                {
                    e.RequestedEntity = new DispatcheredCPCPDirectiveScreen(directive);
                }
                else
                {
                    e.RequestedEntity = new DispatcheredDirectiveScreen(directive);
                }
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// Выполняет группировку элементов
        /// </summary>
        //protected override void SetGroupsToItems(int columnIndex)
        //      {
        //          itemsListView.Groups.Clear();
        //          foreach (var item in ListViewItemList)
        //          {
        //		var temp = ListViewGroupHelper.GetGroupString(item.Tag);

        //		itemsListView.Groups.Add(temp, temp);
        //		item.Group = itemsListView.Groups[temp];
        //	}
        //      }
        #endregion

        #region protected override ListViewItem.ListViewSubItem[] GetListViewSubItems(BaseSmartCoreObject item)

        protected override List <CustomCell> GetListViewSubItems(BaseEntityObject item)
        {
            var subItems = new List <CustomCell>();

            //if(item.ItemId == 41043)
            //{

            //}
            if (item is NextPerformance)
            {
                NextPerformance np = (NextPerformance)item;

                double manHours = np.Parent is IEngineeringDirective ? ((IEngineeringDirective)np.Parent).ManHours : 0;
                double cost     = np.Parent is IEngineeringDirective ? ((IEngineeringDirective)np.Parent).Cost : 0;
                var    author   = GlobalObjects.CasEnvironment.GetCorrector(item);

                subItems.Add(CreateRow(np.ATAChapter.ToString(), np.ATAChapter));
                subItems.Add(CreateRow(np.Title, np.Title));
                subItems.Add(CreateRow(np.Description, np.Description));
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = np.KitsToString, Tag = np.Kits.Count });
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = np.PerformanceSource.ToString(), Tag = np.PerformanceSource });
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = np.Parent.Threshold.RepeatInterval.ToString(), Tag = np.Parent.Threshold.RepeatInterval });
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = np.Remains.ToString(), Tag = np.Remains });
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = np.WorkType, Tag = np.WorkType });
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = np.PerformanceDate == null ? "N/A" : SmartCore.Auxiliary.Convert.GetDateFormat((DateTime)np.PerformanceDate), Tag = np.PerformanceDate });
                subItems.Add(CreateRow(manHours.ToString(), manHours));
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = np.Parent.Cost.ToString(), Tag = np.Parent.Cost });
                subItems.Add(CreateRow(author, author));
            }
            else if (item is AbstractPerformanceRecord)
            {
                //DirectiveRecord directiveRecord = (DirectiveRecord)item;
                AbstractPerformanceRecord apr = (AbstractPerformanceRecord)item;
                Lifelength remains            = Lifelength.Null;

                double manHours = apr.Parent is IEngineeringDirective ? ((IEngineeringDirective)apr.Parent).ManHours : 0;
                double cost     = apr.Parent is IEngineeringDirective ? ((IEngineeringDirective)apr.Parent).Cost : 0;

                subItems.Add(CreateRow(apr.ATAChapter.ToString(), apr.ATAChapter));
                subItems.Add(CreateRow(apr.Title, apr.Title));
                subItems.Add(CreateRow(apr.Description, apr.Description));
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = apr.KitsToString, Tag = apr.Kits.Count });
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = apr.OnLifelength.ToString(), Tag = apr.OnLifelength });
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = apr.Parent.Threshold.RepeatInterval.ToString(), Tag = apr.Parent.Threshold.RepeatInterval });
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = remains.ToString(), Tag = remains });
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = apr.WorkType, Tag = apr.WorkType });
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = SmartCore.Auxiliary.Convert.GetDateFormat(apr.RecordDate), Tag = apr.RecordDate });
                subItems.Add(CreateRow(manHours.ToString(), manHours));
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = apr.Parent.Cost.ToString(), Tag = apr.Parent.Cost });
            }
            else if (item is Directive)
            {
                Directive directive = (Directive)item;

                AtaChapter ata = directive.ATAChapter;
                subItems.Add(CreateRow(ata.ToString(), Tag = ata));
                subItems.Add(CreateRow(directive.Title, directive.Title));
                subItems.Add(CreateRow(directive.Description, directive.Description));

                #region Определение текста для колонки "КИТы"
                //subItems.Add(new ListViewItem.ListViewSubItem
                //{
                //    Text = directive.Kits.Count > 0 ? directive.Kits.Count + " kits" : "",
                //    Tag = directive.Kits.Count
                //});
                #endregion

                #region Определение текста для колонки "Первое выполнение"

                //ListViewItem.ListViewSubItem subItem = new ListViewItem.ListViewSubItem();
                //if (directive.Threshold.FirstPerformanceSinceNew != null && !directive.Threshold.FirstPerformanceSinceNew.IsNullOrZero())
                //{
                //    subItem.Text = "s/n: " + directive.Threshold.FirstPerformanceSinceNew;
                //    subItem.Tag = directive.Threshold.FirstPerformanceSinceNew;
                //}
                //if (directive.Threshold.FirstPerformanceSinceEffectiveDate != null &&
                //    !directive.Threshold.FirstPerformanceSinceEffectiveDate.IsNullOrZero())
                //{
                //    if (subItem.Text != "") subItem.Text += " or ";
                //    else
                //    {
                //        subItem.Text = "";
                //        subItem.Tag = directive.Threshold.FirstPerformanceSinceEffectiveDate;
                //    }
                //    subItem.Text += "s/e.d: " + directive.Threshold.FirstPerformanceSinceEffectiveDate;
                //}

                //subItems.Add(subItem);
                #endregion

                #region Определение текста для колонки "повторяющийся интервал"

                //subItem = new ListViewItem.ListViewSubItem();
                //if (!directive.Threshold.RepeatInterval.IsNullOrZero())
                //{
                //    subItem.Text = directive.Threshold.RepeatInterval.ToString();
                //    subItem.Tag = directive.Threshold.RepeatInterval;
                //}
                //else
                //{
                //    subItem.Text = "";
                //    subItem.Tag = Lifelength.Null;
                //}
                //subItems.Add(subItem);
                #endregion

                #region Определение текста для колонки "Остаток/Просрочено на сегодня"
                //subItems.Add(new ListViewItem.ListViewSubItem
                //{
                //    Text = directive.Remains.ToString(),
                //    Tag = directive.Remains
                //});
                #endregion

                #region Определение текста для колонки "Тип работ"

                //subItems.Add(new ListViewItem.ListViewSubItem { Text = directive.WorkType.ToString(), Tag = directive.WorkType });
                #endregion

                #region Определение текста для колонки "Следующее выполнение"
                //subItems.Add(new ListViewItem.ListViewSubItem
                //{
                //    Text = directive.NextPerformanceDate == null ? "N/A" : SmartCore.Auxiliary.Convert.GetDateFormat((DateTime)directive.NextPerformanceDate),
                //    Tag = directive.NextPerformanceDate
                //});
                #endregion

                #region Определение текста для колонки "Человек/Часы"

                subItems.Add(CreateRow(directive.ManHours.ToString(), directive.ManHours));
                #endregion

                #region Определение текста для колонки "Стоимость"

                //subItems.Add(new ListViewItem.ListViewSubItem { Text = directive.Cost.ToString(), Tag = directive.Cost });
                #endregion
            }
            else if (item is BaseComponent)
            {
                BaseComponent bd  = (BaseComponent)item;
                AtaChapter    ata = bd.ATAChapter;

                subItems.Add(CreateRow(ata.ToString(), ata));
                subItems.Add(CreateRow(bd.PartNumber, bd.PartNumber));
                subItems.Add(CreateRow(bd.Description, bd.Description));
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = bd.Kits.Count > 0 ? bd.Kits.Count + " kits" : "", Tag = bd.Kits.Count });
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = bd.LifeLimit.ToString(), Tag = bd.LifeLimit });
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = "", Tag = Lifelength.Null });
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = bd.Remains.ToString(), Tag = bd.Remains });
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = DetailRecordType.Removal.ToString(), Tag = DetailRecordType.Removal });
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = bd.NextPerformanceDate == null ? "N/A" : SmartCore.Auxiliary.Convert.GetDateFormat((DateTime)bd.NextPerformanceDate), Tag = bd.NextPerformanceDate });
                subItems.Add(CreateRow(bd.ManHours.ToString(), bd.ManHours));
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = bd.Cost.ToString(), Tag = bd.Cost });
            }
            else if (item is Component)
            {
                Component  d   = (Component)item;
                AtaChapter ata = d.ATAChapter;

                subItems.Add(CreateRow(ata.ToString(), ata));
                subItems.Add(CreateRow(d.PartNumber, d.PartNumber));
                subItems.Add(CreateRow(d.Description, d.Description));
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = d.Kits.Count > 0 ? d.Kits.Count + " kits" : "", Tag = d.Kits.Count });
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = d.LifeLimit != null ? d.LifeLimit.ToString() : "", Tag = d.LifeLimit });
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = "", Tag = Lifelength.Null });
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = d.Remains != null ? d.Remains.ToString() : "", Tag = d.Remains });
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = DetailRecordType.Removal.ToString(), Tag = DetailRecordType.Removal });
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = d.NextPerformanceDate == null ? "N/A" : SmartCore.Auxiliary.Convert.GetDateFormat((DateTime)d.NextPerformanceDate), Tag = d.NextPerformanceDate });
                subItems.Add(CreateRow(d.ManHours.ToString(), d.ManHours));
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = d.Cost.ToString(), Tag = d.Cost });
            }
            else if (item is ComponentDirective)
            {
                ComponentDirective dd  = (ComponentDirective)item;
                AtaChapter         ata = dd.ParentComponent.ATAChapter;

                subItems.Add(CreateRow(ata != null ? ata.ToString() : "", ata));
                subItems.Add(CreateRow("", ""));
                subItems.Add(CreateRow(dd.Remarks, dd.Remarks));
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = dd.Kits.Count > 0 ? dd.Kits.Count + " kits" : "", Tag = dd.Kits.Count });
                #region Определение текста для колонки "Первое выполнение"

                //ListViewItem.ListViewSubItem subItem = new ListViewItem.ListViewSubItem();
                //if (dd.Threshold.FirstPerformanceSinceNew != null && !dd.Threshold.FirstPerformanceSinceNew.IsNullOrZero())
                //{
                //    subItem.Text = "s/n: " + dd.Threshold.FirstPerformanceSinceNew;
                //    subItem.Tag = dd.Threshold.FirstPerformanceSinceNew;
                //}
                //subItems.Add(subItem);
                #endregion

                #region Определение текста для колонки "повторяющийся интервал"

                //subItem = new ListViewItem.ListViewSubItem();
                //if (!dd.Threshold.RepeatInterval.IsNullOrZero())
                //{
                //    subItem.Text = dd.Threshold.RepeatInterval.ToString();
                //    subItem.Tag = dd.Threshold.RepeatInterval;
                //}
                //else
                //{
                //    subItem.Text = "";
                //    subItem.Tag = Lifelength.Null;
                //}
                //subItems.Add(subItem);

                #endregion
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = dd.Remains.ToString(), Tag = dd.Remains });
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = dd.DirectiveType.ToString(), Tag = dd.DirectiveType });
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = dd.NextPerformanceDate == null ? "N/A" : SmartCore.Auxiliary.Convert.GetDateFormat((DateTime)dd.NextPerformanceDate), Tag = dd.NextPerformanceDate });
                subItems.Add(CreateRow(dd.ManHours.ToString(), dd.ManHours));
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = dd.Cost.ToString(), Tag = dd.Cost });
            }
            else if (item is MaintenanceCheck)
            {
                MaintenanceCheck mc = (MaintenanceCheck)item;
                subItems.Add(CreateRow("", null));
                subItems.Add(CreateRow("", Tag = ""));
                subItems.Add(CreateRow(mc.Name + (mc.Schedule ? " Shedule" : " Unshedule"), mc.Name));
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = mc.Kits.Count > 0 ? mc.Kits.Count + " kits" : "", Tag = mc.Kits.Count });
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = mc.Interval.ToString(), Tag = mc.Interval });
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = "", Tag = Lifelength.Null });
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = mc.Remains.ToString(), Tag = mc.Remains });
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = "", Tag = "" });
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = mc.NextPerformanceDate == null ? "N/A" : SmartCore.Auxiliary.Convert.GetDateFormat((DateTime)mc.NextPerformanceDate), Tag = mc.NextPerformanceDate });
                subItems.Add(CreateRow(mc.ManHours.ToString(), mc.ManHours));
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = mc.Cost.ToString(), Tag = mc.Cost });
            }
            else if (item is MaintenanceDirective)
            {
                MaintenanceDirective md  = (MaintenanceDirective)item;
                AtaChapter           ata = md.ATAChapter;

                subItems.Add(CreateRow(ata != null ? ata.ToString() : "", ata));
                subItems.Add(CreateRow(md.ToString(), md.ToString()));
                subItems.Add(CreateRow(md.Description, md.Description));
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = md.Kits.Count > 0 ? md.Kits.Count + " kits" : "", Tag = md.Kits.Count });
                #region Определение текста для колонки "Первое выполнение"

                //ListViewItem.ListViewSubItem subItem = new ListViewItem.ListViewSubItem();
                //if (md.Threshold.FirstPerformanceSinceNew != null && !md.Threshold.FirstPerformanceSinceNew.IsNullOrZero())
                //{
                //    subItem.Text = "s/n: " + md.Threshold.FirstPerformanceSinceNew;
                //    subItem.Tag = md.Threshold.FirstPerformanceSinceNew;
                //}
                //if (md.Threshold.FirstPerformanceSinceEffectiveDate != null &&
                //    !md.Threshold.FirstPerformanceSinceEffectiveDate.IsNullOrZero())
                //{
                //    if (subItem.Text != "") subItem.Text += " or ";
                //    else
                //    {
                //        subItem.Text = "";
                //        subItem.Tag = md.Threshold.FirstPerformanceSinceEffectiveDate;
                //    }
                //    subItem.Text += "s/e.d: " + md.Threshold.FirstPerformanceSinceEffectiveDate;
                //}

                //subItems.Add(subItem);
                #endregion

                #region Определение текста для колонки "повторяющийся интервал"

                //subItem = new ListViewItem.ListViewSubItem();
                //if (!md.Threshold.RepeatInterval.IsNullOrZero())
                //{
                //    subItem.Text = md.Threshold.RepeatInterval.ToString();
                //    subItem.Tag = md.Threshold.RepeatInterval;
                //}
                //else
                //{
                //    subItem.Text = "";
                //    subItem.Tag = Lifelength.Null;
                //}
                //subItems.Add(subItem);

                #endregion
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = md.Remains.ToString(), Tag = md.Remains });
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = md.WorkType.ToString(), Tag = md.WorkType });
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = md.NextPerformanceDate == null ? "N/A" : SmartCore.Auxiliary.Convert.GetDateFormat((DateTime)md.NextPerformanceDate), Tag = md.NextPerformanceDate });
                subItems.Add(CreateRow(md.ManHours.ToString(), md.ManHours));
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = md.Cost.ToString(), Tag = md.Cost });
            }
            else if (item is NonRoutineJob)
            {
                NonRoutineJob job = (NonRoutineJob)item;
                AtaChapter    ata = job.ATAChapter;
                subItems.Add(CreateRow(ata != null ? ata.ToString() : "", ata));
                subItems.Add(CreateRow(job.Title, job.Title));
                subItems.Add(CreateRow(job.Description, job.Description));
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = job.Kits.Count > 0 ? job.Kits.Count + " kits" : "", Tag = job.Kits.Count });
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = "", Tag = Lifelength.Null });
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = "", Tag = Lifelength.Null });
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = "", Tag = Lifelength.Null });
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = "", Tag = "" });
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = "", Tag = new DateTime(1950,1,1) });
                subItems.Add(CreateRow(job.ManHours.ToString(), job.ManHours));
                //subItems.Add(new ListViewItem.ListViewSubItem { Text = job.Cost.ToString(), Tag = job.Cost });
            }
            else
            {
                throw new ArgumentOutOfRangeException($"1135: Takes an argument has no known type {item.GetType()}");
            }

            return(subItems);
        }
Exemplo n.º 11
0
        protected override ListViewItem.ListViewSubItem[] GetListViewSubItems(BaseEntityObject item)
        {
            List <ListViewItem.ListViewSubItem> subItems = new List <ListViewItem.ListViewSubItem>();

            //if(item.ItemId == 41043)
            //{

            //}
            if (item is NextPerformance)
            {
                NextPerformance np = (NextPerformance)item;

                double manHours = np.Parent is IEngineeringDirective ? ((IEngineeringDirective)np.Parent).ManHours : 0;
                double cost     = np.Parent is IEngineeringDirective ? ((IEngineeringDirective)np.Parent).Cost : 0;

                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = np.ATAChapter.ToString(), Tag = np.ATAChapter
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = np.Title, Tag = np.Title
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = np.Description, Tag = np.Description
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = np.Type, Tag = np.Type
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = np.KitsToString, Tag = np.Kits.Count
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = np.PerformanceSource.ToString(), Tag = np.PerformanceSource
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = np.Parent.Threshold.RepeatInterval.ToString(), Tag = np.Parent.Threshold.RepeatInterval
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = np.Remains.ToString(), Tag = np.Remains
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = np.WorkType, Tag = np.WorkType
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = np.PerformanceDate == null ? "N/A" : SmartCore.Auxiliary.Convert.GetDateFormat((DateTime)np.PerformanceDate), Tag = np.PerformanceDate
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = manHours.ToString(), Tag = manHours
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = cost.ToString(), Tag = cost
                });
            }
            else if (item is AbstractPerformanceRecord)
            {
                AbstractPerformanceRecord apr = (AbstractPerformanceRecord)item;
                Lifelength remains            = Lifelength.Null;

                double manHours = apr.Parent is IEngineeringDirective ? ((IEngineeringDirective)apr.Parent).ManHours : 0;
                double cost     = apr.Parent is IEngineeringDirective ? ((IEngineeringDirective)apr.Parent).Cost : 0;

                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = apr.ATAChapter.ToString(), Tag = apr.ATAChapter
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = apr.Title, Tag = apr.Title
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = apr.Description, Tag = apr.Description
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = "", Tag = ""
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = apr.KitsToString, Tag = apr.Kits.Count
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = apr.OnLifelength.ToString(), Tag = apr.OnLifelength
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = apr.Parent.Threshold.RepeatInterval.ToString(), Tag = apr.Parent.Threshold.RepeatInterval
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = remains.ToString(), Tag = remains
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = apr.WorkType, Tag = apr.WorkType
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = SmartCore.Auxiliary.Convert.GetDateFormat(apr.RecordDate), Tag = apr.RecordDate
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = manHours.ToString(), Tag = manHours
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = cost.ToString(), Tag = cost
                });
            }
            else if (item is Directive)
            {
                Directive     directive = (Directive)item;
                AtaChapter    ata       = directive.ATAChapter;
                DirectiveType pdType    = directive.DirectiveType;
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = ata.ToString(), Tag = ata
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = directive.Title, Tag = directive.Title
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = directive.Description, Tag = directive.Description
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = pdType.ShortName, Tag = pdType.ShortName
                });

                #region Определение текста для колонки "КИТы"
                subItems.Add(new ListViewItem.ListViewSubItem
                {
                    Text = directive.Kits.Count > 0 ? directive.Kits.Count + " kits" : "",
                    Tag  = directive.Kits.Count
                });
                #endregion

                #region Определение текста для колонки "Первое выполнение"

                ListViewItem.ListViewSubItem subItem = new ListViewItem.ListViewSubItem();
                if (directive.Threshold.FirstPerformanceSinceNew != null && !directive.Threshold.FirstPerformanceSinceNew.IsNullOrZero())
                {
                    subItem.Text = "s/n: " + directive.Threshold.FirstPerformanceSinceNew;
                    subItem.Tag  = directive.Threshold.FirstPerformanceSinceNew;
                }
                if (directive.Threshold.FirstPerformanceSinceEffectiveDate != null &&
                    !directive.Threshold.FirstPerformanceSinceEffectiveDate.IsNullOrZero())
                {
                    if (subItem.Text != "")
                    {
                        subItem.Text += " or ";
                    }
                    else
                    {
                        subItem.Text = "";
                        subItem.Tag  = directive.Threshold.FirstPerformanceSinceEffectiveDate;
                    }
                    subItem.Text += "s/e.d: " + directive.Threshold.FirstPerformanceSinceEffectiveDate;
                }

                subItems.Add(subItem);
                #endregion

                #region Определение текста для колонки "повторяющийся интервал"

                subItem = new ListViewItem.ListViewSubItem();
                if (!directive.Threshold.RepeatInterval.IsNullOrZero())
                {
                    subItem.Text = directive.Threshold.RepeatInterval.ToString();
                    subItem.Tag  = directive.Threshold.RepeatInterval;
                }
                else
                {
                    subItem.Text = "";
                    subItem.Tag  = Lifelength.Null;
                }
                subItems.Add(subItem);
                #endregion

                #region Определение текста для колонки "Остаток/Просрочено на сегодня"
                subItems.Add(new ListViewItem.ListViewSubItem
                {
                    Text = directive.Remains.ToString(),
                    Tag  = directive.Remains
                });
                #endregion

                #region Определение текста для колонки "Тип работ"

                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = directive.WorkType.ToString(), Tag = directive.WorkType
                });
                #endregion

                #region Определение текста для колонки "Следующее выполнение"
                subItems.Add(new ListViewItem.ListViewSubItem
                {
                    Text = directive.NextPerformanceDate == null ? "N/A" : SmartCore.Auxiliary.Convert.GetDateFormat((DateTime)directive.NextPerformanceDate),
                    Tag  = directive.NextPerformanceDate
                });
                #endregion

                #region Определение текста для колонки "Человек/Часы"

                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = directive.ManHours.ToString(), Tag = directive.ManHours
                });
                #endregion

                #region Определение текста для колонки "Стоимость"

                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = directive.Cost.ToString(), Tag = directive.Cost
                });
                #endregion
            }
            else if (item is BaseComponent)
            {
                BaseComponent bd  = (BaseComponent)item;
                AtaChapter    ata = bd.ATAChapter;

                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = ata.ToString(), Tag = ata
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = bd.PartNumber, Tag = bd.PartNumber
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = bd.Description, Tag = bd.Description
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = bd.MaintenanceControlProcess.ShortName, Tag = bd.MaintenanceControlProcess.ShortName
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = bd.Kits.Count > 0 ? bd.Kits.Count + " kits" : "", Tag = bd.Kits.Count
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = bd.LifeLimit.ToString(), Tag = bd.LifeLimit
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = "", Tag = Lifelength.Null
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = bd.Remains.ToString(), Tag = bd.Remains
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = ComponentRecordType.Remove.ToString(), Tag = ComponentRecordType.Remove
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = bd.NextPerformanceDate == null ? "N/A" : SmartCore.Auxiliary.Convert.GetDateFormat((DateTime)bd.NextPerformanceDate), Tag = bd.NextPerformanceDate
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = bd.ManHours.ToString(), Tag = bd.ManHours
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = bd.Cost.ToString(), Tag = bd.Cost
                });
            }
            else if (item is Component)
            {
                Component  d   = (Component)item;
                AtaChapter ata = d.ATAChapter;

                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = ata.ToString(), Tag = ata
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = d.PartNumber, Tag = d.PartNumber
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = d.Description, Tag = d.Description
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = d.MaintenanceControlProcess.ShortName, Tag = d.MaintenanceControlProcess.ShortName
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = d.Kits.Count > 0 ? d.Kits.Count + " kits" : "", Tag = d.Kits.Count
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = d.LifeLimit != null ? d.LifeLimit.ToString() : "", Tag = d.LifeLimit
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = "", Tag = Lifelength.Null
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = d.Remains != null ? d.Remains.ToString() : "", Tag = d.Remains
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = ComponentRecordType.Remove.ToString(), Tag = ComponentRecordType.Remove
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = d.NextPerformanceDate == null ? "N/A" : SmartCore.Auxiliary.Convert.GetDateFormat((DateTime)d.NextPerformanceDate), Tag = d.NextPerformanceDate
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = d.ManHours.ToString(), Tag = d.ManHours
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = d.Cost.ToString(), Tag = d.Cost
                });
            }
            else if (item is ComponentDirective)
            {
                ComponentDirective dd  = (ComponentDirective)item;
                AtaChapter         ata = dd.ParentComponent.ATAChapter;

                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = ata != null ? ata.ToString() : "", Tag = ata
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = "", Tag = ""
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = dd.Remarks, Tag = dd.Remarks
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = "", Tag = ""
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = dd.Kits.Count > 0 ? dd.Kits.Count + " kits" : "", Tag = dd.Kits.Count
                });
                #region Определение текста для колонки "Первое выполнение"

                ListViewItem.ListViewSubItem subItem = new ListViewItem.ListViewSubItem();
                if (dd.Threshold.FirstPerformanceSinceNew != null && !dd.Threshold.FirstPerformanceSinceNew.IsNullOrZero())
                {
                    subItem.Text = "s/n: " + dd.Threshold.FirstPerformanceSinceNew;
                    subItem.Tag  = dd.Threshold.FirstPerformanceSinceNew;
                }
                subItems.Add(subItem);
                #endregion
                #region Определение текста для колонки "повторяющийся интервал"

                subItem = new ListViewItem.ListViewSubItem();
                if (!dd.Threshold.RepeatInterval.IsNullOrZero())
                {
                    subItem.Text = dd.Threshold.RepeatInterval.ToString();
                    subItem.Tag  = dd.Threshold.RepeatInterval;
                }
                else
                {
                    subItem.Text = "";
                    subItem.Tag  = Lifelength.Null;
                }
                subItems.Add(subItem);
                #endregion
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = dd.Remains.ToString(), Tag = dd.Remains
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = dd.DirectiveType.ToString(), Tag = dd.DirectiveType
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = dd.NextPerformanceDate == null ? "N/A" : SmartCore.Auxiliary.Convert.GetDateFormat((DateTime)dd.NextPerformanceDate), Tag = dd.NextPerformanceDate
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = dd.ManHours.ToString(), Tag = dd.ManHours
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = dd.Cost.ToString(), Tag = dd.Cost
                });
            }
            else if (item is MaintenanceCheck)
            {
                MaintenanceCheck mc = (MaintenanceCheck)item;
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = "", Tag = null
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = "", Tag = ""
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = mc.Name + (mc.Schedule ? " Shedule" : " Unshedule"), Tag = mc.Name
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = mc.Name, Tag = mc.Name
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = mc.Kits.Count > 0 ? mc.Kits.Count + " kits" : "", Tag = mc.Kits.Count
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = mc.Interval.ToString(), Tag = mc.Interval
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = "", Tag = Lifelength.Null
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = mc.Remains.ToString(), Tag = mc.Remains
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = "", Tag = ""
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = mc.NextPerformanceDate == null ? "N/A" : SmartCore.Auxiliary.Convert.GetDateFormat((DateTime)mc.NextPerformanceDate), Tag = mc.NextPerformanceDate
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = mc.ManHours.ToString(), Tag = mc.ManHours
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = mc.Cost.ToString(), Tag = mc.Cost
                });
            }
            else if (item is MaintenanceDirective)
            {
                MaintenanceDirective md  = (MaintenanceDirective)item;
                AtaChapter           ata = md.ATAChapter;
                string type = md.MaintenanceCheck != null ? md.MaintenanceCheck.Name : "MPD";

                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = ata != null ? ata.ToString() : "", Tag = ata
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = md.TaskNumberCheck, Tag = md.TaskNumberCheck
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = md.Description, Tag = md.Description,
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = type, Tag = type,
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = md.Kits.Count > 0 ? md.Kits.Count + " kits" : "", Tag = md.Kits.Count
                });
                #region Определение текста для колонки "Первое выполнение"

                ListViewItem.ListViewSubItem subItem = new ListViewItem.ListViewSubItem();
                if (md.Threshold.FirstPerformanceSinceNew != null && !md.Threshold.FirstPerformanceSinceNew.IsNullOrZero())
                {
                    subItem.Text = "s/n: " + md.Threshold.FirstPerformanceSinceNew;
                    subItem.Tag  = md.Threshold.FirstPerformanceSinceNew;
                }
                if (md.Threshold.FirstPerformanceSinceEffectiveDate != null &&
                    !md.Threshold.FirstPerformanceSinceEffectiveDate.IsNullOrZero())
                {
                    if (subItem.Text != "")
                    {
                        subItem.Text += " or ";
                    }
                    else
                    {
                        subItem.Text = "";
                        subItem.Tag  = md.Threshold.FirstPerformanceSinceEffectiveDate;
                    }
                    subItem.Text += "s/e.d: " + md.Threshold.FirstPerformanceSinceEffectiveDate;
                }

                subItems.Add(subItem);
                #endregion
                #region Определение текста для колонки "повторяющийся интервал"

                subItem = new ListViewItem.ListViewSubItem();
                if (!md.Threshold.RepeatInterval.IsNullOrZero())
                {
                    subItem.Text = md.Threshold.RepeatInterval.ToString();
                    subItem.Tag  = md.Threshold.RepeatInterval;
                }
                else
                {
                    subItem.Text = "";
                    subItem.Tag  = Lifelength.Null;
                }
                subItems.Add(subItem);
                #endregion
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = md.Remains.ToString(), Tag = md.Remains
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = md.MaintenanceCheck?.ToString(), Tag = md.MaintenanceCheck
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = md.WorkType.ToString(), Tag = md.WorkType
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = md.NextPerformanceDate == null ? "N/A" : SmartCore.Auxiliary.Convert.GetDateFormat((DateTime)md.NextPerformanceDate), Tag = md.NextPerformanceDate
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = md.ManHours.ToString(), Tag = md.ManHours
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = md.Cost.ToString(), Tag = md.Cost
                });
            }
            else if (item is NonRoutineJob)
            {
                NonRoutineJob job = (NonRoutineJob)item;
                AtaChapter    ata = job.ATAChapter;
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = ata != null ? ata.ToString() : "", Tag = ata
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = "", Tag = ""
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = job.Description, Tag = job.Description
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = "NRC", Tag = "NRC"
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = job.Kits.Count > 0 ? job.Kits.Count + " kits" : "", Tag = job.Kits.Count
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = "", Tag = Lifelength.Null
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = "", Tag = Lifelength.Null
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = "", Tag = Lifelength.Null
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = "", Tag = ""
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = "", Tag = DateTimeExtend.GetCASMinDateTime()
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = job.ManHours.ToString(), Tag = job.ManHours
                });
                subItems.Add(new ListViewItem.ListViewSubItem {
                    Text = job.Cost.ToString(), Tag = job.Cost
                });
            }
            else
            {
                throw new ArgumentOutOfRangeException($"1135: Takes an argument has no known type {item.GetType()}");
            }

            return(subItems.ToArray());
        }
Exemplo n.º 12
0
        /// <summary>
        /// This sample adds a consecutive number in the middle of each page.
        /// It shows how you can add graphics to an imported page.
        /// </summary>
        private void ConcatenatePdfDocuments()
        {
            List <MaintenanceCheck>     selectedChecks = new List <MaintenanceCheck>(_workPackage.MaintenanceChecks);
            List <MaintenanceDirective> selectedMpds   = new List <MaintenanceDirective>(_workPackage.MaintenanceDirectives);

            selectedMpds.AddRange((from record in _workPackage.MaintenanceCheckBindTaskRecords
                                   where record.TaskType == SmartCoreType.MaintenanceDirective
                                   select record.Task as MaintenanceDirective));
            selectedMpds = selectedMpds.Distinct().OrderBy(cm => cm.TaskNumberCheck).ToList();
            List <Directive> selectedADs = new List <Directive>(_workPackage.AdStatus);

            selectedADs.AddRange(_workPackage.SbStatus);
            selectedADs.AddRange(_workPackage.EoStatus);
            List <Directive>          selectedDamages             = new List <Directive>(_workPackage.Damages);
            List <Directive>          selectedOofs                = new List <Directive>(_workPackage.OutOfPhaseItems);
            List <Directive>          selectedDeffereds           = new List <Directive>(_workPackage.DefferedItems);
            List <ComponentDirective> selectedComponentDirectives = new List <ComponentDirective>(_workPackage.ComponentDirectives);
            List <Component>          selectedComponents          = new List <Component>(_workPackage.Components);
            List <NonRoutineJob>      selectedNrjs                = new List <NonRoutineJob>(_workPackage.NonRoutines);

            _animatedThreadWorker.ReportProgress(10, "Sample of Maintenance checks and MPD");

            #region Выборка Чеков и директив программы обслуживания

            foreach (DataGridViewRow row in dataGridViewItems.Rows)
            {
                if (!(row.Tag is MaintenanceCheck))
                {
                    continue;
                }
                if (row.Cells.Count < 3 || !(row.Cells[2] is DataGridViewCheckBoxCell))
                {
                    continue;
                }
                MaintenanceCheck         check     = row.Tag as MaintenanceCheck;
                DataGridViewCheckBoxCell printCell = (DataGridViewCheckBoxCell)row.Cells[2];
                if (!(bool)printCell.Value)
                {
                    //Если чек не выбран для распечатки,
                    //то из результирующей коллекции для распечатки нужно исключить как сам чек,
                    //так и его элементы
                    selectedChecks.Remove(check);

                    if (check.Grouping)
                    {
                        MaintenanceNextPerformance mnp = check.GetNextPergormanceGroupWhereCheckIsSenior();
                        if (mnp != null && mnp.PerformanceGroup != null && mnp.PerformanceGroup.Checks.Count > 0 &&
                            _workPackage.Aircraft != null && _workPackage.Aircraft.MSG == MSG.MSG3)
                        {
                            foreach (MaintenanceCheck mc in mnp.PerformanceGroup.Checks)
                            {
                                List <MaintenanceDirective> checkMpds =
                                    (from record in _workPackage.MaintenanceCheckBindTaskRecords
                                     where record.TaskType == SmartCoreType.MaintenanceDirective && record.CheckId == mc.ItemId
                                     select record.Task as MaintenanceDirective)
                                    .OrderBy(cm => cm.TaskNumberCheck)
                                    .ToList();

                                checkMpds.AddRange(mc.BindMpds);
                                foreach (MaintenanceDirective checkMpd in checkMpds)
                                {
                                    selectedMpds.Remove(checkMpd);
                                }
                            }
                        }
                        else
                        {
                            List <MaintenanceDirective> checkMpds =
                                (from record in _workPackage.MaintenanceCheckBindTaskRecords
                                 where record.TaskType == SmartCoreType.MaintenanceDirective && record.CheckId == check.ItemId
                                 select record.Task as MaintenanceDirective)
                                .OrderBy(cm => cm.TaskNumberCheck)
                                .ToList();

                            checkMpds.AddRange(check.BindMpds);
                            foreach (MaintenanceDirective checkMpd in checkMpds)
                            {
                                selectedMpds.Remove(checkMpd);
                            }
                        }
                    }
                    else
                    {
                        List <MaintenanceDirective> checkMpds =
                            (from record in _workPackage.MaintenanceCheckBindTaskRecords
                             where record.TaskType == SmartCoreType.MaintenanceDirective && record.CheckId == check.ItemId
                             select record.Task as MaintenanceDirective)
                            .OrderBy(cm => cm.TaskNumberCheck)
                            .ToList();

                        checkMpds.AddRange(check.BindMpds);
                        foreach (MaintenanceDirective checkMpd in checkMpds)
                        {
                            selectedMpds.Remove(checkMpd);
                        }
                    }
                }
            }

            foreach (DataGridViewRow row in dataGridViewItems.Rows)
            {
                if (!(row.Tag is MaintenanceDirective))
                {
                    continue;
                }
                if (row.Cells.Count < 3 || !(row.Cells[2] is DataGridViewCheckBoxCell))
                {
                    continue;
                }
                MaintenanceDirective     mpd       = row.Tag as MaintenanceDirective;
                DataGridViewCheckBoxCell printCell = (DataGridViewCheckBoxCell)row.Cells[2];
                if (!(bool)printCell.Value)
                {
                    //Если директива программы обслуживания не выбрана для распечатки,
                    //то ее нужно исключить из результирующей коллекции для распечатки
                    MaintenanceDirective directive = selectedMpds.FirstOrDefault(sm => sm.ItemId == mpd.ItemId);
                    if (directive != null)
                    {
                        selectedMpds.Remove(directive);
                    }
                }
                else
                {
                    if (row.Cells.Count < 4 || !(row.Cells[3] is DataGridViewComboBoxCell))
                    {
                        continue;
                    }
                    //Если директива программы обслуживания имеет связные с ней задачи по
                    //компонентам и Выбрана для распечатки,
                    //то нужно определить, сколько копий директивы надо включить в распечатку
                    //1. По одной на каждую связную задачу по компоненту
                    //2. Одну на все связные задачи по компонентам
                    MaintenanceDirective directive = selectedMpds.FirstOrDefault(sm => sm.ItemId == mpd.ItemId);
                    if (directive != null)
                    {
                        DataGridViewComboBoxCell countCell = (DataGridViewComboBoxCell)row.Cells[3];
                        if (countCell.EditedFormattedValue.ToString() == _comboBoxItemOneToOne)
                        {
                            directive.CountForPrint = directive.ItemRelations.Count;
                        }
                        else if (countCell.EditedFormattedValue.ToString() == _comboBoxItemOneForAll)
                        {
                            directive.CountForPrint = 1;
                        }
                    }
                }
            }

            #endregion

            _animatedThreadWorker.ReportProgress(15, "Sample of AD");

            #region Выборка Директив летной годности

            foreach (DataGridViewRow row in dataGridViewItems.Rows)
            {
                if (!(row.Tag is Directive))
                {
                    continue;
                }
                if (row.Cells.Count < 3 || !(row.Cells[2] is DataGridViewCheckBoxCell))
                {
                    continue;
                }
                Directive directive = row.Tag as Directive;
                DataGridViewCheckBoxCell printCell = (DataGridViewCheckBoxCell)row.Cells[2];
                if (!(bool)printCell.Value)
                {
                    if (directive.DirectiveType == DirectiveType.AirworthenessDirectives &&
                        selectedADs.FirstOrDefault(sm => sm.ItemId == directive.ItemId) != null)
                    {
                        selectedADs.Remove(directive);
                    }
                    if (directive.DirectiveType == DirectiveType.DamagesRequiring &&
                        selectedDamages.FirstOrDefault(sm => sm.ItemId == directive.ItemId) != null)
                    {
                        selectedDamages.Remove(directive);
                    }
                    if (directive.DirectiveType == DirectiveType.DeferredItems &&
                        selectedDeffereds.FirstOrDefault(sm => sm.ItemId == directive.ItemId) != null)
                    {
                        selectedDeffereds.Remove(directive);
                    }
                    if (directive.DirectiveType == DirectiveType.OutOfPhase &&
                        selectedOofs.FirstOrDefault(sm => sm.ItemId == directive.ItemId) != null)
                    {
                        selectedOofs.Remove(directive);
                    }
                    if (directive.DirectiveType == DirectiveType.SB &&
                        selectedOofs.FirstOrDefault(sm => sm.ItemId == directive.ItemId) != null)
                    {
                        selectedOofs.Remove(directive);
                    }
                    if (directive.DirectiveType == DirectiveType.EngineeringOrders &&
                        selectedOofs.FirstOrDefault(sm => sm.ItemId == directive.ItemId) != null)
                    {
                        selectedOofs.Remove(directive);
                    }
                }
            }
            #endregion

            _animatedThreadWorker.ReportProgress(20, "Sample of Component directives");

            #region Выборка Задач по компонентам

            foreach (DataGridViewRow row in dataGridViewItems.Rows)
            {
                if (!(row.Tag is ComponentDirective))
                {
                    continue;
                }
                if (row.Cells.Count < 3 || !(row.Cells[2] is DataGridViewCheckBoxCell))
                {
                    continue;
                }
                ComponentDirective       directive = row.Tag as ComponentDirective;
                DataGridViewCheckBoxCell printCell = (DataGridViewCheckBoxCell)row.Cells[2];
                if (!(bool)printCell.Value && selectedComponentDirectives.FirstOrDefault(sm => sm.ItemId == directive.ItemId) != null)
                {
                    selectedComponentDirectives.Remove(directive);
                }
            }
            #endregion

            _animatedThreadWorker.ReportProgress(25, "Sample of Components");

            #region Выборка компонентов

            foreach (DataGridViewRow row in dataGridViewItems.Rows)
            {
                if (!(row.Tag is Component))
                {
                    continue;
                }
                if (row.Cells.Count < 3 || !(row.Cells[2] is DataGridViewCheckBoxCell))
                {
                    continue;
                }
                Component directive = row.Tag as Component;
                DataGridViewCheckBoxCell printCell = (DataGridViewCheckBoxCell)row.Cells[2];
                if (!(bool)printCell.Value && selectedComponents.FirstOrDefault(sm => sm.ItemId == directive.ItemId) != null)
                {
                    selectedComponents.Remove(directive);
                }
            }
            #endregion

            _animatedThreadWorker.ReportProgress(30, "Sample of Non-routine jobs");

            #region Выборка нерутинных работ

            foreach (DataGridViewRow row in dataGridViewItems.Rows)
            {
                if (!(row.Tag is NonRoutineJob))
                {
                    continue;
                }
                if (row.Cells.Count < 3 || !(row.Cells[2] is DataGridViewCheckBoxCell))
                {
                    continue;
                }
                NonRoutineJob            directive = row.Tag as NonRoutineJob;
                DataGridViewCheckBoxCell printCell = (DataGridViewCheckBoxCell)row.Cells[2];
                if (!(bool)printCell.Value && selectedNrjs.FirstOrDefault(sm => sm.ItemId == directive.ItemId) != null)
                {
                    selectedNrjs.Remove(directive);
                }
            }
            #endregion

            _selectedItems.Clear();
            _selectedItems.AddRange(selectedChecks.ToArray());
            _selectedItems.AddRange(selectedMpds.ToArray());
            _selectedItems.AddRange(selectedADs.ToArray());
            _selectedItems.AddRange(selectedDamages.ToArray());
            _selectedItems.AddRange(selectedOofs.ToArray());
            _selectedItems.AddRange(selectedDeffereds.ToArray());
            _selectedItems.AddRange(selectedComponentDirectives.ToArray());
            _selectedItems.AddRange(selectedComponents.ToArray());
            _selectedItems.AddRange(selectedNrjs.ToArray());
        }
Exemplo n.º 13
0
 private void ComboBoxCategoriesSelectedIndexChanged(object sender, EventArgs e)
 {
     _currentJob = (NonRoutineJob)comboBoxCategories.SelectedItem;
     UpdateInformation();
 }
Exemplo n.º 14
0
        public void Delete(NonRoutineJob nonRoutineJob)
        {
            var nrjDTO = NonRoutineJobHelper.Convert(nonRoutineJob);

            _nonRoutineJobDataAccess.Delete(nrjDTO);
        }
Exemplo n.º 15
0
 private void form_Saved(NonRoutineJob nonRoutineJobAfterSaving)
 {
     EditItem(nonRoutineJobBeforeSaving, nonRoutineJobAfterSaving);
 }
Exemplo n.º 16
0
        /// <summary>
        /// ƒанные работы обновл¤ютс¤ по введенным значени¤м
        /// </summary>
        private bool SaveData()
        {
            if (mode == ScreenMode.Add)
            {
                currentNonRoutineJob = new NonRoutineJob();
            }
            double manHours;
            double cost;

            if (!CheckManHours(out manHours))
            {
                return(false);
            }
            if (!CheckCost(out cost))
            {
                return(false);
            }
            if (ATAChapter == null)
            {
                currentNonRoutineJob.AtaChapter = ATAChapterCollection.Instance.GetByID(21);//todo N/A глава
            }
            else if (currentNonRoutineJob.AtaChapter != ATAChapter)
            {
                currentNonRoutineJob.AtaChapter = ATAChapter;
            }
            if (currentNonRoutineJob.Title != Title)
            {
                currentNonRoutineJob.Title = Title;
                UpdateFormName();
            }
            if (currentNonRoutineJob.Description != Description)
            {
                currentNonRoutineJob.Description = Description;
            }
            if (currentNonRoutineJob.ManHours != manHours)
            {
                currentNonRoutineJob.ManHours = manHours;
            }
            if (currentNonRoutineJob.Cost != cost)
            {
                currentNonRoutineJob.Cost = cost;
            }
            if (currentNonRoutineJob.KitRequired != textBoxKitRequired.Text)
            {
                currentNonRoutineJob.KitRequired = textBoxKitRequired.Text;
            }
            try
            {
                if (mode == ScreenMode.Edit)
                {
                    currentNonRoutineJob.Save(true);
                    if (Saved != null)
                    {
                        Saved(currentNonRoutineJob);
                    }
                }
                else if (mode == ScreenMode.Add)
                {
                    parentWorkPackage.AddItem(currentNonRoutineJob);
                    mode = ScreenMode.Edit;
                    UpdateFormName();
                    if (Added != null)
                    {
                        Added(currentNonRoutineJob);
                    }
                }
                //   jobCardControl.NonRoutineJob = currentNonRoutineJob;
                if (jobCardControl.JobCardName == "")
                {
                    jobCardControl.JobCardName = ((Aircraft)currentNonRoutineJob.Parent.Parent).RegistrationNumber + ". " + ((WorkPackage)currentNonRoutineJob.Parent).Title + ". " + textBoxTitle.Text;
                }
                if (!jobCardControl.SaveData())
                {
                    return(false);
                }
            }
            catch (Exception ex)
            {
                Program.Provider.Logger.Log("Error while saving data", ex);
                return(false);
            }
            return(true);
        }
Exemplo n.º 17
0
        /// <summary>
        /// Добавляется элемент в таблицу данных
        /// </summary>
        /// <param name="item">Добавлямая директива</param>
        /// <param name="destinationDataSet">Таблица, в которую добавляется элемент</param>
        private void AddDirectiveToDataset(BaseEntityObject item, WorkscopeDataSet destinationDataSet)
        {
            if (item == null)
            {
                return;
            }

            string status;
            string applicabilityString;
            string hiddenRemarks;
            string description;
            string itemString;
            string lastPerformanceString;
            string nextPerformanceString;
            string conditionString;
            string zone;
            string ataShort;
            string ataFull;
            string taskCardNumber;
            string programmString;
            string maintenanceCheckString;
            string remarks;
            string directiveType;
            double cost;
            double mh;
            string effectivityDate;
            string kits;
            string remainString;
            string firstPerformanceString;
            string repeatPerformanceToString;

            IBaseEntityObject parent;

            if (item is NextPerformance)
            {
                parent = ((NextPerformance)item).Parent;
            }
            else if (item is AbstractPerformanceRecord)
            {
                parent = ((AbstractPerformanceRecord)item).Parent;
            }
            else
            {
                parent = item;
            }

            if (parent == null)
            {
                return;
            }

            if (parent is Directive)
            {
                Directive directive = (Directive)parent;
                status = directive.Status.ToString();
                lastPerformanceString = directive.LastPerformance != null?directive.LastPerformance.ToStrings() : "";

                nextPerformanceString = directive.NextPerformance != null?directive.NextPerformance.ToStrings() : "";

                conditionString        = directive.Condition.ToString();
                zone                   = "";
                programmString         = "";
                maintenanceCheckString = "N/A";
                remarks                = "";
                directiveType          = directive.WorkType.ToString();
                cost                   = directive.Cost;
                mh = directive.ManHours;
                effectivityDate           = UsefulMethods.NormalizeDate(directive.Threshold.EffectiveDate);
                kits                      = directive.Kits != null && directive.Kits.Count > 0 ? directive.Kits.Count + " kits" : "";
                firstPerformanceString    = directive.Threshold.FirstPerformanceToStrings();
                repeatPerformanceToString = directive.Threshold.RepeatPerformanceToStrings();
                remainString              = directive.Remains.ToString();

                StringBuilder stringBuilder = new StringBuilder();
                applicabilityString = directive.Applicability;
                hiddenRemarks       = directive.HiddenRemarks;
                description         = directive.Description;

                stringBuilder.AppendLine(directive.DirectiveType.ShortName);
                stringBuilder.AppendLine(directive.Title);
                if (!string.IsNullOrEmpty(directive.Paragraph))
                {
                    stringBuilder.AppendLine("\n§ " + directive.Paragraph);
                }
                AtaChapter ata = directive.ATAChapter;
                ataShort       = ata.ShortName;
                ataFull        = ata.ToString();
                taskCardNumber = directive.EngineeringOrders;
                stringBuilder.AppendLine(directive.EngineeringOrders);

                itemString = stringBuilder.ToString();
            }
            else if (parent is BaseComponent)
            {
                var bd  = (BaseComponent)parent;
                var ata = bd.ATAChapter ?? (AtaChapter)GlobalObjects.CasEnvironment.GetDictionary <AtaChapter>().GetItemById(-1);

                ataShort = ata.ShortName;
                ataFull  = ata.ToString();

                applicabilityString = "";
                hiddenRemarks       = bd.HiddenRemarks;
                description         = "";
                status = "";
                lastPerformanceString = "";
                nextPerformanceString = bd.NextPerformance != null?bd.NextPerformance.ToStrings() : "";

                conditionString        = bd.Condition.ToString();
                zone                   = "";
                programmString         = "";
                maintenanceCheckString = "N/A";
                remarks                = bd.Remarks;
                directiveType          = MaintenanceDirectiveTaskType.Discard.ToString();
                cost                   = bd.Cost;
                mh = bd.ManHours;
                effectivityDate           = UsefulMethods.NormalizeDate(bd.Threshold.EffectiveDate);
                taskCardNumber            = "";
                kits                      = bd.Kits != null && bd.Kits.Count > 0 ? bd.Kits.Count + " kits" : "";
                firstPerformanceString    = bd.Threshold.FirstPerformanceToStrings();
                repeatPerformanceToString = bd.Threshold.RepeatPerformanceToStrings();
                remainString              = bd.Remains.ToString();

                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.AppendLine("Compnt.");
                stringBuilder.AppendLine(bd.PartNumber);
                stringBuilder.AppendLine(bd.Description);

                itemString = stringBuilder.ToString();
            }
            else if (parent is Component)
            {
                var d   = (Component)parent;
                var ata = d.ATAChapter ?? (AtaChapter)GlobalObjects.CasEnvironment.GetDictionary <AtaChapter>().GetItemById(-1);

                ataShort = ata.ShortName;
                ataFull  = ata.ToString();

                applicabilityString = "";
                hiddenRemarks       = d.HiddenRemarks;
                description         = d.Description;
                status = "";
                lastPerformanceString = "";
                nextPerformanceString = d.NextPerformance != null?d.NextPerformance.ToStrings() : "";

                conditionString        = d.Condition.ToString();
                zone                   = "";
                programmString         = "";
                maintenanceCheckString = "N/A";
                remarks                = d.Remarks;
                directiveType          = MaintenanceDirectiveTaskType.Discard.ToString();
                cost                   = d.Cost;
                mh = d.ManHours;
                effectivityDate           = UsefulMethods.NormalizeDate(d.Threshold.EffectiveDate);
                taskCardNumber            = "";
                kits                      = d.Kits != null && d.Kits.Count > 0 ? d.Kits.Count + " kits" : "";
                firstPerformanceString    = d.Threshold.FirstPerformanceToStrings();
                repeatPerformanceToString = d.Threshold.RepeatPerformanceToStrings();
                remainString              = d.Remains.ToString();

                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.AppendLine("Compnt.");
                stringBuilder.AppendLine("P/N:" + d.PartNumber);
                stringBuilder.AppendLine("S/N:" + d.SerialNumber);

                itemString = stringBuilder.ToString();
            }
            else if (parent is ComponentDirective)
            {
                var dd  = (ComponentDirective)parent;
                var ata = dd.ParentComponent.ATAChapter ?? (AtaChapter)GlobalObjects.CasEnvironment.GetDictionary <AtaChapter>().GetItemById(-1);

                ataShort = ata.ShortName;
                ataFull  = ata.ToString();

                applicabilityString = "";
                hiddenRemarks       = dd.HiddenRemarks;
                description         = "";
                status = dd.Status.ToString();
                lastPerformanceString = dd.LastPerformance != null?dd.LastPerformance.ToStrings() : "";

                nextPerformanceString = dd.NextPerformance != null?dd.NextPerformance.ToStrings() : "";

                conditionString        = dd.Condition.ToString();
                zone                   = "";
                programmString         = "";
                maintenanceCheckString = "N/A";
                remarks                = dd.Remarks;
                directiveType          = dd.DirectiveType.ToString();
                cost                   = dd.Cost;
                mh = dd.ManHours;
                effectivityDate           = UsefulMethods.NormalizeDate(dd.Threshold.EffectiveDate);
                taskCardNumber            = "";
                kits                      = dd.Kits != null && dd.Kits.Count > 0 ? dd.Kits.Count + " kits" : "";
                firstPerformanceString    = dd.Threshold.FirstPerformanceToStrings();
                repeatPerformanceToString = dd.Threshold.RepeatPerformanceToStrings();
                remainString              = dd.Remains.ToString();

                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.AppendLine("Compnt.");
                if (dd.ParentComponent != null)
                {
                    Component d = dd.ParentComponent;
                    stringBuilder.AppendLine("P/N:" + d.PartNumber);
                    stringBuilder.AppendLine("S/N:" + d.SerialNumber);

                    description = d.Description;
                }
                itemString = stringBuilder.ToString();
            }
            else if (parent is MaintenanceCheck)
            {
                return;
                //MaintenanceCheck mc = (MaintenanceCheck)parent;

                //AtaChapter ata = (AtaChapter)GlobalObjects.CasEnvironment.Dictionaries[typeof(AtaChapter)].GetItemById(-1);
                //ataShort = ata.ShortName;
                //ataFull = ata.ToString();

                //applicabilityString = "";
                //hiddenRemarks = "";
                //description = "";
                //status = "";
                //lastPerformanceString = mc.LastPerformance != null ? mc.LastPerformance.ToStrings() : "";
                //nextPerformanceString = mc.NextPerformance != null ? mc.NextPerformance.ToStrings() : "";
                //conditionString = mc.Condition.ToString();
                //zone = "";
                //programmString = "";
                //maintenanceCheckString = "";
                //remarks = "";
                //directiveType = "";
                //cost = mc.Cost;
                //mh = mc.ManHours;
                //effectivityDate = UsefulMethods.NormalizeDate(mc.Threshold.EffectiveDate);
                //taskCardNumber = "";
                //kits = mc.Kits != null && mc.Kits.Count > 0 ? mc.Kits.Count + " kits" : "";
                //firstPerformanceString = mc.Threshold.FirstPerformanceToStrings();
                //repeatPerformanceToString = mc.Threshold.RepeatPerformanceToStrings();
                //remainString = mc.Remains.ToString();

                //StringBuilder stringBuilder = new StringBuilder();
                //stringBuilder.AppendLine("Check");
                //stringBuilder.AppendLine(mc.ToString());

                //itemString = stringBuilder.ToString();
            }
            else if (parent is MaintenanceDirective)
            {
                MaintenanceDirective md = (MaintenanceDirective)parent;

                AtaChapter ata = md.ATAChapter;
                ataShort = ata.ShortName;
                ataFull  = ata.ToString();

                applicabilityString = md.Applicability;
                hiddenRemarks       = md.HiddenRemarks;
                description         = md.Description;
                status = md.Status.ToString();
                lastPerformanceString = md.LastPerformance != null?md.LastPerformance.ToStrings() : "";

                nextPerformanceString = md.NextPerformance != null?md.NextPerformance.ToStrings() : "";

                conditionString = md.Condition?.ToString();
                zone            = md.Zone;
                programmString  = md.Program.ToString();

                if (md.MaintenanceCheck != null)
                {
                    maintenanceCheckString = md.MaintenanceCheck.ToString();
                }
                else if (_workPackage != null)
                {
                    MaintenanceCheckBindTaskRecord record =
                        _workPackage.MaintenanceCheckBindTaskRecords.FirstOrDefault(br => br.TaskType == SmartCoreType.MaintenanceDirective &&
                                                                                    br.TaskId == md.ItemId);
                    if (record != null)
                    {
                        maintenanceCheckString = record.ParentCheck != null?record.ParentCheck.ToString() : "N/A";
                    }
                    else
                    {
                        maintenanceCheckString = "N/A";
                    }
                }
                else
                {
                    maintenanceCheckString = "N/A";
                }

                remarks                   = md.Remarks;
                directiveType             = md.WorkType.ToString();
                cost                      = md.Cost;
                mh                        = md.ManHours;
                effectivityDate           = UsefulMethods.NormalizeDate(md.Threshold.EffectiveDate);
                taskCardNumber            = md.TaskCardNumber;
                kits                      = md.Kits != null && md.Kits.Count > 0 ? md.Kits.Count + " kits" : "";
                firstPerformanceString    = md.Threshold.FirstPerformanceToStrings();
                repeatPerformanceToString = md.Threshold.RepeatPerformanceToStrings();
                remainString              = md.Remains.ToString();

                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.AppendLine("MPD");
                stringBuilder.AppendLine(md.TaskNumberCheck);
                stringBuilder.AppendLine(md.TaskCardNumber);

                itemString = stringBuilder.ToString();
            }
            else if (parent is NonRoutineJob)
            {
                NonRoutineJob job = (NonRoutineJob)parent;

                AtaChapter ata = job.ATAChapter;
                ataShort = ata.ShortName;
                ataFull  = ata.ToString();

                applicabilityString = "";
                hiddenRemarks       = "";
                description         = job.Description;
                status = "";
                lastPerformanceString = "";
                nextPerformanceString = "";
                conditionString       = job.Condition.ToString();
                zone                   = "";
                programmString         = "";
                maintenanceCheckString = "N/A";
                remarks                = "";
                directiveType          = "";
                cost                   = job.Cost;
                mh = job.ManHours;
                effectivityDate           = "";
                taskCardNumber            = "";
                kits                      = job.Kits != null && job.Kits.Count > 0 ? job.Kits.Count + " kits" : "";
                firstPerformanceString    = "";
                repeatPerformanceToString = "";
                remainString              = job.Remains.ToString();

                StringBuilder stringBuilder = new StringBuilder();
                stringBuilder.AppendLine("NRC");
                stringBuilder.AppendLine(job.Title);

                itemString = stringBuilder.ToString();
            }
            else
            {
                return;
            }

            destinationDataSet.ItemsTable.AddItemsTableRow(applicabilityString,
                                                           remarks,
                                                           hiddenRemarks,
                                                           description,
                                                           itemString,
                                                           "",
                                                           directiveType,
                                                           status,
                                                           effectivityDate,
                                                           firstPerformanceString,
                                                           lastPerformanceString,
                                                           nextPerformanceString,
                                                           remainString,
                                                           conditionString,
                                                           mh,
                                                           cost,
                                                           kits,
                                                           zone,
                                                           ataShort,
                                                           ataFull,
                                                           taskCardNumber,
                                                           programmString,
                                                           repeatPerformanceToString,
                                                           "",
                                                           maintenanceCheckString);
        }