Exemplo n.º 1
0
        /// <summary>
        /// Обновляет значения полей
        /// </summary>
        public override void FillControls()
        {
            BeginUpdate();

            _specializations.Clear();
            _specializations.AddRange(((CommonDictionaryCollection <Occupation>)GlobalObjects.CasEnvironment.GetDictionary <Occupation>()).ToArray());
            _specialists.Clear();
            _specialists.AddRange(GlobalObjects.CasEnvironment.NewLoader.GetObjectList <SpecialistDTO, Specialist>());
            if (FlightCrewRecord != null)
            {
                comboSpecialization.Items.Clear();
                comboSpecialization.Items.AddRange(_specializations.ToArray());
                comboSpecialist.Items.Clear();

                if (FlightCrewRecord.ItemId > 0)
                {
                    comboSpecialization.SelectedItem = FlightCrewRecord.Occupation;
                    Specialist selectedSpec = _specialists.GetItemById(FlightCrewRecord.Specialist.ItemId);
                    if (selectedSpec != null)
                    {
                        comboSpecialist.SelectedItem = selectedSpec;
                    }
                    else
                    {
                        //Искомый специалист недействителен
                        comboSpecialist.Items.Add(FlightCrewRecord.Specialist);
                        comboSpecialist.SelectedItem = FlightCrewRecord.Specialist;
                    }
                }
                else
                {
                    comboSpecialization.SelectedItem = FlightCrewRecord.Occupation;
                    comboSpecialist.SelectedItem     = FlightCrewRecord.Specialist != null
                        ? _specialists.GetItemById(FlightCrewRecord.Specialist.ItemId)
                        : null;
                }

                if (comboSpecialist.SelectedItem != null && ((Specialist)comboSpecialist.SelectedItem).IsDeleted)
                {
                    comboSpecialist.BackColor = Color.FromArgb(Highlight.Red.Color);
                }
                else
                {
                    comboSpecialist.BackColor = Color.White;
                }
            }
            EndUpdate();
        }
Exemplo n.º 2
0
 protected override void AnimatedThreadWorkerRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     _directivesViewer.SetItemsArray(_itemsArray.ToArray());
     headerControl.PrintButtonEnabled = _directivesViewer.ItemsCount != 0;
     _directivesViewer.Focus();
 }
Exemplo n.º 3
0
        /// <summary>
        /// Заполняет поля для редактирования директивы
        /// </summary>
        private void UpdateInformation()
        {
            ataChapterComboBox.UpdateInformation();

            _specialists.Clear();
            _specialists.AddRange(GlobalObjects.CasEnvironment.NewLoader.GetObjectList <SpecialistDTO, Specialist>());
            _qualifications.Clear();
            var aircraftWorkerCategoties = GlobalObjects.CasEnvironment.GetDictionary <AircraftWorkerCategory>();

            if (aircraftWorkerCategoties != null)
            {
                _qualifications.AddRange(aircraftWorkerCategoties.OfType <AircraftWorkerCategory>());
            }

            comboBoxPreparedBy.Items.Clear();
            comboBoxPreparedBy.Items.AddRange(_specialists.GetValidEntries());
            comboBoxChechedBy.Items.Clear();
            comboBoxChechedBy.Items.AddRange(_specialists.GetValidEntries());
            comboBoxApprovedBy.Items.Clear();
            comboBoxApprovedBy.Items.AddRange(_specialists.GetValidEntries());
            comboBoxQualification.Items.Clear();
            comboBoxQualification.Items.AddRange(_qualifications.ToArray());
            comboBoxMMRef.Items.Clear();
            comboBoxMMRef.Items.AddRange(RefDocType.Items.ToArray());
            comboBoxWorkType.Items.Clear();
            comboBoxWorkType.Items.AddRange(MaintenanceDirectiveTaskType.Items.ToArray());

            commonListViewControlEqipmentAndMaterials.ViewedType = typeof(AccessoryRequired);

            if (_currentDirective == null)
            {
                return;
            }

            ATAChapter                         = _currentDirective.AtaChapter;
            textboxFormRev.Text                = _currentDirective.FormRevision;
            textboxJobCardHeader.Text          = _currentDirective.JobCardHeader;
            dateTimePickerFormRevDate.Value    = _currentDirective.FormDate;
            textboxTitle.Text                  = _currentDirective.Title;
            textBoxStation.Text                = _currentDirective.Station;
            textBoxMRO.Text                    = _currentDirective.MRO;
            textBoxJCRevNumber.Text            = _currentDirective.JobCardRevision;
            textboxFooter.Text                 = _currentDirective.JobCardFooter;
            textBoxAccess.Text                 = _currentDirective.Access;
            textBoxZone.Text                   = _currentDirective.Zone;
            textBoxForm.Text                   = _currentDirective.Form;
            dateTimePickerJCRevDate.Value      = _currentDirective.JobCardRevisionDate;
            textBoxApplicability.Text          = _currentDirective.Applicability;
            textBoxPhase.Text                  = _currentDirective.Phase;
            textBoxWorkArea.Text               = _currentDirective.WorkArea;
            textBoxMMRevisionNumber.Text       = _currentDirective.MaintenanceManualRevision;
            dateTimePickerMMRevisionDate.Value = _currentDirective.MaintenanceManualRevisionDate;
            numericUpDownManHours.Value        = (decimal)_currentDirective.ManHours;
            numericUpDownMan.Value             = _currentDirective.Man;
            textBoxAttachedTo.Text             = "";
            dateTimePickerCheckedDate.Value    = _currentDirective.CheckedByDate;
            dateTimePickerApprovedDate.Value   = _currentDirective.ApprovedByDate;
            dateTimePickerPreparedDate.Value   = _currentDirective.PreparedByDate;

            commonListViewControlEqipmentAndMaterials.SetItemsArray(_currentDirective.Kits.ToArray());

            jobCardTaskListControl.JobCard = _currentDirective;

            if (_currentDirective.PreparedBy != null)
            {
                Specialist selectedSpec = _specialists.GetItemById(_currentDirective.PreparedBy.ItemId);
                if (selectedSpec != null)
                {
                    comboBoxPreparedBy.SelectedItem = selectedSpec;
                }
                else
                {
                    //Искомый специалист недействителен
                    comboBoxPreparedBy.Items.Add(_currentDirective.PreparedBy);
                    comboBoxPreparedBy.SelectedItem = _currentDirective.PreparedBy;
                }
            }

            if (_currentDirective.CheckedBy != null)
            {
                Specialist selectedSpec = _specialists.GetItemById(_currentDirective.CheckedBy.ItemId);
                if (selectedSpec != null)
                {
                    comboBoxChechedBy.SelectedItem = selectedSpec;
                }
                else
                {
                    //Искомый специалист недействителен
                    comboBoxChechedBy.Items.Add(_currentDirective.CheckedBy);
                    comboBoxChechedBy.SelectedItem = _currentDirective.CheckedBy;
                }
            }

            if (_currentDirective.ApprovedBy != null)
            {
                Specialist selectedSpec = _specialists.GetItemById(_currentDirective.ApprovedBy.ItemId);
                if (selectedSpec != null)
                {
                    comboBoxApprovedBy.SelectedItem = selectedSpec;
                }
                else
                {
                    //Искомый специалист недействителен
                    comboBoxApprovedBy.Items.Add(_currentDirective.ApprovedBy);
                    comboBoxApprovedBy.SelectedItem = _currentDirective.ApprovedBy;
                }
            }

            if (_currentDirective.Qualification != null)
            {
                Specialist selectedSpec = _specialists.GetItemById(_currentDirective.Qualification.ItemId);
                if (selectedSpec != null)
                {
                    comboBoxQualification.SelectedItem = selectedSpec;
                }
                else
                {
                    //Искомый специалист недействителен
                    comboBoxQualification.Items.Add(_currentDirective.Qualification);
                    comboBoxQualification.SelectedItem = _currentDirective.Qualification;
                }
            }

            comboBoxWorkType.SelectedItem = _currentDirective.WorkType;
            if (comboBoxWorkType.SelectedItem == null)
            {
                comboBoxWorkType.SelectedIndex = 0;
            }

            comboBoxMMRef.SelectedItem = _currentDirective.MaintenanceManual;
            if (comboBoxMMRef.SelectedItem == null)
            {
                comboBoxMMRef.SelectedIndex = 0;
            }

            //labelACTypeValue;
            //labelACRegValue;
            //labelACTATValue;
            //labelACTACValue;
            //labelRelatedTaskValue;
            //labelDateValue;
            //labelIntervalValue;

            if (comboBoxPreparedBy.SelectedItem != null && ((Specialist)comboBoxPreparedBy.SelectedItem).IsDeleted)
            {
                comboBoxPreparedBy.BackColor = Color.FromArgb(Highlight.Red.Color);
            }
            else
            {
                comboBoxPreparedBy.BackColor = Color.White;
            }

            if (comboBoxChechedBy.SelectedItem != null && ((Specialist)comboBoxChechedBy.SelectedItem).IsDeleted)
            {
                comboBoxChechedBy.BackColor = Color.FromArgb(Highlight.Red.Color);
            }
            else
            {
                comboBoxChechedBy.BackColor = Color.White;
            }

            if (comboBoxApprovedBy.SelectedItem != null && ((Specialist)comboBoxApprovedBy.SelectedItem).IsDeleted)
            {
                comboBoxApprovedBy.BackColor = Color.FromArgb(Highlight.Red.Color);
            }
            else
            {
                comboBoxApprovedBy.BackColor = Color.White;
            }

            if (comboBoxQualification.SelectedItem != null && ((AircraftWorkerCategory)comboBoxQualification.SelectedItem).IsDeleted)
            {
                comboBoxQualification.BackColor = Color.FromArgb(Highlight.Red.Color);
            }
            else
            {
                comboBoxQualification.BackColor = Color.White;
            }
        }