Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void AnimatedThreadWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            _itemsArray.Clear();

            AnimatedThreadWorker.ReportProgress(0, "load directives");

            if (GlobalObjects.CasEnvironment != null)
            {
                _itemsArray.AddRange(GlobalObjects.CasEnvironment.GetDictionary <Occupation>());
            }
            else
            {
                //_itemsArray.AddRange(GlobalObjects.CaaEnvironment.GetDictionary<Specialization>());
                var res = GlobalObjects.CaaEnvironment.NewLoader.GetObjectListAll <CAASpecializationDTO, Occupation>(
                    new Filter("OperatorId", _operatorId));

                foreach (var specialization in res)
                {
                    _itemsArray.Add(specialization);
                }
            }

            AnimatedThreadWorker.ReportProgress(40, "filter directives");

            AnimatedThreadWorker.ReportProgress(70, "filter directives");

            //FilterItems(_itemsArray);

            AnimatedThreadWorker.ReportProgress(100, "Complete");
        }
Ejemplo n.º 2
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();
        }
Ejemplo n.º 3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void AnimatedThreadWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            _itemsArray.Clear();

            AnimatedThreadWorker.ReportProgress(0, "load directives");

            _itemsArray.AddRange(GlobalObjects.CasEnvironment.GetDictionary <Specialization>());

            AnimatedThreadWorker.ReportProgress(40, "filter directives");

            AnimatedThreadWorker.ReportProgress(70, "filter directives");

            //FilterItems(_itemsArray);

            AnimatedThreadWorker.ReportProgress(100, "Complete");
        }
Ejemplo n.º 4
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;
            }
        }
Ejemplo n.º 5
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;
            }
        }