Example #1
0
        private void ChangeItemRelations(ref ItemsRelation itemsRelation, MaintenanceDirective relatedItem, WorkItemsRelationTypeUI relationTypeUI)
        {
            if (relatedItem.ItemRelations.Count == 0 ||
                relatedItem.ItemRelations.IsAllRelationWith(SmartCoreType.ComponentDirective))
            {
                if (itemsRelation == null)
                {
                    itemsRelation = new ItemsRelation();
                    _currentComponentDirective.ItemRelations.Add(itemsRelation);
                }
                else
                {
                    _lastBindedMpd.ItemRelations.Remove(itemsRelation);
                }

                itemsRelation.FillParameters(_currentComponentDirective, relatedItem);
                if (!RelateditemContainsLinkOnCurrentItem(_currentComponentDirective, relatedItem))
                {
                    relatedItem.ItemRelations.Add(itemsRelation);
                }

                itemsRelation.RelationTypeId = ItemRelationHelper.ConvertUIItemRelationToBLItem(relationTypeUI, _currentComponentDirective.IsFirst);
            }
            else
            {
                ItemRelationHelper.ShowDialogIfItemHaveLinkWithAnotherItem($"MPD {relatedItem.MPDNumber}", "AD", "Component");
            }
        }
        private void Save()
        {
            var selectedRelationType = (WorkItemsRelationTypeUI)comboBoxRelationType.SelectedValue;
            var relationType         = ItemRelationHelper.ConvertUIItemRelationToBLItem(selectedRelationType, _directive.IsFirst);

            //Сохранение новых связанных задач
            foreach (var newItem in _newBindedItems)
            {
                var itemRelation = CreateItemRelation(newItem, selectedRelationType);
                GlobalObjects.NewKeeper.Save(itemRelation);
            }

            //Удаление связанных задач
            var mpdItemRelations = new List <ItemsRelation>(_directive.ItemRelations);

            foreach (var detailDirective in _bindedItemsToRemove)
            {
                var itemsRelationsToDelete = mpdItemRelations.GetRelationsWith(detailDirective);
                foreach (var itemsRelationToDelete in itemsRelationsToDelete)
                {
                    itemsRelationToDelete.IsDeleted = true;
                    GlobalObjects.NewKeeper.Delete(itemsRelationToDelete);

                    _directive.ItemRelations.Remove(itemsRelationToDelete);
                    detailDirective.ItemRelations.Remove(itemsRelationToDelete);
                }
            }

            //Если ItemsRelationTypе от Mpd не совпадает с выбранным ItemsRelationTypе в комбике, производится обновление всех ItemRelation - ов
            if (_directive.WorkItemsRelationType != relationType)
            {
                SaveItemRelations(selectedRelationType, _directive);
            }
        }
Example #3
0
        /// <summary>
        /// Сохраняет работу агрегата
        /// </summary>
        /// <returns></returns>
        public void SaveData()
        {
            try
            {
                GlobalObjects.CasEnvironment.NewKeeper.Save(_currentComponentDirective);

                var currentRelatedItem   = lookupComboboxMaintenanceDirective.SelectedItem as MaintenanceDirective;
                var selectedRelationType = (WorkItemsRelationTypeUI)comboBoxRelationType.SelectedValue;
                var itemsRelation        = _currentComponentDirective.ItemRelations.SingleOrDefault();

                if (currentRelatedItem != null)
                {
                    ChangeItemRelations(ref itemsRelation, currentRelatedItem, selectedRelationType);
                    if (itemsRelation != null)
                    {
                        GlobalObjects.CasEnvironment.NewKeeper.Save(itemsRelation);
                    }
                }
                else
                {
                    if (itemsRelation != null && itemsRelation.ItemId > 0)
                    {
                        DeleteItemRelation(itemsRelation);
                    }
                }
            }
            catch (InvalidOperationException)
            {
                ItemRelationHelper.ShowDialogIfItemLinksCountMoreThanOne($"Component {_currentComponentDirective.PartNumber}", _currentComponentDirective.ItemRelations.Count);
            }
            catch (Exception ex)
            {
                Program.Provider.Logger.Log("Error while saving data", ex);
            }
        }
Example #4
0
 private void SaveItemRelations(WorkItemsRelationTypeUI relationTypeUI, IBindedItem currentItem)
 {
     foreach (var itemRelation in currentItem.ItemRelations)
     {
         itemRelation.RelationTypeId = ItemRelationHelper.ConvertUIItemRelationToBLItem(relationTypeUI, currentItem.IsFirst);
         GlobalObjects.NewKeeper.Save(itemRelation);
     }
 }
Example #5
0
        private void Save()
        {
            var selectedRelationType = (WorkItemsRelationTypeUI)comboBoxRelationType.SelectedValue;
            var relationType         = ItemRelationHelper.ConvertUIItemRelationToBLItem(selectedRelationType, _maintenanceDirective.IsFirst);

            //Сохранение новых связанных задач
            foreach (var newItem in _newBindedItems)
            {
                foreach (var detailDirective in newItem.Value)
                {
                    if (detailDirective.ItemId <= 0)
                    {
                        var component = newItem.Key;
                        GlobalObjects.ComponentCore.AddComponentDirective(component, detailDirective);
                        AddDirectiveRecord(component, detailDirective);
                    }

                    var itemRelation = CreateItemRelation(detailDirective, selectedRelationType);
                    itemRelation.AdditionalInformation.Component = detailDirective.PartNumber;
                    itemRelation.AdditionalInformation.Mpd       = _maintenanceDirective.TaskCardNumber;
                    GlobalObjects.NewKeeper.Save(itemRelation);

                    _maintenanceDirective.ItemRelations.Add(itemRelation);
                    detailDirective.ItemRelations.Add(itemRelation);
                }
            }

            //Удаление связанных задач
            var mpdItemRelations = new List <ItemsRelation>(_maintenanceDirective.ItemRelations);

            foreach (var detailDirective in _bindedItemsToRemove)
            {
                var itemsRelationsToDelete = mpdItemRelations.GetRelationsWith(detailDirective);
                foreach (var itemsRelationToDelete in itemsRelationsToDelete)
                {
                    itemsRelationToDelete.IsDeleted             = true;
                    itemsRelationToDelete.AdditionalInformation = null;
                    GlobalObjects.NewKeeper.Delete(itemsRelationToDelete);

                    _maintenanceDirective.ItemRelations.Remove(itemsRelationToDelete);
                    detailDirective.ItemRelations.Remove(itemsRelationToDelete);
                }
            }

            //Если ItemsRelationTypе от Mpd не совпадает с выбранным ItemsRelationTypе в комбике, производится обновление всех ItemRelation - ов
            if (_maintenanceDirective.WorkItemsRelationType != relationType)
            {
                SaveItemRelations(selectedRelationType, _maintenanceDirective);
            }
        }
Example #6
0
        private void ButtonAddClick(object sender, EventArgs e)
        {
            if (listViewTasksForSelect.SelectedItems.Count == 0)
            {
                return;
            }

            if (listViewTasksForSelect.SelectedItems.Count > 1)
            {
                MessageBox.Show($"Please select one directive. Because you can only bind one directive.",
                                (string)new GlobalTermsProvider()["SystemName"],
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            if (listViewBindedTasks.ItemsCount > 0)
            {
                MessageBox.Show($"Directive alredy binded for this MPD. If you want bind MPD please remove current binded directive.",
                                (string)new GlobalTermsProvider()["SystemName"],
                                MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                return;
            }

            var itemRelations = GlobalObjects.ItemsRelationsDataAccess.CheckRelations(listViewTasksForSelect.SelectedItems.First(), _directive);

            if (itemRelations.Count > 0)
            {
                ItemRelationHelper.ShowDialogIfItemHaveLinkWithAnotherItem($"AD {listViewTasksForSelect.SelectedItems.First().Title}", "MPD", "AD");
                return;
            }

            if (_directive.IsFirst == null)
            {
                _directive.NormalizeItemRelations();
                comboBoxRelationType.SelectedValue = ItemRelationHelper.ConvertBLItemRelationToUIITem(_directive.WorkItemsRelationType, false);
            }
            //Список выбранных задач по компонентам для привязки
            var selectedDirectives = listViewTasksForSelect.SelectedItems.ToList();

            //список уже призязанных задач по компонетам
            var bindedDirectives       = listViewBindedTasks.GetItemsArray().ToList();
            var concatenatedDirectives = selectedDirectives.Concat(bindedDirectives);

            listViewTasksForSelect.RemoveItems(selectedDirectives);
            listViewBindedTasks.SetItemsArray(concatenatedDirectives.ToArray());

            _newBindedItems.AddRange(selectedDirectives);
        }
Example #7
0
        private ItemsRelation CreateItemRelation(Directive mpd, WorkItemsRelationTypeUI relationTypeUI)
        {
            var itemRelation = new ItemsRelation();
            var relationType = ItemRelationHelper.ConvertUIItemRelationToBLItem(relationTypeUI, _directive.IsFirst);

            if (_directive.IsFirst == true)
            {
                itemRelation.FillParameters(_directive, mpd, relationType);
            }
            else
            {
                itemRelation.FillParameters(mpd, _directive, relationType);
            }

            return(itemRelation);
        }
Example #8
0
        private ItemsRelation CreateItemRelation(ComponentDirective dd, WorkItemsRelationTypeUI relationTypeUI)
        {
            var itemRelation = new ItemsRelation();
            var relationType = ItemRelationHelper.ConvertUIItemRelationToBLItem(relationTypeUI, _maintenanceDirective.IsFirst);

            if (_maintenanceDirective.IsFirst == true)
            {
                itemRelation.FillParameters(_maintenanceDirective, dd, relationType);
            }
            else
            {
                itemRelation.FillParameters(dd, _maintenanceDirective, relationType);
            }

            return(itemRelation);
        }
Example #9
0
        private void BackgroundWorkerRunWorkerLoadCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            listViewTasksForSelect.SetItemsArray(_itemsForSelect.ToArray());
            listViewBindedTasks.SetItemsArray(_bindedItems.ToArray());

            comboBoxRelationType.DisplayMember = "Key";
            comboBoxRelationType.ValueMember   = "Value";
            comboBoxRelationType.DataSource    = EnumHelper.GetDisplayValueMemberDict <WorkItemsRelationTypeUI>();

            comboBoxRelationType.SelectedIndexChanged -= ComboBoxRelationType_SelectedIndexChanged;

            _selectedRelationTypeUI = _maintenanceDirective.ItemRelations.Count == 0
                                ? WorkItemsRelationTypeUI.ThisItemAffectOnAnother
                                : ItemRelationHelper.ConvertBLItemRelationToUIITem(_maintenanceDirective.WorkItemsRelationType, _maintenanceDirective.IsFirst.HasValue && _maintenanceDirective.IsFirst.Value);

            comboBoxRelationType.SelectedValue = _selectedRelationTypeUI;

            comboBoxRelationType.SelectedIndexChanged += ComboBoxRelationType_SelectedIndexChanged;
        }
Example #10
0
        /// <summary>
        /// Возвращает значение, показывающее является ли значение элемента управления допустимым
        /// </summary>
        /// <returns></returns>
        public bool ValidateData(out string message)
        {
            var    sb = new StringBuilder();
            string manHourMessage, costMessage, validateFiles;

            ValidateDoubleValue("Man Hours", textBoxManHours.Text, out manHourMessage);
            ValidateDoubleValue("Cost", textBoxCost.Text, out costMessage);

            if (!string.IsNullOrEmpty(manHourMessage))
            {
                sb.AppendLine(manHourMessage);
            }
            if (!string.IsNullOrEmpty(costMessage))
            {
                sb.AppendLine(costMessage);
            }
            if (!fileControl.ValidateData(out validateFiles))
            {
                sb.AppendLine("FAA File: " + validateFiles);
            }

            var selectedMpd = (MaintenanceDirective)lookupComboboxMaintenanceDirective.SelectedItem;

            if (selectedMpd != null)
            {
                var selectedRelationTypeUI = (WorkItemsRelationTypeUI)comboBoxRelationType.SelectedValue;
                var selectedRelationType   = ItemRelationHelper.ConvertUIItemRelationToBLItem(selectedRelationTypeUI, !(selectedMpd.IsFirst.GetValueOrDefault(false)));

                if (!selectedMpd.ItemRelations.IsAllRelationWith(_currentComponentDirective) && selectedMpd.ItemRelations.Any(i => i.RelationTypeId != selectedRelationType))
                {
                    sb.AppendLine($"You not able to bing this component with MPD {selectedMpd.ItemId} as {selectedRelationType},");
                    sb.AppendLine($"because this MPD have link with other components as {selectedMpd.WorkItemsRelationType}");
                }
            }

            message = sb.ToString();
            if (message != "")
            {
                return(false);
            }
            return(true);
        }
Example #11
0
        private void LookupComboboxMaintenanceDirectiveSelectedIndexChanged(object sender, EventArgs e)
        {
            if (lookupComboboxMaintenanceDirective.SelectedItem != null)
            {
                var bindedItem    = (MaintenanceDirective)lookupComboboxMaintenanceDirective.SelectedItem;
                var itemRelations = GlobalObjects.ItemsRelationsDataAccess.GetRelations(bindedItem.ItemId, bindedItem.SmartCoreObjectType.ItemId);

                if (_lastBindedMpd == null)
                {
                    _lastBindedMpd = bindedItem;
                }
                comboBoxMpdTaskType.SelectedItem = bindedItem.WorkType;

                bindedItem.ItemRelations.Clear();

                if (itemRelations.Count > 0)
                {
                    //TODO:(Evgenii Babak) фикс очень кривой нужно вычислять WorkItemsRelationType с помощью метода расширения для коллекции relation - ов
                    bindedItem.ItemRelations.AddRange(itemRelations);

                    if (bindedItem.ItemRelations.IsAllRelationWith(SmartCoreType.ComponentDirective))
                    {
                        comboBoxRelationType.SelectedValue = ItemRelationHelper.ConvertBLItemRelationToUIITem(bindedItem.WorkItemsRelationType, !(bindedItem.IsFirst.HasValue && bindedItem.IsFirst.Value));
                    }
                    else
                    {
                        ItemRelationHelper.ShowDialogIfItemHaveLinkWithAnotherItem($"MPD {bindedItem.MPDNumber}", "AD", "Component");
                    }
                }
                else
                {
                    var selectedItem = (WorkItemsRelationTypeUI)comboBoxRelationType.SelectedValue;
                    SetControlsEnable(selectedItem == WorkItemsRelationTypeUI.ThisItemAffectOnAnother);
                }
            }
            else
            {
                SetControlsEnable(true);
            }
        }
        private void ButtonAddClick(object sender, EventArgs e)
        {
            if (listViewTasksForSelect.SelectedItems.Count == 0)
            {
                return;
            }

            if (_directive.IsFirst == null)
            {
                _directive.NormalizeItemRelations();
                comboBoxRelationType.SelectedValue = ItemRelationHelper.ConvertBLItemRelationToUIITem(_directive.WorkItemsRelationType, false);
            }
            //Список выбранных задач по компонентам для привязки
            var selectedDirectives = listViewTasksForSelect.SelectedItems.ToList();

            //список уже призязанных задач по компонетам
            var bindedDirectives       = listViewBindedTasks.GetItemsArray().ToList();
            var concatenatedDirectives = selectedDirectives.Concat(bindedDirectives);

            listViewTasksForSelect.RemoveItems(selectedDirectives);
            listViewBindedTasks.SetItemsArray(concatenatedDirectives.ToArray());

            _newBindedItems.AddRange(selectedDirectives);
        }
        private void UpdateInformation()
        {
            if (_currentDirective == null)
            {
                return;
            }
            checkBoxAPU.CheckedChanged -= CheckBoxAPU_CheckedChanged;
            checkBoxAPU.Checked         = _currentDirective.APUCalc;
            checkBoxAPU.CheckedChanged += CheckBoxAPU_CheckedChanged;

            var relationType = ItemRelationHelper.ConvertBLItemRelationToUIITem(
                _currentDirective.WorkItemsRelationType,
                _currentDirective.IsFirst.HasValue && _currentDirective.IsFirst.Value);

            SetControlsEnable(relationType != WorkItemsRelationTypeUI.ThisItemDependsFromAnother);

            _effDate = _currentDirective.Threshold.EffectiveDate;

            //GlobalObjects.PerformanceCalculator.GetNextPerformance(_currentDirective);

            comboBoxNdt.Items.Clear();
            comboBoxNdt.Items.AddRange(NDTType.Items.ToArray());
            comboBoxNdt.SelectedItem = _currentDirective.NDTType;

            comboBoxSkill.Items.Clear();
            comboBoxSkill.Items.AddRange(Skill.Items.ToArray());
            comboBoxSkill.SelectedItem = _currentDirective.Skill;

            comboBoxWorkType.Items.Clear();
            var directiveTypes = MaintenanceDirectiveTaskType.Items;

            foreach (MaintenanceDirectiveTaskType t in directiveTypes)
            {
                comboBoxWorkType.Items.Add(t);
                if (_currentDirective.WorkType.ItemId == t.ItemId)
                {
                    comboBoxWorkType.SelectedItem = t;
                }
            }
            if (comboBoxWorkType.SelectedItem == null)
            {
                comboBoxWorkType.SelectedIndex = 0;
            }

            if (_currentDirective.Condition == ConditionState.Overdue)
            {
                imageLinkLabelStatus.Status = Statuses.NotSatisfactory;
            }
            if (_currentDirective.Condition == ConditionState.Notify)
            {
                imageLinkLabelStatus.Status = Statuses.Notify;
            }
            if (_currentDirective.Condition == ConditionState.Satisfactory)
            {
                imageLinkLabelStatus.Status = Statuses.Satisfactory;
            }
            if (Math.Abs(_currentDirective.ManHours) > 0.000001)
            {
                textBoxManHours.Text = _currentDirective.ManHours.ToString(CultureInfo.InvariantCulture);
            }
            if (Math.Abs(_currentDirective.Elapsed) > 0.000001)
            {
                textBoxElapsed.Text = _currentDirective.Elapsed.ToString(CultureInfo.InvariantCulture);
            }
            if (Math.Abs(_currentDirective.Cost) > 0.000001)
            {
                textBoxCost.Text = _currentDirective.Cost.ToString(CultureInfo.InvariantCulture);
            }

            checkBoxKitsApplicable.CheckedChanged -= checkBoxKitsApplicable_CheckedChanged;
            checkBoxClose.Checked = _currentDirective.IsClosed;

            checkBoxKitsApplicable.Checked         = _currentDirective.KitsApplicable;
            linkLabelEditKit.Enabled               = _currentDirective.KitsApplicable;
            textBoxKitRequired.Enabled             = _currentDirective.KitsApplicable;
            textBoxKitRequired.Text                = _currentDirective.KitsApplicable ? $"{_currentDirective.Kits.Count} EA" : "N/A";
            checkBoxKitsApplicable.CheckedChanged += checkBoxKitsApplicable_CheckedChanged;

            //MPD Item может иметь привязку либо на MaintenanceCheck либо на Компоненты
            if (_currentDirective.MaintenanceCheck != null)
            {
                linkLabelEditComponents.Enabled        = false;
                lookupComboboxMaintenanceCheck.Enabled = true;
            }
            else if (_currentDirective.ItemRelations.Count > 0)
            {
                linkLabelEditComponents.Enabled        = true;
                lookupComboboxMaintenanceCheck.Enabled = false;
            }

            SetTextBoxComponentsString(_bindedItems);

            #region MaintenanceCheck

            lookupComboboxMaintenanceCheck.SelectedIndexChanged -= LookupComboboxMaintenanceCheckSelectedIndexChanged;

            if (_currentDirective.ParentBaseComponent.BaseComponentType == BaseComponentType.Frame)
            {
                var maintenanceScreenDisplayerText =
                    $"{_currentDirective.ParentBaseComponent.GetParentAircraftRegNumber()} Maintenance Program";
                var pareAircraft = GlobalObjects.AircraftsCore.GetAircraftById(_currentDirective.ParentBaseComponent.ParentAircraftId);                //TODO:(Evgenii Babak) пересмотреть использование ParentAircrafId здесь
                lookupComboboxMaintenanceCheck.SetItemsScreenControl <MaintenanceScreen>(new[] { pareAircraft },
                                                                                         maintenanceScreenDisplayerText);
                lookupComboboxMaintenanceCheck.LoadObjectsFunc = GlobalObjects.MaintenanceCore.GetMaintenanceCheck;
                lookupComboboxMaintenanceCheck.FilterParam1    = pareAircraft;
                lookupComboboxMaintenanceCheck.SelectedItemId  = _currentDirective.MaintenanceCheck != null
                    ? _currentDirective.MaintenanceCheck.ItemId
                    : -1;
                lookupComboboxMaintenanceCheck.UpdateInformation();
            }

            lookupComboboxMaintenanceCheck.SelectedIndexChanged += LookupComboboxMaintenanceCheckSelectedIndexChanged;

            #endregion

            if (_currentDirective.Threshold != null)
            {
                lifelengthViewer_SinceNew.Lifelength     = _currentDirective.Threshold.FirstPerformanceSinceNew;
                lifelengthViewer_SinceEffDate.Lifelength = _currentDirective.Threshold.FirstPerformanceSinceEffectiveDate;
                lifelengthViewer_FirstNotify.Lifelength  = _currentDirective.Threshold.FirstNotification;
                lifelengthViewer_Repeat.Lifelength       = _currentDirective.Threshold.RepeatInterval;
                lifelengthViewer_RepeatNotify.Lifelength = _currentDirective.Threshold.RepeatNotification;
                if (_currentDirective.Threshold.FirstPerformanceConditionType == ThresholdConditionType.WhicheverFirst)
                {
                    radio_FirstWhicheverFirst.Checked = true;
                }
                else
                {
                    radio_FirstWhicheverLast.Checked = true;
                }
                if (_currentDirective.Threshold.RepeatPerformanceConditionType == ThresholdConditionType.WhicheverFirst)
                {
                    radio_RepeatWhicheverFirst.Checked = true;
                }
                else
                {
                    radio_RepeatWhicheverLast.Checked = true;
                }
            }
        }
Example #14
0
        protected override void AnimatedThreadWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            _result.Clear();
            _initial.Clear();
            var mtopDirectives = new List <IMtopCalc>();

            AnimatedThreadWorker.ReportProgress(10, "load Directives");


            var baseComponents = GlobalObjects.ComponentCore.GetAicraftBaseComponents(CurrentAircraft.ItemId);
            var components     = GlobalObjects.ComponentCore.GetComponents(baseComponents.ToList())
                                 .Where(i => i.ParentBaseComponent.BaseComponentTypeId != BaseComponentType.LandingGear.ItemId);
            var componentDirectives = components.SelectMany(i => i.ComponentDirectives).ToList();


            var bcDirective = baseComponents.SelectMany(i => i.ComponentDirectives);

            foreach (var directive in bcDirective)
            {
                directive.FromBaseComponent = true;
            }

            componentDirectives.AddRange(bcDirective);

            var mpds        = GlobalObjects.MaintenanceCore.GetMaintenanceDirectives(CurrentAircraft);
            var mpdToRemove = new List <MaintenanceDirective>();

            foreach (var componentDirective in componentDirectives)
            {
                foreach (var items in componentDirective.ItemRelations.Where(i =>
                                                                             i.FirtsItemTypeId == SmartCoreType.MaintenanceDirective.ItemId ||
                                                                             i.SecondItemTypeId == SmartCoreType.MaintenanceDirective.ItemId))
                {
                    var id  = componentDirective.IsFirst == true ? items.SecondItemId : items.FirstItemId;
                    var mpd = mpds.FirstOrDefault(i => i.ItemId == id);

                    if (mpd != null)
                    {
                        componentDirective.MaintenanceDirective = mpd;

                        var bindedItemRelationType = ItemRelationHelper
                                                     .ConvertBLItemRelationToUIITem(componentDirective.WorkItemsRelationType,
                                                                                    componentDirective.IsFirst.HasValue && componentDirective.IsFirst.Value);
                        if (bindedItemRelationType == WorkItemsRelationTypeUI.ThisItemAffectOnAnother)
                        {
                            mpdToRemove.Add(mpd);
                        }
                    }
                }
            }

            foreach (var directive in mpdToRemove)
            {
                mpds.Remove(directive);
            }

            var directives = GlobalObjects.DirectiveCore.GetDirectives(CurrentAircraft, DirectiveType.All);

            mtopDirectives.AddRange(mpds.Where(i => i.Status == DirectiveStatus.Open || i.Status == DirectiveStatus.Repetative));
            mtopDirectives.AddRange(directives.Where(i => i.Status == DirectiveStatus.Open || i.Status == DirectiveStatus.Repetative));
            mtopDirectives.AddRange(componentDirectives.Where(i => i.Status == DirectiveStatus.Open || i.Status == DirectiveStatus.Repetative));



            if (AnimatedThreadWorker.CancellationPending)
            {
                e.Cancel = true;
                return;
            }


            AnimatedThreadWorker.ReportProgress(50, "Calculation");


            GlobalObjects.MTOPCalculator.CalculateDirectiveNew(mtopDirectives, _averageUtilization);

            _initial.AddRange(mtopDirectives.SelectMany(i => i.NextPerformances));

            FilterItems(_initial, _result);

            if (AnimatedThreadWorker.CancellationPending)
            {
                e.Cancel = true;
                return;
            }



            #region Сравнение с рабочими пакетами

            AnimatedThreadWorker.ReportProgress(90, "comparison with the Work Packages");

            //загрузка рабочих пакетов для определения
            //перекрытых ими выполнений задач
            if (_openPubWorkPackages == null)
            {
                _openPubWorkPackages = new CommonCollection <WorkPackage>();
            }
            _openPubWorkPackages.Clear();
            _openPubWorkPackages.AddRange(GlobalObjects.WorkPackageCore.GetWorkPackagesLite(CurrentAircraft, WorkPackageStatus.Opened));
            _openPubWorkPackages.AddRange(GlobalObjects.WorkPackageCore.GetWorkPackagesLite(CurrentAircraft, WorkPackageStatus.Published));
            //сбор всех записей рабочих пакетов для удобства фильтрации
            var openWPRecords = new List <WorkPackageRecord>();
            foreach (var openWorkPackage in _openPubWorkPackages)
            {
                openWPRecords.AddRange(openWorkPackage.WorkPakageRecords);
            }

            foreach (var task in mtopDirectives)
            {
                if (task.NextPerformances.Count <= 0)
                {
                    continue;
                }
                //Проход по всем след. выполнениям чека и записям в рабочих пакетах
                //для поиска перекрывающихся выполнений
                var performances = task.NextPerformances;
                foreach (NextPerformance np in performances)
                {
                    //поиск записи в рабочих пакетах по данному чеку
                    //чей номер группы выполнения (по записи) совпадает с расчитанным
                    var wpr =
                        openWPRecords.FirstOrDefault(r => r.PerformanceNumFromStart == np.PerformanceNum &&
                                                     r.WorkPackageItemType == task.SmartCoreObjectType.ItemId &&
                                                     r.DirectiveId == task.ItemId);
                    if (wpr != null)
                    {
                        np.BlockedByPackage = _openPubWorkPackages.GetItemById(wpr.WorkPakageId);
                    }
                }
            }

            if (AnimatedThreadWorker.CancellationPending)
            {
                e.Cancel = true;
                return;
            }
            #endregion
            AnimatedThreadWorker.ReportProgress(100, "Completed");
        }
Example #15
0
        private void UpdateInformation()
        {
            lookupComboboxMaintenanceDirective.SelectedIndexChanged -= LookupComboboxMaintenanceDirectiveSelectedIndexChanged;
            comboBoxRelationType.SelectedIndexChanged -= ComboBoxRelationType_SelectedIndexChanged;

            extendableRichContainer.labelCaption.Text =
                _currentComponentDirective.DirectiveType.ToString();

            UpdateWorkTypes(_currentComponentDirective.ParentComponent.GoodsClass);

            comboBoxNdt.Items.Clear();
            comboBoxNdt.Items.AddRange(NDTType.Items.ToArray());
            comboBoxNdt.SelectedItem = _currentComponentDirective.NDTType;

            comboBoxMpdTaskType.Items.Clear();
            comboBoxMpdTaskType.Items.AddRange(MaintenanceDirectiveTaskType.Items.ToArray());
            comboBoxMpdTaskType.SelectedItem = _currentComponentDirective.MPDTaskType ?? MaintenanceDirectiveTaskType.Unknown;

            //GlobalObjects.PerformanceCalculator.GetNextPerformance(_currentComponentDirective);
            if (_currentComponentDirective.Condition == ConditionState.Overdue)
            {
                imageLinkLabelStatus.Status = Statuses.NotSatisfactory;
            }
            if (_currentComponentDirective.Condition == ConditionState.Notify)
            {
                imageLinkLabelStatus.Status = Statuses.Notify;
            }
            if (_currentComponentDirective.Condition == ConditionState.Satisfactory)
            {
                imageLinkLabelStatus.Status = Statuses.Satisfactory;
            }

            fileControl.UpdateInfo(_currentComponentDirective.FaaFormFile,
                                   "Adobe PDF Files|*.pdf",
                                   "This record does not contain a file proving the FAA File. Enclose PDF file to prove the compliance.",
                                   "Attached file proves the FAA File.");

            documentControl1.CurrentDocument = _currentComponentDirective.Document;
            documentControl1.Added          += DocumentControl1_Added;

            if (_currentComponentDirective.FaaFormFile != null)
            {
                fileControl.AttachedFile = _currentComponentDirective.FaaFormFile.FileName != ""
                                        ? _currentComponentDirective.FaaFormFile
                                        : new AttachedFile {
                    ItemId = _currentComponentDirective.FaaFormFileId
                };
            }

            if (Math.Abs(_currentComponentDirective.ManHours) > 0.000001)
            {
                textBoxManHours.Text = _currentComponentDirective.ManHours.ToString();
            }
            if (Math.Abs(_currentComponentDirective.Cost) > 0.000001)
            {
                textBoxCost.Text = _currentComponentDirective.Cost.ToString();
            }
            textBoxKitRequired.Text   = _currentComponentDirective.Kits.Count + " kits";
            textBoxRemarks.Text       = _currentComponentDirective.Remarks;
            textBoxHiddenRemarks.Text = _currentComponentDirective.HiddenRemarks;
            checkBoxClose.Checked     = _currentComponentDirective.IsClosed;
            checkBoxIsExpiry.Checked  = _currentComponentDirective.IsExpiry;

            textBoxZoneArea.Text = _currentComponentDirective.ZoneArea;
            textBoxAcess.Text    = _currentComponentDirective.AccessDirective;
            textBoxAAM.Text      = _currentComponentDirective.AAM;
            textBoxCMM.Text      = _currentComponentDirective.CMM;
            if (_currentComponentDirective?.ExpiryDate != null)
            {
                dateTimePickerExpiryDate.Value = _currentComponentDirective.ExpiryDate.Value;
            }


            #region ItemRelationCombobox

            comboBoxRelationType.DisplayMember = "Key";
            comboBoxRelationType.ValueMember   = "Value";
            comboBoxRelationType.DataSource    = EnumHelper.GetDisplayValueMemberDict <WorkItemsRelationTypeUI>();

            #endregion

            #region MaintenanceDirective

            var pareAircraft = GlobalObjects.AircraftsCore.GetAircraftById(_currentComponentDirective.ParentComponent.ParentAircraftId);            //TODO:(Evgenii Babak) пересмотреть использование ParentAircrafId здесь
            if (pareAircraft != null)
            {
                var maintenanceScreenDisplayerText = $"{_currentComponentDirective.ParentComponent.GetParentAircraftRegNumber()}. MPD";

                lookupComboboxMaintenanceDirective.SetEditScreenControl <MaintenanceDirectiveScreen>
                    (maintenanceScreenDisplayerText);
                lookupComboboxMaintenanceDirective.SetItemsScreenControl <MaintenanceDirectiveListScreen>
                    (new object[] { pareAircraft }, maintenanceScreenDisplayerText);
                lookupComboboxMaintenanceDirective.LoadObjectsFunc = GlobalObjects.MaintenanceCore.GetMaintenanceDirectives;
                lookupComboboxMaintenanceDirective.FilterParam1    = pareAircraft;
                //lookupComboboxMaintenanceDirective.FilterParam2 =
                //	new ICommonFilter[] { new CommonFilter<int>(MaintenanceDirective.MaintenanceCheckProperty, FilterType.LessOrEqual, new[] { 0 }) };
            }

            #endregion

            try
            {
                var itemRelation = _currentComponentDirective.ItemRelations.SingleOrDefault();
                var mpdId        = -1;
                WorkItemsRelationTypeUI relationType;
                if (itemRelation != null && (itemRelation.FirtsItemTypeId == SmartCoreType.MaintenanceDirective.ItemId ||
                                             itemRelation.SecondItemTypeId == SmartCoreType.MaintenanceDirective.ItemId))
                {
                    mpdId        = _currentComponentDirective.IsFirst == true ? itemRelation.SecondItemId : itemRelation.FirstItemId;
                    relationType = ItemRelationHelper.ConvertBLItemRelationToUIITem(_currentComponentDirective.WorkItemsRelationType, _currentComponentDirective.IsFirst.HasValue && _currentComponentDirective.IsFirst.Value);
                }
                else
                {
                    relationType = WorkItemsRelationTypeUI.ThisItemAffectOnAnother;
                }

                lookupComboboxMaintenanceDirective.SelectedItemId = mpdId;
                comboBoxRelationType.SelectedValue = relationType;
                SetControlsEnable(relationType == WorkItemsRelationTypeUI.ThisItemAffectOnAnother);
            }
            catch (InvalidOperationException)
            {
                ItemRelationHelper.ShowDialogIfItemLinksCountMoreThanOne($"Component {_currentComponentDirective.PartNumber}", _currentComponentDirective.ItemRelations.Count);
            }
            catch (Exception ex)
            {
                Program.Provider.Logger.Log(ex);
            }

            if (_currentComponentDirective.Threshold != null)
            {
                if (_currentComponentDirective.DirectiveTypeId == ComponentRecordType.Preservation.ItemId)
                {
                    dateTimePickerEffDate.Value = _currentComponentDirective.Threshold.EffectiveDate;
                    lifelengthViewer_FirstPerformance.Lifelength = _currentComponentDirective.Threshold.FirstPerformanceSinceEffectiveDate;
                }
                else
                {
                    lifelengthViewer_FirstPerformance.Lifelength = _currentComponentDirective.Threshold.FirstPerformanceSinceNew;
                }
                lifelengthViewer_FirstNotify.Lifelength   = _currentComponentDirective.Threshold.FirstNotification;
                lifelengthViewerRptInterval.Lifelength    = _currentComponentDirective.Threshold.RepeatInterval;
                lifelengthViewerRptNotify.Lifelength      = _currentComponentDirective.Threshold.RepeatNotification;
                lifelengthViewerWarranty.Lifelength       = _currentComponentDirective.Threshold.Warranty;
                lifelengthViewerWarrantyNotify.Lifelength = _currentComponentDirective.Threshold.WarrantyNotification;
                lifelengthViewerExpiryRemain.Lifelength   = _currentComponentDirective.ExpiryRemainNotify;

                if (_currentComponentDirective.Threshold.FirstPerformanceConditionType == ThresholdConditionType.WhicheverFirst)
                {
                    radio_WhicheverFirst.Checked = true;
                }
                else
                {
                    radio_WhicheverLater.Checked = true;
                }
            }
            lookupComboboxMaintenanceDirective.UpdateInformation();
            comboBoxRelationType.SelectedIndexChanged += ComboBoxRelationType_SelectedIndexChanged;
            lookupComboboxMaintenanceDirective.SelectedIndexChanged += LookupComboboxMaintenanceDirectiveSelectedIndexChanged;
        }
Example #16
0
        /// <summary>
        /// Возвращает значение, показывающее были ли изменения в данном элементе управления
        /// </summary>
        public bool GetChangeStatus()
        {
            var manHours = ConvertDoubleValue(textBoxManHours.Text);
            var cost     = ConvertDoubleValue(textBoxCost.Text);

            ComponentDirectiveThreshold threshold = new ComponentDirectiveThreshold();

            if (comboBoxWorkType.SelectedItem as ComponentRecordType ==
                ComponentRecordType.Preservation)
            {
                threshold.EffectiveDate = dateTimePickerEffDate.Value;
                threshold.FirstPerformanceSinceEffectiveDate = lifelengthViewer_FirstPerformance.Lifelength;
            }
            else
            {
                threshold.EffectiveDate            = DateTimeExtend.GetCASMinDateTime();
                threshold.FirstPerformanceSinceNew = lifelengthViewer_FirstPerformance.Lifelength;
            }

            threshold.FirstNotification    = lifelengthViewer_FirstNotify.Lifelength;
            threshold.RepeatInterval       = lifelengthViewerRptInterval.Lifelength;
            threshold.RepeatNotification   = lifelengthViewerRptNotify.Lifelength;
            threshold.Warranty             = lifelengthViewerWarranty.Lifelength;
            threshold.WarrantyNotification = lifelengthViewerWarrantyNotify.Lifelength;
            _currentComponentDirective.ExpiryRemainNotify = lifelengthViewerExpiryRemain.Lifelength;
            threshold.FirstPerformanceConditionType       = radio_WhicheverFirst.Checked
                                                                                                          ? ThresholdConditionType.WhicheverFirst
                                                                                                          : ThresholdConditionType.WhicheverLater;

            try
            {
                var bindedItemId           = -1;
                var currentRelation        = _currentComponentDirective.ItemRelations.SingleOrDefault();
                var bindedItemRelationType = ItemRelationHelper.ConvertBLItemRelationToUIITem(_currentComponentDirective.WorkItemsRelationType, _currentComponentDirective.IsFirst.HasValue && _currentComponentDirective.IsFirst.Value);
                if (currentRelation != null)
                {
                    bindedItemId = _currentComponentDirective.IsFirst == true
                                                ? currentRelation.SecondItemId
                                                : currentRelation.FirstItemId;
                }

                if (_currentComponentDirective.ManHours != manHours ||
                    lookupComboboxMaintenanceDirective.SelectedItemId != bindedItemId ||
                    _currentComponentDirective.MPDTaskType != comboBoxMpdTaskType.SelectedItem ||
                    (WorkItemsRelationTypeUI)comboBoxRelationType.SelectedValue != bindedItemRelationType ||
                    _currentComponentDirective.Cost != cost ||
                    _currentComponentDirective.IsClosed != IsClosed ||
                    _currentComponentDirective.IsExpiry != IsExpiry ||
                    _currentComponentDirective.KitRequired != textBoxKitRequired.Text ||
                    _currentComponentDirective.Remarks != textBoxRemarks.Text ||
                    textBoxZoneArea.Text != _currentComponentDirective.ZoneArea ||
                    textBoxAcess.Text != _currentComponentDirective.AccessDirective ||
                    textBoxAAM.Text != _currentComponentDirective.AAM ||
                    textBoxCMM.Text != _currentComponentDirective.CMM ||
                    dateTimePickerExpiryDate.Value != _currentComponentDirective.ExpiryDate ||
                    _currentComponentDirective.NDTType.ItemId != ((NDTType)comboBoxNdt.SelectedItem).ItemId ||
                    _currentComponentDirective.Threshold.ToString() != threshold.ToString() ||
                    _currentComponentDirective.FaaFormFile != fileControl.AttachedFile ||
                    _currentComponentDirective.HiddenRemarks != textBoxHiddenRemarks.Text ||
                    _currentComponentDirective.DirectiveType.ItemId != ((ComponentRecordType)comboBoxWorkType.SelectedItem).ItemId ||
                    fileControl.GetChangeStatus())
                {
                    return(true);
                }
            }
            catch (InvalidOperationException)
            {
                ItemRelationHelper.ShowDialogIfItemLinksCountMoreThanOne($"Component {_currentComponentDirective.PartNumber}", _currentComponentDirective.ItemRelations.Count);
            }
            catch (Exception ex)
            {
                Program.Provider.Logger.Log("Error while saving data", ex);
                return(true);
            }
            return(false);
        }
Example #17
0
        private void ButtonAddClick(object sender, EventArgs e)
        {
            if (listViewTasksForSelect.SelectedItems.Count == 0)
            {
                return;
            }

            if (_maintenanceDirective.IsFirst == null)
            {
                _maintenanceDirective.NormalizeItemRelations();
                comboBoxRelationType.SelectedValue = ItemRelationHelper.ConvertBLItemRelationToUIITem(_maintenanceDirective.WorkItemsRelationType, false);
            }

            //коллекция элементов которые нужно добавить в список, содержащий все связные задачи
            var itemsToInsert = new CommonCollection <BaseEntityObject>();
            //Список выбранных задач по компонентам для привязки
            var selectedDirectives = listViewTasksForSelect.SelectedItems.OfType <ComponentDirective>().ToList();
            //Коллекция выбранных компонентов для привязки
            var selectedComponents = new ComponentCollection(listViewTasksForSelect.SelectedItems.OfType <Component>());

            if (selectedComponents.Count == 0 && selectedDirectives.Count == 0)
            {
                return;
            }
            //список уже призязанных задач по компонетам
            var bindedDirectives = listViewBindedTasks.SelectedItems.OfType <ComponentDirective>().ToList();
            //Объединенный список выбранных и привязанных компонентов
            var concatenatedDirectives = selectedDirectives.Concat(bindedDirectives);

            foreach (ComponentDirective dd in concatenatedDirectives)
            {
                if (concatenatedDirectives.Count(d => d.ComponentId == dd.ComponentId) > 1)
                {
                    //проверка, не выбраны ли 2 или более задач по одному компоненту для привязки
                    //т.к. MPD Item может быть привязан только к одной задаче каждого выбранного компонента
                    string parentComponent;
                    if (dd.ParentComponent != null)
                    {
                        parentComponent = dd.ParentComponent.SerialNumber;
                    }
                    else
                    {
                        parentComponent = "Component ID: " + dd.ComponentId;
                    }

                    MessageBox.Show("the MPD Item can not be bound to two or more tasks of a one component:" +
                                    "\n" + parentComponent,
                                    (string)new GlobalTermsProvider()["SystemName"],
                                    MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }

                try
                {
                    var singleItemRelation = dd.ItemRelations.SingleOrDefault();
                    if (singleItemRelation != null &&
                        !CheckThatItemHaveRelationsOnlyWithProvidedItem(dd.IsFirst.HasValue && dd.IsFirst.Value,
                                                                        singleItemRelation, _maintenanceDirective.ItemId,
                                                                        SmartCoreType.MaintenanceDirective.ItemId))
                    {
                        //Проверка не имеет ли выбранная задача по компоненту привязки к другой задаче
                        string parentComponent;
                        if (dd.ParentComponent != null)
                        {
                            parentComponent = dd.ParentComponent.SerialNumber;
                        }
                        else
                        {
                            parentComponent = "Component ID: " + dd.ComponentId;
                        }

                        MessageBox.Show("You can not select a task: " +
                                        "\n" + parentComponent + " " + dd.DirectiveType +
                                        "\n" + "because task already has a binding",
                                        (string)new GlobalTermsProvider()["SystemName"],
                                        MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                        return;
                    }
                }
                catch (InvalidOperationException)
                {
                    ItemRelationHelper.ShowDialogIfItemLinksCountMoreThanOne($"Component {dd.PartNumber}", dd.ItemRelations.Count);
                }
                catch (Exception ex)
                {
                    Program.Provider.Logger.Log(ex);
                }
            }
            //Удаление из коллекции выбранных компонентов тех компонентов,
            //задачи по которым содержатся в коллекции selectedDirectives
            foreach (ComponentDirective directive in selectedDirectives)
            {
                selectedComponents.RemoveById(directive.ComponentId);
            }
            //Производится привязка выбранных задач по компонентам к выполнению данного MPD
            foreach (ComponentDirective dd in selectedDirectives.Where(d => d.ItemRelations.Count == 0))
            {
                try
                {
                    //TODO:(Evgenii Babak) проверить использования свойств
                    dd.MPDTaskType   = _maintenanceDirective.WorkType;
                    dd.FaaFormFile   = _maintenanceDirective.TaskCardNumberFile;
                    dd.FaaFormFileId = _maintenanceDirective.TaskCardNumberFile != null
                                                                                        ? _maintenanceDirective.TaskCardNumberFile.ItemId
                                                                                        : -1;

                    AddComponentAndDirectiveToBindedItemsCollections(dd.ParentComponent, dd, itemsToInsert, _bindedItems, _newBindedItems);
                    //Удаление задачи по компоненту из элемента управления содержащего список всех задач
                    listViewTasksForSelect.RemoveItem(dd);
                }
                catch (Exception ex)
                {
                    Program.Provider.Logger.Log("Error while save bind task record", ex);
                }
            }

            //Производится привязка выбранных компонентов к выполнению данного MPD
            //В результате предыдущих манипуляций в коллекции выбранных компонентов
            //должны остаться компоненты у которых либо нет задач, либо не одна не была выбрана
            foreach (Component selectedComponent in selectedComponents)
            {
                if (selectedComponent.ComponentDirectives.Count == 0)
                {
                    //Выбранный компонент не имеет задач.
                    //Для привязки необходимо создать задачу
                    if (MessageBox.Show("Component:" +
                                        "\n" + selectedComponent +
                                        "\n" + "has no directives!" +
                                        "\n" +
                                        "\n" + "Create and save directive for this MPD Item?",
                                        (string)new GlobalTermsProvider()["SystemName"],
                                        MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation)
                        != DialogResult.Yes)
                    {
                        continue;
                    }
                }
                else if (selectedComponent.ComponentDirectives.All(dd => dd.ItemRelations.Any(i => !CheckThatItemHaveRelationsOnlyWithProvidedItem(dd.IsFirst.HasValue && dd.IsFirst.Value,
                                                                                                                                                   i,
                                                                                                                                                   _maintenanceDirective.ItemId,
                                                                                                                                                   SmartCoreType.MaintenanceDirective.ItemId))))

                {
                    //Выбранный компонент имеет задачи
                    //Но все они привязаны к другим задачам
                    if (MessageBox.Show("Component:" +
                                        "\n" + selectedComponent +
                                        "\n" + "has directives, but they are bound to other tasks" +
                                        "\n" +
                                        "\n" + "Create and save directive for this MPD Item?",
                                        (string)new GlobalTermsProvider()["SystemName"],
                                        MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation)
                        != DialogResult.Yes)
                    {
                        continue;
                    }
                }
                else if (selectedComponent.ComponentDirectives.Count > 0)
                {
                    //Выбранный компонент имеет задачи
                    //Но ни одна из его задач не была выбрана для привязки
                    //Необходимо задать вопрос: создать ли овую задачу для привязки
                    //или пользователь должен быбрать задачу для привязки сам из имеющихся задач по компоненту
                    if (MessageBox.Show("Component:" +
                                        "\n" + selectedComponent +
                                        "\n" + "has a tasks, but none of them is selected for binding!" +
                                        "\n" +
                                        "\n" + "Create and save directive for this MPD Item, or You choose task to bind yourself" +
                                        "\n" +
                                        "\n" + "Yes - Create and Save directive" +
                                        "\n" + "No - You choose task to bind yourself",
                                        (string)new GlobalTermsProvider()["SystemName"],
                                        MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation)
                        != DialogResult.Yes)
                    {
                        continue;
                    }
                }

                try
                {
                    var neComponentDirective = new ComponentDirective();

                    neComponentDirective.DirectiveType = (ComponentRecordType)ComponentRecordType.Items.GetByShortName(_maintenanceDirective.WorkType.ShortName);

                    neComponentDirective.ManHours = _maintenanceDirective.ManHours;
                    neComponentDirective.Cost     = _maintenanceDirective.Cost;
                    neComponentDirective.Kits.Clear();
                    neComponentDirective.Kits.AddRange(_maintenanceDirective.Kits.ToArray());
                    neComponentDirective.Remarks       = _maintenanceDirective.Remarks;
                    neComponentDirective.HiddenRemarks = _maintenanceDirective.HiddenRemarks;
                    neComponentDirective.MPDTaskType   = _maintenanceDirective.WorkType;
                    neComponentDirective.FaaFormFile   = _maintenanceDirective.TaskCardNumberFile;
                    neComponentDirective.FaaFormFileId = _maintenanceDirective.TaskCardNumberFile != null
                                                                                                                   ? _maintenanceDirective.TaskCardNumberFile.ItemId
                                                                                                                   : -1;
                    neComponentDirective.ComponentId     = selectedComponent.ItemId;
                    neComponentDirective.ParentComponent = selectedComponent;

                    MaintenanceDirectiveThreshold mdt = _maintenanceDirective.Threshold;
                    ComponentDirectiveThreshold   ddt = neComponentDirective.Threshold;

                    ddt.FirstPerformanceSinceNew      = mdt.FirstPerformanceSinceNew;
                    ddt.FirstNotification             = mdt.FirstNotification;
                    ddt.RepeatInterval                = mdt.RepeatInterval;
                    ddt.RepeatNotification            = mdt.RepeatNotification;
                    ddt.FirstPerformanceConditionType = mdt.FirstPerformanceConditionType;


                    AddComponentAndDirectiveToBindedItemsCollections(selectedComponent, neComponentDirective, itemsToInsert, _bindedItems, _newBindedItems);
                }
                catch (Exception ex)
                {
                    Program.Provider.Logger.Log("Error while save bind task record", ex);
                }
            }

            listViewBindedTasks.InsertItems(itemsToInsert);
        }