Exemplo n.º 1
0
        /// <summary>
        /// Заполняет поля для редактирования директивы
        /// </summary>
        private void UpdateInformation()
        {
            _specialists.Clear();
            _specialists.AddRange(GlobalObjects.CasEnvironment.NewLoader.GetObjectList <SpecialistDTO, Specialist>());
            _qualifications.Clear();

            var awcs = GlobalObjects.CasEnvironment.GetDictionary <AircraftWorkerCategory>();

            if (awcs != null)
            {
                _qualifications.AddRange(awcs.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());

            commonListViewControlEqipmentAndMaterials.ViewedType = typeof(AccessoryRequired);
            workOrderViewControl.ViewedType = typeof(BaseEntityObject);

            if (_currentDirective == null)
            {
                return;
            }

            textboxFormRev.Text             = _currentDirective.FormRevision;
            textboxWorkOrderHeader.Text     = _currentDirective.RequestHeader;
            dateTimePickerFormRevDate.Value = _currentDirective.FormDate;
            textboxNumber.Text  = _currentDirective.Number;
            textBoxStation.Text = _currentDirective.Station;
            //textBoxMRO.Text = _currentDirective.MRO;
            textBoxTitle.Text       = _currentDirective.Title;
            textBoxDescription.Text = _currentDirective.Description;
            //textboxFooter.Text = _currentDirective.JobCardFooter;
            //textBoxAccess.Text = _currentDirective.Access;
            //textBoxZone.Text = _currentDirective.Zone;
            textBoxForm.Text = _currentDirective.Form;
            //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());

            IEnumerable <IDirective> directives =
                _currentDirective.PackageRecords.Where(pr => pr.Task != null).Select(pr => pr.Task).ToArray();

            workOrderViewControl.SetItemsArray(directives.Select(pr => pr as BaseEntityObject));
            numericUpDownMan.Value      = directives.OfType <IEngineeringDirective>().Sum(d => d.Mans);
            numericUpDownManHours.Value = (Decimal)directives.OfType <IEngineeringDirective>().Sum(d => d.ManHours);
            numericUpDownCost.Value     = (Decimal)directives.OfType <IEngineeringDirective>().Sum(d => d.Cost);

            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;
            }
        }
Exemplo n.º 2
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;
            }
        }