Exemple #1
0
        /// <summary>
        /// Возвращает значение, показывающее были ли изменения в данном элементе управления
        /// </summary>
        public bool GetChangeStatus(MaintenanceDirective directive)
        {
            double manHours;
            double elapsed;
            double cost;

            if (!CheckDoubleValue("Man Hours", textBoxManHours.Text, out manHours))
            {
                return(false);
            }
            if (!CheckDoubleValue("Elapsed", textBoxElapsed.Text, out elapsed))
            {
                return(false);
            }
            if (!CheckDoubleValue("Cost", textBoxCost.Text, out cost))
            {
                return(false);
            }

            MaintenanceDirectiveThreshold threshold = new MaintenanceDirectiveThreshold();

            threshold.EffectiveDate                      = _effDate;
            threshold.FirstPerformanceSinceNew           = new Lifelength(lifelengthViewer_SinceNew.Lifelength);
            threshold.FirstPerformanceSinceEffectiveDate = new Lifelength(lifelengthViewer_SinceEffDate.Lifelength);
            threshold.FirstNotification                  = new Lifelength(lifelengthViewer_FirstNotify.Lifelength);
            threshold.RepeatInterval                     = new Lifelength(lifelengthViewer_Repeat.Lifelength);
            threshold.RepeatNotification                 = new Lifelength(lifelengthViewer_RepeatNotify.Lifelength);
            threshold.FirstPerformanceConditionType      = radio_FirstWhicheverFirst.Checked
                                                                                                          ? ThresholdConditionType.WhicheverFirst
                                                                                                          : ThresholdConditionType.WhicheverLater;
            threshold.RepeatPerformanceConditionType = radio_RepeatWhicheverFirst.Checked
                                                                                                          ? ThresholdConditionType.WhicheverFirst
                                                                                                          : ThresholdConditionType.WhicheverLater;

            try
            {
                if (directive.MaintenanceCheck == null && lookupComboboxMaintenanceCheck.SelectedItemId > 0 ||
                    directive.MaintenanceCheck != null && lookupComboboxMaintenanceCheck.SelectedItemId != directive.MaintenanceCheck.ItemId ||
                    directive.ManHours != manHours ||
                    directive.Elapsed != elapsed ||
                    directive.Cost != cost ||
                    checkBoxAPU.Checked != directive.APUCalc ||
                    checkBoxSBControl.Checked != directive.IsSBControl ||
                    directive.NDTType.ItemId != ((NDTType)comboBoxNdt.SelectedItem).ItemId ||
                    directive.Skill.ItemId != ((Skill)comboBoxSkill.SelectedItem).ItemId ||
                    directive.IsClosed != IsClosed ||
                    directive.Threshold.ToString() != threshold.ToString() ||
                    directive.WorkType != comboBoxWorkType.SelectedItem ||
                    directive.KitsApplicable != checkBoxKitsApplicable.Checked)
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                Program.Provider.Logger.Log("Error while saving data", ex);
                return(true);
            }
            return(false);
        }
Exemple #2
0
        private void LookupComboboxMaintenanceDirectiveSelectedIndexChanged(object sender, EventArgs e)
        {
            if (lookupComboboxMaintenanceDirective.SelectedItem != null)
            {
                MaintenanceDirective          md  = (MaintenanceDirective)lookupComboboxMaintenanceDirective.SelectedItem;
                MaintenanceDirectiveThreshold mdt = md.Threshold;
                comboBoxMpdTaskType.SelectedItem             = md.WorkType;
                lifelengthViewer_FirstPerformance.Lifelength = new Lifelength(mdt.FirstPerformanceSinceNew);
                lifelengthViewer_FirstNotify.Lifelength      = new Lifelength(mdt.FirstNotification);
                lifelengthViewerRptInterval.Lifelength       = new Lifelength(mdt.RepeatInterval);
                lifelengthViewerRptNotify.Lifelength         = new Lifelength(mdt.RepeatNotification);
                radio_WhicheverFirst.Checked = true;

                lifelengthViewer_FirstPerformance.Enabled = false;
                lifelengthViewer_FirstNotify.Enabled      = false;
                lifelengthViewerRptInterval.Enabled       = false;
                lifelengthViewerRptNotify.Enabled         = false;
                radio_WhicheverFirst.Enabled = false;
                radio_WhicheverLater.Enabled = false;
            }
            else
            {
                lifelengthViewer_FirstPerformance.Enabled = true;
                lifelengthViewer_FirstNotify.Enabled      = true;
                lifelengthViewerRptInterval.Enabled       = true;
                lifelengthViewerRptNotify.Enabled         = true;
                radio_WhicheverFirst.Enabled = true;
                radio_WhicheverLater.Enabled = true;
            }
        }
Exemple #3
0
 /// <summary>
 /// Переводит объкт баззы данных в MaintenanceDirectiveThreshold
 /// </summary>
 /// <param name="o"></param>
 /// <returns></returns>
 private static MaintenanceDirectiveThreshold ToMaintenanceDirectiveThreshold(object o)
 {
     if (o == null || o == DBNull.Value)
     {
         return(null);
     }
     return(MaintenanceDirectiveThreshold.ConvertFromByteArray((byte[])o));
 }
Exemple #4
0
        /// <summary>
        /// Применение изменений
        /// </summary>
        /// <returns></returns>
        public void ApplyChanges(MaintenanceDirective directive)
        {
            double manHours;
            double elapsed;
            double cost;

            if (!CheckDoubleValue("Man Hours", textBoxManHours.Text, out manHours))
            {
                return;
            }
            if (!CheckDoubleValue("Elapsed", textBoxElapsed.Text, out elapsed))
            {
                return;
            }
            if (!CheckDoubleValue("Cost", textBoxCost.Text, out cost))
            {
                return;
            }
            directive.MaintenanceCheck = lookupComboboxMaintenanceCheck.SelectedItem as MaintenanceCheck;
            directive.WorkType         = ((MaintenanceDirectiveTaskType)comboBoxWorkType.SelectedItem);
            directive.ManHours         = manHours;
            directive.Elapsed          = elapsed;
            directive.Cost             = cost;
            directive.IsClosed         = IsClosed;
            directive.NDTType          = comboBoxNdt.SelectedItem as NDTType;
            directive.Skill            = comboBoxSkill.SelectedItem as Skill;
            directive.KitsApplicable   = checkBoxKitsApplicable.Checked;
            directive.APUCalc          = checkBoxAPU.Checked;
            directive.IsSBControl      = checkBoxSBControl.Checked;
            if (!checkBoxKitsApplicable.Checked && directive.Kits.Count > 0)
            {
                foreach (var kit in directive.Kits)
                {
                    kit.IsDeleted = true;
                }
            }

            var threshold = new MaintenanceDirectiveThreshold
            {
                EffectiveDate                      = _effDate,
                FirstPerformanceSinceNew           = new Lifelength(lifelengthViewer_SinceNew.Lifelength),
                FirstPerformanceSinceEffectiveDate = new Lifelength(lifelengthViewer_SinceEffDate.Lifelength),
                FirstNotification                  = new Lifelength(lifelengthViewer_FirstNotify.Lifelength),
                RepeatInterval                     = new Lifelength(lifelengthViewer_Repeat.Lifelength),
                RepeatNotification                 = new Lifelength(lifelengthViewer_RepeatNotify.Lifelength),
                FirstPerformanceConditionType      = radio_FirstWhicheverFirst.Checked
                                        ? ThresholdConditionType.WhicheverFirst
                                        : ThresholdConditionType.WhicheverLater,
                RepeatPerformanceConditionType = radio_RepeatWhicheverFirst.Checked
                                        ? ThresholdConditionType.WhicheverFirst
                                        : ThresholdConditionType.WhicheverLater
            };

            if (directive.Threshold.ToString() != threshold.ToString())
            {
                directive.Threshold = threshold;
            }
        }
Exemple #5
0
        /*
         *  Методы
         */


        #region public FlightNumber()
        /// <summary>
        /// Создает Описание рейса без дополнительной информации
        /// </summary>
        public FlightNumber()
        {
            SmartCoreObjectType = SmartCoreType.FlightNumber;
            //задаем все ID в -1
            ItemId = -1;

            _performanceRecords = new BaseRecordCollection <DirectiveRecord>();
            _threshold          = new MaintenanceDirectiveThreshold();

            PrintInWorkPackage = true;
        }
Exemple #6
0
        public new MaintenanceDirective GetCopyUnsaved(bool marked = true)
        {
            var maintenanceDirective = (MaintenanceDirective)MemberwiseClone();

            maintenanceDirective.ItemId = -1;
            maintenanceDirective.UnSetEvents();

            if (marked)
            {
                maintenanceDirective.TaskNumberCheck += " Copy";
            }

            if (JobCard != null)
            {
                maintenanceDirective.JobCard = JobCard.GetCopyUnsaved(marked);
                JobCard.Parent = maintenanceDirective;
            }

            maintenanceDirective.Threshold = MaintenanceDirectiveThreshold.ConvertFromByteArray(_threshold.ToBinary());

            maintenanceDirective._performanceRecords = new BaseRecordCollection <DirectiveRecord>();
            foreach (var directiveRecord in PerformanceRecords)
            {
                var newObject = directiveRecord.GetCopyUnsaved(marked);
                newObject.Parent = maintenanceDirective;
                maintenanceDirective._performanceRecords.Add(newObject);
            }

            maintenanceDirective.CategoriesRecords = new CommonCollection <CategoryRecord>();
            foreach (var categoryRecord in CategoriesRecords)
            {
                var newObject = categoryRecord.GetCopyUnsaved(marked);
                newObject.Parent = maintenanceDirective;
                maintenanceDirective.CategoriesRecords.Add(newObject);
            }

            maintenanceDirective._files = new CommonCollection <ItemFileLink>();
            foreach (var file in Files)
            {
                var newObject = file.GetCopyUnsaved(marked);
                maintenanceDirective._files.Add(newObject);
            }

            maintenanceDirective._kits = new CommonCollection <AccessoryRequired>();
            foreach (var kit in Kits)
            {
                var newObject = kit.GetCopyUnsaved(marked);
                maintenanceDirective._kits.Add(newObject);
            }

            return(maintenanceDirective);
        }
        /// <summary>
        /// Применение изменений
        /// </summary>
        /// <returns></returns>
        public void ApplyChanges(Procedure destinationItem)
        {
            double manHours;
            double elapsed;
            double cost;

            if (!CheckDoubleValue("Man Hours", textBoxManHours.Text, out manHours))
            {
                return;
            }
            if (!CheckDoubleValue("Elapsed", textBoxElapsed.Text, out elapsed))
            {
                return;
            }
            if (!CheckDoubleValue("Cost", textBoxCost.Text, out cost))
            {
                return;
            }
            //_currentDirective.MaintenanceCheck = lookupComboboxMaintenanceCheck.SelectedItem as MaintenanceCheck;
            destinationItem.ProcedureType = ((ProcedureType)comboBoxWorkType.SelectedItem);
            destinationItem.ManHours      = manHours;
            destinationItem.Elapsed       = elapsed;
            destinationItem.Cost          = cost;
            destinationItem.IsClosed      = IsClosed;
            //_currentDirective.NonDestructiveTest = checkBoxNDT.Checked;

            MaintenanceDirectiveThreshold threshold = new MaintenanceDirectiveThreshold();

            threshold.EffectiveDate                      = _effDate;
            threshold.FirstPerformanceSinceNew           = new Lifelength(lifelengthViewer_SinceNew.Lifelength);
            threshold.FirstPerformanceSinceEffectiveDate = new Lifelength(lifelengthViewer_SinceEffDate.Lifelength);
            threshold.FirstNotification                  = new Lifelength(lifelengthViewer_FirstNotify.Lifelength);
            threshold.RepeatInterval                     = new Lifelength(lifelengthViewer_Repeat.Lifelength);
            threshold.RepeatNotification                 = new Lifelength(lifelengthViewer_RepeatNotify.Lifelength);
            threshold.FirstPerformanceConditionType      = radio_FirstWhicheverFirst.Checked
                                                      ? ThresholdConditionType.WhicheverFirst
                                                      : ThresholdConditionType.WhicheverLater;
            threshold.RepeatPerformanceConditionType = radio_RepeatWhicheverFirst.Checked
                                                     ? ThresholdConditionType.WhicheverFirst
                                                     : ThresholdConditionType.WhicheverLater;
            if (destinationItem.Threshold.ToString() != threshold.ToString())
            {
                destinationItem.Threshold = threshold;
            }
        }
Exemple #8
0
        /*
         *  Методы
         */


        #region public Procedure()
        /// <summary>
        /// Создает воздушное судно без дополнительной информации
        /// </summary>
        public Procedure()
        {
            SmartCoreObjectType = SmartCoreType.Procedure;
            //задаем все ID в -1
            ItemId = -1;

            // Ad директива
            ProcedureType   = ProcedureType.Unknown;
            ProcedureRating = ProcedureRating.Unknown;
            // Задаем все String
            Title = Remarks = Description = HiddenRemarks = "";

            AuditedObjectId     = -1;
            _performanceRecords = new BaseRecordCollection <DirectiveRecord>();
            _threshold          = new MaintenanceDirectiveThreshold();

            PrintInWorkPackage = true;
            Level = 4;
        }
Exemple #9
0
        /*
         *  Методы
         */


        #region public MaintenanceDirective()

        /// <summary>
        /// Создает воздушное судно без дополнительной информации
        /// </summary>
        public MaintenanceDirective()
        {
            SmartCoreObjectType = SmartCoreType.MaintenanceDirective;
            //задаем все ID в -1
            ItemId = -1;

            // Ad директива
            WorkType             = MaintenanceDirectiveTaskType.Unknown;
            Program              = MaintenanceDirectiveProgramType.Unknown;
            CriticalSystem       = CriticalSystemList.Unknown;
            NDTType              = NDTType.UNK;
            MpdRevisionDate      = DateTime.Today;
            ScheduleRevisionDate = DateTime.Today;
            // Задаем все String
            TaskNumberCheck = MPDTaskNumber = Remarks = Description = EngineeringOrders = HiddenRemarks = "";

            ForComponentId      = -1;
            _performanceRecords = new BaseRecordCollection <DirectiveRecord>();
            _threshold          = new MaintenanceDirectiveThreshold();

            PrintInWorkPackage = true;
        }
Exemple #10
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);
        }
        /// <summary>
        /// Возвращает значение, показывающее были ли изменения в данном элементе управления
        /// </summary>
        public bool GetChangeStatus()
        {
            double manHours;
            double elapsed;
            double cost;

            if (!CheckDoubleValue("Man Hours", textBoxManHours.Text, out manHours))
            {
                return(false);
            }
            if (!CheckDoubleValue("Elapsed", textBoxElapsed.Text, out elapsed))
            {
                return(false);
            }
            if (!CheckDoubleValue("Cost", textBoxCost.Text, out cost))
            {
                return(false);
            }

            MaintenanceDirectiveThreshold threshold = new MaintenanceDirectiveThreshold();

            threshold.EffectiveDate                      = _effDate;
            threshold.FirstPerformanceSinceNew           = new Lifelength(lifelengthViewer_SinceNew.Lifelength);
            threshold.FirstPerformanceSinceEffectiveDate = new Lifelength(lifelengthViewer_SinceEffDate.Lifelength);
            threshold.FirstNotification                  = new Lifelength(lifelengthViewer_FirstNotify.Lifelength);
            threshold.RepeatInterval                     = new Lifelength(lifelengthViewer_Repeat.Lifelength);
            threshold.RepeatNotification                 = new Lifelength(lifelengthViewer_RepeatNotify.Lifelength);
            threshold.FirstPerformanceConditionType      = radio_FirstWhicheverFirst.Checked
                                                      ? ThresholdConditionType.WhicheverFirst
                                                      : ThresholdConditionType.WhicheverLater;
            threshold.RepeatPerformanceConditionType = radio_RepeatWhicheverFirst.Checked
                                                      ? ThresholdConditionType.WhicheverFirst
                                                      : ThresholdConditionType.WhicheverLater;

            try
            {
                //if (_currentDirective.MaintenanceCheck == null && lookupComboboxMaintenanceCheck.SelectedItemId > 0 ||
                //    _currentDirective.MaintenanceCheck != null && lookupComboboxMaintenanceCheck.SelectedItemId != _currentDirective.MaintenanceCheck.ItemId ||
                //    _currentDirective.ManHours != manHours ||
                //    _currentDirective.Elapsed != elapsed ||
                //    _currentDirective.Cost != cost ||
                //    _currentDirective.NonDestructiveTest != checkBoxNDT.Checked ||
                //    _currentDirective.IsClosed != IsClosed ||
                //    _currentDirective.Threshold.ToString() != threshold.ToString() ||
                //    _currentDirective.WorkType != comboBoxWorkType.SelectedItem)
                //{
                //    return true;
                //}

                if (_currentDirective.ManHours != manHours ||
                    _currentDirective.Elapsed != elapsed ||
                    _currentDirective.Cost != cost ||
                    _currentDirective.IsClosed != IsClosed ||
                    _currentDirective.Threshold.ToString() != threshold.ToString() ||
                    _currentDirective.ProcedureType != comboBoxWorkType.SelectedItem)
                {
                    return(true);
                }
            }
            catch (Exception ex)
            {
                Program.Provider.Logger.Log("Error while saving data", ex);
                return(true);
            }
            return(false);
        }