Example #1
0
        private void buttonDeleteDirective_DisplayerRequested(object sender, ReferenceEventArgs e)
        {
            DialogResult result = MessageBox.Show("Do you really want to delete current directive?",
                                                  "Confirm deleting", MessageBoxButtons.YesNoCancel,
                                                  MessageBoxIcon.Warning, MessageBoxDefaultButton.Button2);

            if (result == DialogResult.Yes)
            {
                try
                {
                    IDirectiveContainer parentDirectiveContainer = (IDirectiveContainer)directive.Parent;
                    parentDirectiveContainer.Remove(directive);
                    MessageBox.Show("Directive was deleted successfully", "Directive deleted",
                                    MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception ex)
                {
                    Program.Provider.Logger.Log("Error while deleting data", ex); e.Cancel = true;
                }
            }
            else
            {
                e.Cancel = true;
            }
        }
Example #2
0
        private void buttonDeleteSelected_Click(object sender, EventArgs e)
        {
            DialogResult confirmResult = MessageBox.Show(directiveListView.SelectedItem != null ? "Do you really want to delete engineering order " + directiveListView.SelectedItem.Title + "?" : "Do you really want to delete selected engineering orders? ", "Confirm delete operation",
                                                         MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2);

            if (confirmResult == DialogResult.Yes)
            {
                IDirectiveContainer parent = directiveListView.SelectedItems[0].Parent as IDirectiveContainer;
                if (parent != null)
                {
                    int count = directiveListView.SelectedItems.Count;
                    List <EngineeringOrderDirective> selectedItems = new List <EngineeringOrderDirective>(directiveListView.SelectedItems);
                    directiveListView.ItemsListView.BeginUpdate();
                    for (int i = 0; i < count; i++)
                    {
                        try
                        {
                            parent.Remove(selectedItems[i]);
                        }
                        catch (Exception ex)
                        {
                            Program.Provider.Logger.Log("Error while deleting data", ex); return;
                        }
                    }
                    directiveListView.ItemsListView.EndUpdate();
                    UpdateScreen();
                }
                else
                {
                    MessageBox.Show("Failed to delete engineering order: Parent container is invalid", "Operation failed",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
Example #3
0
        protected void Initialize(IDirectiveContainer _currentItem)
        {
            DirectiveCollectionFilter filter = new DirectiveCollectionFilter(_currentItem.ContainedDirectives, GetCollectionFilters());

            if (_currentItem is Aircraft)
            {
                currentItem = (Aircraft)_currentItem;
                screen      = new DirectiveListScreen((Aircraft)_currentItem, filter, additionalFilter, DirectiveDefaultType, ReportTitileText, DirectiveListView);
            }
            if (_currentItem is BaseDetail)
            {
                currentItem = (BaseDetail)_currentItem;
                screen      = new DirectiveListScreen((BaseDetail)_currentItem, filter, DirectiveDefaultType, ReportTitileText, DirectiveListView);
            }
            screen.CurrentDirectiveType = DirectiveDefaultType;
            if (screen != null)
            {
                screen.ReportBuilder = CreateReportBuilder();
                screen.ReportText    = ReportTitileText;
                screen.Dock          = DockStyle.Fill;
                Controls.Add(screen);
                Dock = DockStyle.Fill;
            }

            screen.BackgroundWorkStart += control_BackgroundWorkStart;
            screen.BackgroundWorkEnd   += control_BackgroundWorkEnd;
        }
Example #4
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="caption"></param>
 /// <param name="selectionFilter"></param>
 /// <param name="discrepanciesFilter"></param>
 /// <param name="additionalFilter"></param>
 /// <param name="directiveContainer"></param>
 public DirectivesDiscrepanciesSettings(string caption, DirectiveFilter selectionFilter, DirectiveFilter discrepanciesFilter, DirectiveCollectionFilter additionalFilter, IDirectiveContainer directiveContainer)
 {
     this.caption             = caption;
     this.directiveContainer  = directiveContainer;
     this.selectionFilter     = selectionFilter;
     this.discrepanciesFilter = discrepanciesFilter;
     this.additionalFilter    = additionalFilter;
 }
 ///<summary>
 /// Создается объект, описывающий отображение добавления директивы
 ///</summary>
 /// <param name="parentAircraft">Родительский объект, в который добавляется директива</param>
 public OutOffPhaseReferencAdding(Aircraft parentAircraft) : this()
 {
     if (parentAircraft == null)
     {
         throw new ArgumentNullException("parentAircraft");
     }
     parentBaseDetail        = parentAircraft;
     aircraftHeader.Aircraft = parentAircraft;
     ClearFields();
 }
 ///<summary>
 /// Создается объект, описывающий отображение добавления директивы
 ///</summary>
 /// <param name="parentAircraft">Родительский объект, в который добавляется директива</param>
 public DamageDirectiveAddingScreen(Aircraft parentAircraft) : this()
 {
     if (parentAircraft == null)
     {
         throw new ArgumentNullException("parentAircraft");
     }
     parentBaseDetail        = parentAircraft;
     aircraftHeader.Aircraft = parentAircraft;
     ClearFields();
 }
        ///<summary>
        /// Создается объект, описывающий отображение добавления директивы
        ///</summary>
        /// <param name="parentBaseDetail">Родительский объект, в который добавляется директива</param>
        public CPCPDirectiveAddingScreen(BaseDetail parentBaseDetail) : this()
        {
            if (parentBaseDetail == null)
            {
                throw new ArgumentNullException("parentBaseDetail");
            }
            this.parentBaseDetail = parentBaseDetail;

            aircraftHeader.Aircraft = parentBaseDetail.ParentAircraft;
            ClearFields();
        }
 ///<summary>
 /// Создается объект, описывающий отображение добавления директивы
 ///</summary>
 /// <param name="parentAircraft">Родительский объект, в который добавляется директива</param>
 /// <param name="directiveType">Тип директивы</param>
 public DispatcheredDirectiveAdding(Aircraft parentAircraft, DirectiveType directiveType)
 {
     if (parentAircraft == null)
     {
         throw new ArgumentNullException("parentAircraft");
     }
     parentBaseDetail   = parentAircraft;
     this.directiveType = directiveType;
     InitializeComponent(directiveType);
     aircraftHeader.Aircraft = parentAircraft;
     ClearFields();
 }
Example #9
0
 ///<summary>
 /// Создается объект, описывающий отображение длбавление директивы
 ///</summary>
 /// <param name="parentAircraft">Родительский объект, в который добавляется директива</param>
 public DispatcheredDirectiveAdding(Aircraft parentAircraft)
     : this()
 {
     if (parentAircraft == null)
     {
         throw new ArgumentNullException("parentAircraft");
     }
     this.parentBaseDetail            = parentAircraft;
     aircraftHeader.Aircraft          = parentAircraft;
     aircraftHeader.AircraftClickable = false;
     aircraftHeader.OperatorClickable = true;
 }
Example #10
0
        ///<summary>
        /// Создается объект, описывающий отображение длбавление директивы
        ///</summary>
        /// <param name="parentBaseDetail">Родительский объект, в который добавляется директива</param>
        public DispatcheredDirectiveAdding(BaseDetail parentBaseDetail, DirectiveType directiveType)
            : this()
        {
            if (parentBaseDetail == null)
            {
                throw new ArgumentNullException("parentBaseDetail");
            }
            this.parentBaseDetail = parentBaseDetail;
            this.directiveType    = directiveType;
            generalDataAndPerformanceControl.CurrentType = directiveType;

            aircraftHeader.Aircraft          = parentBaseDetail.ParentAircraft;
            aircraftHeader.AircraftClickable = true;
            aircraftHeader.OperatorClickable = true;
        }
Example #11
0
 ///<summary>
 /// Создается объект, описывающий отображение добавления директивы
 ///</summary>
 /// <param name="directiveContainer">Родительский объект, в который добавляется директива</param>
 /// <param name="directiveType">Тип директивы</param>
 public DirectiveAddingScreen(IDirectiveContainer directiveContainer, DirectiveType directiveType)
 {
     if (directiveContainer == null)
     {
         throw new ArgumentNullException("directiveContainer");
     }
     currentDirectiveContainer = directiveContainer;
     this.directiveType        = directiveType;
     InitializeComponent(directiveType);
     if (directiveContainer is BaseDetail)
     {
         aircraftHeader.Aircraft = ((BaseDetail)directiveContainer).ParentAircraft;
     }
     else
     {
         aircraftHeader.Aircraft = (Aircraft)directiveContainer;
     }
     ClearFields();
 }
        /// <summary>
        /// Создается элемент - отображение директив заданного ВС
        /// </summary>
        /// <param name="currentItem"></param>
        protected DispatcheredDirectivesView(IDirectiveContainer currentItem)
        {
            DirectiveCollectionFilter filter = new DirectiveCollectionFilter(currentItem.Directives, GetCollectionFilters());

            DirectiveListControl control = null;

            if (currentItem is Aircraft)
            {
                control = new DirectiveListControl((Aircraft)currentItem, filter, ReportTitileText);
            }
            if (currentItem is BaseDetail)
            {
                control = new DirectiveListControl((BaseDetail)currentItem, filter, ReportTitileText, DirectiveDefaultType);
            }
            if (control != null)
            {
                control.ReportBuilder = CreateReportBuilder();
                control.ReportText    = ReportTitileText;
                control.Dock          = DockStyle.Fill;
                Controls.Add(control);
                Dock = DockStyle.Fill;
            }
        }
Example #13
0
 /// <summary>
 /// Создается элемент - отображение директив заданного ВС
 /// </summary>
 /// <param name="currentItem"></param>
 /// <param name="additionalFilter">Дополнительный фильтр</param>
 protected DispatcheredDirectivesView(IDirectiveContainer currentItem, DirectiveCollectionFilter additionalFilter)
 {
     this.additionalFilter = additionalFilter;
     Initialize(currentItem);
     InitComplition += DispatcheredDirectivesView_InitComplition;
 }
 ///<summary>
 /// Создается объект, описывающий отображение добавления директивы
 ///</summary>
 /// <param name="directiveContainer">Родительский объект, в который добавляется директива</param>
 /// <param name="directiveType">Тип директивы</param>
 public DispatcheredDirectiveAddingScreen(IDirectiveContainer directiveContainer, DirectiveType directiveType) : base(directiveContainer, directiveType)
 {
 }
 /// <summary>
 /// Создается элемент управления - отображения коллекции отклонений по директивам
 /// </summary>
 /// <param name="directiveSelectionFilter"></param>
 /// <param name="discrepanciesFilter"></param>
 /// <param name="directiveContainer"></param>
 public DirectivesDiscrepancies(DirectiveCollectionFilter directiveSelectionFilter, DirectiveCollectionFilter discrepanciesFilter, IDirectiveContainer directiveContainer) : this()
 {
     this.directiveSelectionFilter = directiveSelectionFilter;
     this.discrepanciesFilter      = discrepanciesFilter;
     this.directiveContainer       = directiveContainer;
 }
Example #16
0
 /// <summary>
 /// Создается элемент управления - отображения коллекции отклонений по директивам
 /// </summary>
 /// <param name="directiveSelectionFilter"></param>
 /// <param name="directiveContainer"></param>
 public DirectivesDiscrepanciesControl(DirectiveCollectionFilter directiveSelectionFilter, IDirectiveContainer directiveContainer)
 {
     this.directiveSelectionFilter = directiveSelectionFilter;
     this.directiveContainer       = directiveContainer;
 }