Exemplo n.º 1
0
        /// <summary>
        /// Создает несохраненного клона (Itemid которого =-1) переданного элемента
        /// </summary>
        /// <param name="toCopy">Элемент для клонирования (иожет быть равен null)</param>
        /// <returns>Склонированный элемент или элемент по умолчанию</returns>
        public DirectiveRecord(DirectiveRecord toCopy) : this()
        {
            if (toCopy == null)
            {
                return;
            }

            Completed  = toCopy.Completed;
            Dispatched = toCopy.Dispatched;
            MaintenanceOrganization = toCopy.MaintenanceOrganization;
            ODR                 = toCopy.ODR;
            _onLifelength       = toCopy.OnLifelength;
            _parent             = toCopy.Parent;
            _parentId           = toCopy.ParentId;
            _parentType         = toCopy.ParentType;
            _performanceNum     = toCopy.PerformanceNum;
            _recordDate         = toCopy.RecordDate;
            RecordTypeId        = toCopy.RecordTypeId;
            Reference           = toCopy.Reference;
            _remarks            = toCopy.Remarks;
            _directivePackage   = toCopy.DirectivePackage;
            _directivePackageId = toCopy.DirectivePackageId;

            _attachedFile = toCopy.AttachedFile;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Создает форму для привязки задач к выполнению чека программы обслуживания
        /// </summary>
        public DirectivePackageBindTaskFormNew(IDirectivePackage directivePackage)
            : this()
        {
            if (directivePackage == null)
            {
                throw new ArgumentNullException("directivePackage", "must be not null");
            }
            _currentDirectivePackage = directivePackage;

            _animatedThreadWorker.DoWork             += AnimatedThreadWorkerDoLoad;
            _animatedThreadWorker.RunWorkerCompleted += BackgroundWorkerRunWorkerLoadCompleted;
        }
Exemplo n.º 3
0
        private void AddListViewItem(AbstractPerformanceRecord apr, IDirectivePackage directivePackage)
        {
            DirectiveRecord directiveRecord = (DirectiveRecord)apr;

            string           workTypeString = "";
            StaticDictionary workType;

            if (directiveRecord.Parent is Procedure)
            {
                Procedure parentDirective = (Procedure)directiveRecord.Parent;
                workType       = parentDirective.ProcedureType;
                workTypeString = parentDirective.ProcedureType.ToString();
            }
            else if (directiveRecord.Parent is ComponentDirective)
            {
                ComponentDirective parentDirective = (ComponentDirective)directiveRecord.Parent;
                workType       = parentDirective.DirectiveType;
                workTypeString = parentDirective.DirectiveType + " of " + parentDirective.ParentComponent.Description;
            }
            else
            {
                workType = MaintenanceDirectiveTaskType.Unknown;
            }
            string[] subs = new[]  {
                workTypeString,
                UsefulMethods.NormalizeDate(directiveRecord.RecordDate),
                directiveRecord.OnLifelength != null
                                           ? directiveRecord.OnLifelength.ToString()
                                           : "",
                directiveRecord.Remarks,
            };
            ListViewItem newItem = new ListViewItem(subs)
            {
                Group = listViewCompliance.Groups[1],
                Tag   = directiveRecord
            };

            if (directivePackage != null)
            {
                //запись о выполнении блокируется найденым пакетом
                apr.DirectivePackage = directivePackage;
                newItem.BackColor    = Color.FromArgb(Highlight.Grey.Color);
                newItem.ToolTipText  =
                    "Perform of the task:" + workType +
                    "\nadded by Audit:" +
                    "\n" + directiveRecord.DirectivePackage.Title +
                    "\nTo remove a performance of task, you need to exclude task from this Audit," +
                    "\nor delete the Audit ";
            }
            listViewCompliance.Items.Add(newItem);
        }
Exemplo n.º 4
0
        private void AddListViewItem(AbstractPerformanceRecord apr, IDirectivePackage directivePackage,
                                     MaintenanceCheckRecord mcr)
        {
            DirectiveRecord directiveRecord = (DirectiveRecord)apr;
            Procedure       parentDirective = (Procedure)directiveRecord.Parent;

            string[] subs = new[]  {
                parentDirective.ProcedureType.ToString(),
                     UsefulMethods.NormalizeDate(directiveRecord.RecordDate),
                directiveRecord.OnLifelength != null
                                                   ? directiveRecord.OnLifelength.ToString()
                                                   : "",
                directiveRecord.Remarks,
            };

            ListViewItem newItem = new ListViewItem(subs)
            {
                Group = listViewCompliance.Groups[1],
                Tag   = directiveRecord
            };

            if (directivePackage != null)
            {
                //запись о выполнении блокируется найденым пакетом
                apr.DirectivePackage = directivePackage;
                newItem.BackColor    = Color.FromArgb(Highlight.Grey.Color);
                newItem.ToolTipText  =
                    "Perform of the task:" + parentDirective.ProcedureType +
                    "\nadded by Audit:" +
                    "\n" + directiveRecord.DirectivePackage.Title +
                    "\nTo remove a performance of task, you need to exclude task from this audit," +
                    "\nor delete the audit ";
            }
            else if (directiveRecord.MaintenanceCheckRecordId > 0 && mcr != null && mcr.ParentCheck != null)
            {
                MaintenanceCheck mc = mcr.ParentCheck;
                directiveRecord.MaintenanceCheck = mc;
                newItem.BackColor   = Color.FromArgb(Highlight.Grey.Color);
                newItem.ToolTipText =
                    "Perform of the task:" + parentDirective.ProcedureType +
                    "\nadded by Maintenance Check:" +
                    "\n" + mc.Name +
                    "\nTo remove a performance of task, you need to delete performance of maintenance check";
            }
            listViewCompliance.Items.Add(newItem);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Создает воздушное судно без дополнительной информации
        /// </summary>
        public ComponentLLPCategoryChangeRecord(ComponentLLPCategoryChangeRecord toCopy) : this()
        {
            if (toCopy == null)
            {
                return;
            }

            _file             = toCopy.AttachedFile;
            _onLifelength     = new Lifelength(toCopy.OnLifelength);
            ParentComponent   = toCopy.ParentComponent;
            _parentId         = toCopy.ParentId;
            _parentType       = toCopy.ParentType;
            _performanceNum   = toCopy.PerformanceNum;
            _remarks          = toCopy.Remarks;
            ToCategory        = toCopy.ToCategory;
            _wpId             = toCopy.DirectivePackageId;
            _directivePackage = toCopy.DirectivePackage;
        }
Exemplo n.º 6
0
        /// <summary>
        /// Создает несохраненного клона (Itemid которого =-1) переданного элемента
        /// </summary>
        /// <param name="toCopy">Элемент для клонирования (иожет быть равен null)</param>
        /// <returns>Склонированный элемент или элемент по умолчанию</returns>
        public DirectiveRecord(AbstractPerformanceRecord toCopy)
            : this()
        {
            if (toCopy == null)
            {
                return;
            }

            _onLifelength       = toCopy.OnLifelength;
            _parent             = toCopy.Parent;
            _parentId           = toCopy.ParentId;
            _parentType         = toCopy.ParentType;
            _performanceNum     = toCopy.PerformanceNum;
            _recordDate         = toCopy.RecordDate;
            _remarks            = toCopy.Remarks;
            _directivePackage   = toCopy.DirectivePackage;
            _directivePackageId = toCopy.DirectivePackageId;

            _attachedFile = toCopy.AttachedFile;
        }
Exemplo n.º 7
0
        public void RegisterPerformance(IDirective directive, AbstractPerformanceRecord performance, IDirectivePackage directivePackage = null, bool registerPerformanceForBindedItems = true)
        {
            if ((directive is Entities.General.Accessory.Component))
            {
                Check((Entities.General.Accessory.Component)directive, (TransferRecord)performance);
            }
            else
            {
                Check(directive, performance);
            }

            // Не можем добавить выполнение для не существующей директивы
            if (directive.ItemId <= 0)
            {
                throw new Exception("1033: Can not register performance for not existing directive");
            }

            // Дополняем необходимые данные
            performance.ParentId = directive.ItemId;

            // Выставляем родителя записи о выполнении
            performance.Parent = directive;

            if (directivePackage != null)
            {
                performance.DirectivePackageId = directivePackage.ItemId;
                performance.AttachedFile       = directivePackage.AttachedFile;
            }

            _newKeeper.Save(performance);

            if (directive.PerformanceRecords.GetItemById(performance.ItemId) == null)
            {
                directive.PerformanceRecords.Add(performance);
            }

            if (directive is Entities.General.Accessory.Component)
            {
                var component      = directive as Entities.General.Accessory.Component;
                var transferRecord = performance as TransferRecord;
                //выставление нового родителя
                if (transferRecord.DestinationObjectType == SmartCoreType.Aircraft)
                {
                    component.ParentAircraftId = transferRecord.DestinationObjectId;
                }
                if (component.IsBaseComponent)
                {
                    //обнуление мат аппарата для этой базовой детали
                    _calculator.ResetMath((BaseComponent)component);
                }
            }

            if (!registerPerformanceForBindedItems)
            {
                return;
            }

            if (directive is MaintenanceDirective)
            {
                var mpd = directive as MaintenanceDirective;
                CreateAndSavePerformanceForBindedItems(mpd, performance);
            }
            else if (directive is ComponentDirective)
            {
                var dd = directive as ComponentDirective;
                var dr = performance as DirectiveRecord;
                CreateAndSavePerformanceForBindedItems(dd, dr);
            }
        }