コード例 #1
0
        protected override void AnimatedThreadWorkerRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (e.Cancelled)
            {
                return;
            }

            if (firstLoad)
            {
                if (_initialPeriodArray.Count > 0)
                {
                    dateTimePickerDateFrom.Value = _initialPeriodArray.Min(f => f.DepartureDate);
                    dateTimePickerDateTo.Value   = _initialPeriodArray.Max(f => f.ArrivalDate);
                }
                else
                {
                    dateTimePickerDateFrom.Value = DateTimeExtend.GetCASMinDateTime();
                    dateTimePickerDateTo.Value   = DateTime.Today;
                }
            }

            firstLoad    = false;
            filterPeriod = false;

            foreach (var flightNumber in _resultFlightsArray.OrderBy(f => f.FlightNo.FullName))
            {
                var periods = _resultPeriodArray.Where(f => f.FlightNumberId == flightNumber.ItemId);
                if (periods.Any())
                {
                    _result.Add(flightNumber);
                    foreach (var period in periods)
                    {
                        _result.Add(period);
                    }
                }
            }

            var res = new List <IFlightNumberParams>();

            foreach (var item in _result)
            {
                if (item is FlightNumber)
                {
                    res.Add(item as FlightNumber);

                    var component = (FlightNumber)item;
                    var items     = _result
                                    .Where(lvi =>
                                           lvi is FlightNumberPeriod &&
                                           ((FlightNumberPeriod)lvi).FlightNumberId == component.ItemId).Select(i => i);
                    res.AddRange(items.OfType <FlightNumberPeriod>());
                }
            }

            _directivesViewer.SetItemsArray(res.ToArray());
            _directivesViewer.Focus();

            headerControl.PrintButtonEnabled = _directivesViewer.ItemsCount != 0;
        }
コード例 #2
0
        protected override void AnimatedThreadWorkerRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (_currentAircraft != null)
            {
                labelTitle.Text = "Date as of: " +
                                  SmartCore.Auxiliary.Convert.GetDateFormat(DateTime.Today) + " Aircraft TSN/CSN: " +
                                  GlobalObjects.CasEnvironment.Calculator.GetCurrentFlightLifelength(CurrentAircraft);
            }

            if (_isFirstLoad)
            {
                _isFirstLoad = false;
                var form = new ForecastCustomsMTOP(CurrentAircraft, _currentForecast);

                if (form.ShowDialog() == DialogResult.OK)
                {
                    AnimatedThreadWorker.RunWorkerAsync();
                }
            }

            if (_currentForecast.ForecastDatas.Count > 0)
            {
                var main = _currentForecast.ForecastDatas[0];
                labelDateAsOf.Text =
                    "Forecast Period From: " + SmartCore.Auxiliary.Convert.GetDateFormat(main.LowerLimit) +
                    " To: " + SmartCore.Auxiliary.Convert.GetDateFormat(main.ForecastDate) +
                    "\nAvg. utlz: " + main.AverageUtilization;
            }

            if (_toolStripMenuItemsWorkPackages != null)
            {
                foreach (RadMenuItem item in _toolStripMenuItemsWorkPackages.Items)
                {
                    item.Click -= AddToWorkPackageItemClick;
                }

                _toolStripMenuItemsWorkPackages.Items.Clear();

                foreach (WorkPackage workPackage in _openPubWorkPackages)
                {
                    var item = new RadMenuItem($"{workPackage.Title} {workPackage.Number}");
                    item.Click += AddToWorkPackageItemClick;
                    item.Tag    = workPackage;
                    _toolStripMenuItemsWorkPackages.Items.Add(item);
                }
            }

            _directivesViewer.SetItemsArray(_result.OrderBy(i => i.PerformanceDate).ToArray());
        }
コード例 #3
0
        private void UpdateInformation()
        {
            this.metroComboBoxPersonnel.SelectedIndexChanged -= new System.EventHandler(this.metroComboBoxPersonnel_SelectedIndexChanged);

            textBoxSurname.Text  = _user.Surname;
            textBoxName.Text     = _user.Name;
            textBoxLogin.Text    = _user.Login;
            textBoxPassword.Text = _user.Password;

            if (_user.Personnel.IsCAA)
            {
                metroComboBox1.Items.Clear();
                foreach (var val in Enum.GetValues(typeof(CAAUserType)).OfType <CAAUserType>().Where(i => (int)i < 10).ToList())
                {
                    metroComboBox1.Items.Add(val);
                }
            }
            else
            {
                metroComboBox1.Items.Clear();
                foreach (var val in Enum.GetValues(typeof(CAAUserType)).OfType <CAAUserType>().Where(i => (int)i >= 10).ToList())
                {
                    metroComboBox1.Items.Add(val);
                }
            }

            if (_user.ItemId <= 0)
            {
                metroComboBox1.SelectedIndex = 0;
            }


            metroComboBox1.SelectedItem = _user.UserType;

            foreach (var val in Enum.GetValues(typeof(UiType)).OfType <UiType>().ToArray())
            {
                metroComboBoxUiType.Items.Add(val);
                metroComboBoxUiType.SelectedItem = _user.UiType;
            }



            metroComboBoxPersonnel.Items.AddRange(_specialists.OrderBy(i => i.LastName).ToArray());
            metroComboBoxPersonnel.Items.Add(Specialist.Unknown);
            metroComboBoxPersonnel.SelectedItem = _user.Personnel;

            this.metroComboBoxPersonnel.SelectedIndexChanged += new System.EventHandler(this.metroComboBoxPersonnel_SelectedIndexChanged);
        }
コード例 #4
0
        private void UpdateInformation()
        {
            textBoxSurname.Text  = _user.Surname;
            textBoxName.Text     = _user.Name;
            textBoxLogin.Text    = _user.Login;
            textBoxPassword.Text = _user.Password;

            metroComboBox1.DataSource   = Enum.GetValues(typeof(UsetType));
            metroComboBox1.SelectedItem = _user.UserType;

            metroComboBoxUiType.DataSource   = Enum.GetValues(typeof(UiType));
            metroComboBoxUiType.SelectedItem = _user.UiType;

            metroComboBoxPersonnel.Items.AddRange(_specialists.OrderBy(i => i.LastName).ToArray());
            metroComboBoxPersonnel.Items.Add(Specialist.Unknown);
            metroComboBoxPersonnel.SelectedItem = _user.Personnel;
        }
コード例 #5
0
ファイル: LDNDListScreen.cs プロジェクト: jecus/Cas
        protected override void AnimatedThreadWorkerRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            if (_currentAircraft != null)
            {
                labelTitle.Text = "Date as of: " +
                                  SmartCore.Auxiliary.Convert.GetDateFormat(DateTime.Today) + " Aircraft TSN/CSN: " +
                                  GlobalObjects.CasEnvironment.Calculator.GetCurrentFlightLifelength(CurrentAircraft);
            }

            if (_averageUtilization != null)
            {
                labelDateAsOf.Text = "Avg. utlz: " + _averageUtilization;
            }
            else
            {
                var _frame = GlobalObjects.CasEnvironment.BaseComponents.FirstOrDefault(i =>
                                                                                        i.ParentAircraftId == _currentAircraft.ItemId && Equals(i.BaseComponentType, BaseComponentType.Frame));
                labelDateAsOf.Text = "Avg. utlz: " + _frame.AverageUtilization;
            }

            if (_toolStripMenuItemsWorkPackages != null)
            {
                foreach (RadMenuItem item in _toolStripMenuItemsWorkPackages.Items)
                {
                    item.Click -= AddToWorkPackageItemClick;
                }

                _toolStripMenuItemsWorkPackages.Items.Clear();

                foreach (WorkPackage workPackage in _openPubWorkPackages)
                {
                    var item = new RadMenuItem($"{workPackage.Number} {workPackage.Title}");
                    item.Click += AddToWorkPackageItemClick;
                    item.Tag    = workPackage;
                    _toolStripMenuItemsWorkPackages.Items.Add(item);
                }
            }

            _directivesViewer.SetItemsArray(_result.OrderBy(i => i.PerformanceDate).ToArray());
        }
コード例 #6
0
ファイル: TrackForm.cs プロジェクト: jecus/Cas
        private void BackgroundWorkerRunWorkerLoadCompleted(object sender, RunWorkerCompletedEventArgs e)
        {
            comboBoxCustomer.Items.Clear();
            comboBoxCustomer.Items.AddRange(_supplierArray.ToArray());
            comboBoxCustomer.Items.Add(Supplier.Unknown);

            comboBoxCustomer.SelectedItem = _flightTrack.Supplier;

            foreach (var flightNumber in _resultFlightsArray.OrderBy(f => f.FlightNo.FullName))
            {
                var periods = _resultPeriodArray.Where(f => f.FlightNumberId == flightNumber.ItemId);
                if (periods.Any())
                {
                    _resultArray.Add(flightNumber);
                    foreach (var period in periods)
                    {
                        _resultArray.Add(period);
                    }
                }
            }

            flightNumberListViewAll.SetItemsArray(_resultArray.ToArray());
            flightNumberListView2.SetItemsArray(_addedItems.ToArray());
        }
コード例 #7
0
        protected override void AnimatedThreadWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            _initialDocumentArray.Clear();
            _resultDocumentArray.Clear();


            if (_type == CheckListAuditType.Admin)
            {
                var ds = GlobalObjects.CaaEnvironment.NewLoader.Execute($@"
DECLARE @count INT
DECLARE @countNotSatis INT
DECLARE @countNotSatisRCA INT
SELECT
@count =  COUNT(*),
@countNotSatis = Sum(case when IsSatisfactory = 0 then 1 else 0 end),
@countNotSatisRCA = Sum(case when IsSatisfactory = 0 and WorkflowStageId in (4) then 1 else 0 end)
FROM [dbo].[AuditChecks]  where AuditId = {_auditId} and IsDeleted = 0


select 
 WorkflowStageId as WorkflowStageId,
 case when WorkflowStageId in(2,3,6) then @count else @countNotSatis end as AllTask,
 case when WorkflowStageId in (4) then @countNotSatisRCA
 else Count(*) end as TaskInProgress
 from dbo.AuditChecks 
 where AuditId = {_auditId} and IsDeleted = 0
 group by WorkflowStageId
");

                var dtC = ds.Tables[0];
                foreach (DataRow dr in dtC.Rows)
                {
                    _initialDocumentArray.Add(new AuditPublish()
                    {
                        WorkFlowStageId = int.Parse(dr[0].ToString()),
                        AllTask         = int.Parse(dr[1].ToString()),
                        TaskInProgress  = int.Parse(dr[2].ToString()),
                    });
                }
            }
            else
            {
                var ds = GlobalObjects.CaaEnvironment.NewLoader.Execute($@"
DECLARE @countNotSatis INT
declare @T table(
WorkflowStageId int,
Auditor int,
Auditee int,
IsSatisfactory bit);


;WITH cte AS
(
   SELECT rec.*, auditor.Auditor ,auditee.Auditee, ac.*, ROW_NUMBER() OVER (PARTITION BY rec.CheckListId ORDER BY rec.ItemId DESC) AS rn
   FROM [AuditPelRecords] rec
   cross apply
   (
		select SpecialistId as Auditor from  [dbo].[PelSpecialist] where ItemId = rec.AuditorId
   ) as auditor
   cross apply
   (
		select SpecialistId as Auditee from  [dbo].[PelSpecialist] where ItemId = rec.AuditeeId
   ) as auditee
   cross apply
   (
		select WorkflowStageId,  WorkflowStatusId, IsSatisfactory   from  [dbo].AuditChecks 
		where AuditId = rec.AuditId and CheckListId = rec.CheckListId
   ) as ac
   where rec.AuditId in ({_auditId}) and rec.IsDeleted = 0
)

insert into @T(WorkflowStageId, Auditor, Auditee, IsSatisfactory)
select WorkflowStageId, Auditor, Auditee , IsSatisfactory
from cte
where  rn = 1;

SELECT
@countNotSatis = Sum(case when IsSatisfactory = 0 then 1 else 0 end)
FROM @T

SELECT 
WorkflowStageId as WorkflowStageId,
case when WorkflowStageId in(2,3,6) then Count(*) else @countNotSatis end as AllTask,
Sum(case when ([Auditor] = {GlobalObjects.CaaEnvironment.IdentityUser.PersonnelId}  or [Auditee] = {GlobalObjects.CaaEnvironment.IdentityUser.PersonnelId} ) then 1 else 0 end) as TaskInProgress 
FROM @T
group by WorkflowStageId



");

                var dtC = ds.Tables[0];
                foreach (DataRow dr in dtC.Rows)
                {
                    _initialDocumentArray.Add(new AuditPublish()
                    {
                        WorkFlowStageId = int.Parse(dr[0].ToString()),
                        AllTask         = int.Parse(dr[1].ToString()),
                        TaskInProgress  = int.Parse(dr[2].ToString()),
                    });
                }
            }


            foreach (var i in _initialDocumentArray.OrderBy(i => i.WorkFlowStageId))
            {
                if (i.WorkFlowStageId == WorkFlowStage.Evaluation.ItemId ||
                    i.WorkFlowStageId == WorkFlowStage.RCA.ItemId ||
                    i.WorkFlowStageId == WorkFlowStage.CAP.ItemId)
                {
                    var res = ((double)(i.AllTask - i.TaskInProgress) / i.AllTask) * 100;
                    i.Persent = (int)Math.Round(res);
                }
                else if (i.WorkFlowStageId == WorkFlowStage.CAR.ItemId)
                {
                    if (_type == CheckListAuditType.Admin)
                    {
                        var eval = _initialDocumentArray.FirstOrDefault(q => q.WorkFlowStageId == WorkFlowStage.Evaluation.ItemId);
                        var res  = ((double)(i.AllTask - (i.TaskInProgress + eval.TaskInProgress)) / i.AllTask) * 100;
                        i.Persent = (int)Math.Round(res);
                    }
                    else
                    {
                        var res = ((double)(i.AllTask - i.TaskInProgress) / i.AllTask) * 100;
                        i.Persent = (int)Math.Round(res);
                    }
                }
                else if (i.WorkFlowStageId == WorkFlowStage.Closed.ItemId)
                {
                    var res = (double)(i.TaskInProgress / i.AllTask) * 100;
                    i.Persent = (int)Math.Round(res);
                }
            }


            _resultDocumentArray.AddRange(_initialDocumentArray.ToList());

            AnimatedThreadWorker.ReportProgress(100, "Complete");
        }
コード例 #8
0
        /// <summary>
        /// Обновляет значения полей
        /// </summary>
        public override void FillControls()
        {
            BeginUpdate();

            lookupComboboxDeferred.SelectedIndexChanged -= LookupComboboxDeferredSelectedIndexChanged;

            UpdateControls();

            _specialists.Clear();
            try
            {
                _specialists.AddRange(GlobalObjects.CasEnvironment.Loader.GetObjectListAll <Specialist>(loadChild: true).Where(i => i.Specialization?.Department?.FullName == "Line Maintenance"));
            }
            catch (Exception ex)
            {
                Program.Provider.Logger.Log("Error while load Specialist fo Discrepancy", ex);
            }


            if (ShowDeffects)
            {
                comboBoxPhase.Items.Clear();
                comboBoxPhase.Items.AddRange(DeffeсtPhase.Items.ToArray());
                comboBoxPhase.SelectedItem = Discrepancy.DeffeсtPhase;

                comboBoxDeffectCat.Items.Clear();
                comboBoxDeffectCat.Items.AddRange(DeffeсtCategory.Items.ToArray());
                comboBoxDeffectCat.SelectedItem = Discrepancy.DeffeсtCategory;

                comboBoxDeffectConfirm.Items.Clear();
                comboBoxDeffectConfirm.Items.AddRange(DeffectConfirm.Items.ToArray());
                comboBoxDeffectConfirm.SelectedItem = Discrepancy.DeffectConfirm;

                comboBoxActinType.Items.Clear();
                comboBoxActinType.Items.AddRange(ActionType.Items.ToArray());
                comboBoxActinType.SelectedItem = Discrepancy.ActionType;

                comboBoxInterruptionType.Items.Clear();
                comboBoxInterruptionType.Items.AddRange(InterruptionType.Items.ToArray());
                comboBoxInterruptionType.SelectedItem = Discrepancy.InterruptionType;


                checkBoxOccurrence.Checked   = Discrepancy.IsOccurrence;
                checkBoxSubstruction.Checked = Discrepancy.Substruction;

                comboBoxFaultConsequence.Items.Clear();
                comboBoxFaultConsequence.Items.AddRange(ConsequenceFaults.Items.ToArray());
                comboBoxFaultConsequence.SelectedItem = Discrepancy.ConsequenceFault;

                comboBoxOPSConsequence.Items.Clear();
                comboBoxOPSConsequence.Items.AddRange(ConsequenceOPS.Items.ToArray());
                comboBoxOPSConsequence.SelectedItem = Discrepancy.ConsequenceOps;


                comboBoxConsequenceType.Items.Clear();
                comboBoxConsequenceType.Items.AddRange(IncidentType.Items.ToArray());
                comboBoxConsequenceType.SelectedItem = Discrepancy.ConsequenceType;


                comboBoxOccurrence.Items.Clear();
                comboBoxOccurrence.Items.AddRange(OccurrenceType.Items.ToArray());
                comboBoxOccurrence.SelectedItem = Discrepancy.Occurrence;


                comboBoxAuth.Items.Clear();
                comboBoxAuth.Items.AddRange(_specialists.OrderBy(i => i.LastName).ToArray());
                comboBoxAuth.SelectedItem = Discrepancy.Auth;


                var aircraftBaseDetails = GlobalObjects.ComponentCore.GetAicraftBaseComponents(Discrepancy.ParentFlight.AircraftId, BaseComponentType.Engine.ItemId).ToList();
                if (aircraftBaseDetails.Count > 0)
                {
                    comboBoxEngine.Items.Clear();
                    comboBoxEngine.Items.AddRange(aircraftBaseDetails.ToArray());

                    var selected = aircraftBaseDetails.GetItemById(Discrepancy.BaseComponentId);
                    if (selected != null)
                    {
                        comboBoxEngine.SelectedItem = selected;
                    }
                    else
                    {
                        comboBoxEngine.SelectedIndex = 0;
                    }
                }

                numericUpDownDelay.Value = Discrepancy.TimeDelay;
                textBoxRemarks.Text      = Discrepancy.Remark;
                textBoxMessages.Text     = Discrepancy.Messages;
                textBoxFDR.Text          = Discrepancy.FDR;
                textBoxEngineRemark.Text = Discrepancy.EngineRemarks;
                checkBoxEngine.Checked   = Discrepancy.EngineShutUp;
            }

            ataChapterComboBox.UpdateInformation();

            TemplateComboBox.Items.Clear();
            TemplateComboBox.Items.AddRange(_discrepancies.ToArray());

            TemplateComboBox.SelectedItem = _discrepancies.FirstOrDefault(
                d => d.ATAChapter != null && d.ATAChapter.Equals(Discrepancy.ATAChapter) &&
                d.CertificateOfReleaseToService != null &&
                d.CertificateOfReleaseToService.AuthorizationB1.Equals(d.CertificateOfReleaseToService.AuthorizationB1) &&
                d.CertificateOfReleaseToService.AuthorizationB2.Equals(d.CertificateOfReleaseToService.AuthorizationB2) &&
                d.CertificateOfReleaseToService.Station.Equals(d.CertificateOfReleaseToService.Station) &&
                d.CorrectiveAction != null &&
                d.CorrectiveAction.Description.Equals(d.CorrectiveAction.Description) &&
                d.CorrectiveAction.PartNumberOff.Equals(d.CorrectiveAction.PartNumberOff) &&
                d.CorrectiveAction.PartNumberOn.Equals(d.CorrectiveAction.PartNumberOn) &&
                d.CorrectiveAction.SerialNumberOff.Equals(d.CorrectiveAction.SerialNumberOff) &&
                d.CorrectiveAction.SerialNumberOn.Equals(d.CorrectiveAction.SerialNumberOn));

            #region lookupComboboxDeferred

            if (Discrepancy != null)
            {
                var aircraft = GlobalObjects.AircraftsCore.GetAircraftById(Discrepancy.ParentFlight.AircraftId);

                string displayerText =
                    aircraft.RegistrationNumber + ". " +
                    DirectiveType.DeferredItems.CommonName;

                lookupComboboxDeferred.SetAddScreenControl <DeferredScreen>
                    (new object[] { aircraft, Discrepancy.ParentFlight },
                    displayerText + ". New Directive");

                lookupComboboxDeferred.SetEditScreenControl <DeferredScreen>(displayerText);
                lookupComboboxDeferred.SetItemsScreenControl <PrimeDirectiveListScreen>
                    (new object[] { aircraft, DirectiveType.DeferredItems, ADType.None },
                    displayerText);
                lookupComboboxDeferred.LoadObjectsFunc = GlobalObjects.DirectiveCore.GetDeferredItems;
                lookupComboboxDeferred.FilterParam1    = Discrepancy.ParentFlight;
                lookupComboboxDeferred.UpdateInformation();
            }

            #endregion

            #region lookupComboboxFlight

            if (Discrepancy != null && Discrepancy.ItemId > 0 && Discrepancy.DirectiveId > 0)
            {
                var aircraft = GlobalObjects.AircraftsCore.GetAircraftById(Discrepancy.ParentFlight.AircraftId);

                lookupComboboxFlight.SetEditScreenControl <FlightScreen>
                    (aircraft.RegistrationNumber + ". " + Discrepancy.ParentFlight.FlightNo);

                ATLB parentAtlb = null;
                try
                {
                    parentAtlb = GlobalObjects.CasEnvironment.NewLoader.GetObjectById <ATLBDTO, ATLB>(Discrepancy.ParentFlight.ATLBId);
                }
                catch (Exception ex)
                {
                    Program.Provider.Logger.Log("Error while load linked ATLB fo Discrepancy", ex);
                }
                if (parentAtlb != null)
                {
                    //Проверить на значение свойтсва ParentAircraft в parentAtlb
                    lookupComboboxFlight.SetItemsScreenControl <FlightsListScreen>
                        (new object[] { parentAtlb },
                        aircraft.RegistrationNumber + ". ATLB No " + parentAtlb.ATLBNo);

                    lookupComboboxFlight.LoadObjectsFunc = GlobalObjects.AircraftFlightsCore.GetFlightsByAtlb;
                    lookupComboboxFlight.FilterParam1    = Discrepancy.ParentFlight.AircraftId;
                    lookupComboboxFlight.FilterParam2    = parentAtlb.ItemId;
                    lookupComboboxFlight.UpdateInformation();
                }
            }

            #endregion



            if (Discrepancy != null)
            {
                comboSpecialist1.Items.AddRange(_specialists.OrderBy(i => i.LastName).ToArray());
                comboSpecialist2.Items.AddRange(_specialists.OrderBy(i => i.LastName).ToArray());
                radioCrew.Checked             = Discrepancy.FilledBy == false; // DiscrepancyFilledByEnum.Crew;
                radioMaintenanceStaff.Checked = Discrepancy.FilledBy;          //DiscrepancyFilledByEnum.MaintenanceStaff;
                ataChapterComboBox.ATAChapter = Discrepancy.ATAChapter;
                radioOpen.Checked             = Discrepancy.Status == CorrectiveActionStatus.Open;
                radioClose.Checked            = Discrepancy.Status == CorrectiveActionStatus.Close;
                radioButtonPublish.Checked    = Discrepancy.Status == CorrectiveActionStatus.Publish;
                textDescription.Text          = Discrepancy.Description ?? "No";
                checkBoxReliability.Checked   = Discrepancy.IsReliability;
                if (Discrepancy.Num > numericUpDownIndex.Maximum)
                {
                    numericUpDownIndex.Value = numericUpDownIndex.Maximum;
                }
                else if (Discrepancy.Num < numericUpDownIndex.Minimum)
                {
                    numericUpDownIndex.Value = numericUpDownIndex.Minimum;
                }
                else
                {
                    numericUpDownIndex.Value = Discrepancy.Num;
                }

                if (Discrepancy.DirectiveId > 0)
                {
                    lookupComboboxDeferred.SelectedItemId = Discrepancy.DirectiveId;
                    lookupComboboxFlight.SelectedItemId   = Discrepancy.FlightId;
                }
                if (Discrepancy.DeferredItem != null)
                {
                    ataChapterComboBox.Enabled    = false;
                    ataChapterComboBox.ATAChapter = Discrepancy.DeferredItem.ATAChapter;
                    radioOpen.Enabled             = false;
                    radioClose.Enabled            = false;

                    if (Discrepancy.DeferredItem.Status == DirectiveStatus.Closed)
                    {
                        radioClose.Checked = true;
                    }
                    else
                    {
                        radioOpen.Checked = true;
                    }

                    _showDeferredInfoPanel       = true;
                    textBoxMelCdl.Text           = Discrepancy.DeferredItem.DeferredMelCdlItem;
                    textBoxDeferredCategory.Text = Discrepancy.DeferredItem.DeferredCategory.ToString();

                    Directive directive = Discrepancy.DeferredItem;
                    dateTimePickerOpenDate.Visible = true;
                    dateTimePickerOpenDate.Value   = directive.Threshold.EffectiveDate;

                    if (directive.PerformanceRecords.Count > 0)
                    {
                        if (directive.IsClosed)
                        {
                            dateTimePickerClosingDate.Visible = true;
                            dateTimePickerExtension.Visible   = false;
                            numericUpDownExtTimes.Visible     = false;
                            dateTimePickerClosingDate.Value   = directive.PerformanceRecords.GetLast().RecordDate;
                        }
                        else
                        {
                            dateTimePickerClosingDate.Visible = false;
                            dateTimePickerExtension.Visible   = true;
                            numericUpDownExtTimes.Visible     = true;
                            dateTimePickerExtension.Value     = directive.PerformanceRecords.GetLast().RecordDate;

                            try
                            {
                                numericUpDownExtTimes.Value =
                                    GlobalObjects.CasEnvironment.Loader.GetCountPerformanceRecords <DirectiveRecord>(
                                        SmartCoreType.Directive, directive.ItemId);
                            }
                            catch (Exception ex)
                            {
                                Program.Provider.Logger.Log("Error while load count of records for directive id:" + directive.ItemId,
                                                            ex);
                            }

                            GlobalObjects.PerformanceCalculator.GetNextPerformance(directive);
                            lifelengthViewerRemains.Lifelength = directive.Remains;
                        }
                    }
                    else
                    {
                        dateTimePickerClosingDate.Visible = false;
                        dateTimePickerExtension.Visible   = false;
                        numericUpDownExtTimes.Visible     = false;

                        GlobalObjects.PerformanceCalculator.GetNextPerformance(directive);
                        lifelengthViewerRemains.Lifelength = directive.Remains;
                    }
                }
                else
                {
                    _showDeferredInfoPanel = false;
                }

                if (!panelExtendable.Visible)
                {
                    panelDeferredInfo.Visible = _showDeferredInfoPanel;
                }
                else
                {
                    panelDeferredInfo.Visible = _showDeferredInfoPanel && extendableRichContainer.Extended;
                }

                if (Discrepancy.CorrectiveAction != null)
                {
                    textCorrectiveAction.Text = Discrepancy.CorrectiveAction.Description ?? "No";
                    textPNOff.Text            = Discrepancy.CorrectiveAction.PartNumberOff;
                    textSNOff.Text            = Discrepancy.CorrectiveAction.SerialNumberOff;
                    textPNOn.Text             = Discrepancy.CorrectiveAction.PartNumberOn;
                    textSNOn.Text             = Discrepancy.CorrectiveAction.SerialNumberOn;
                    textADDNo.Text            = Discrepancy.CorrectiveAction.AddNo ?? "No";
                }
                else
                {
                    textCorrectiveAction.Text = "No";
                    textADDNo.Text            = "No";
                    textPNOff.Text            = textSNOff.Text = textPNOn.Text = textSNOn.Text = "";
                }

                if (Discrepancy.CertificateOfReleaseToService != null)
                {
                    textStation.Text            = Discrepancy.CertificateOfReleaseToService.Station;
                    dateTimePickerRTSDate.Value = Discrepancy.CertificateOfReleaseToService.RecordDate;
                    if (Discrepancy.CertificateOfReleaseToService.AuthorizationB1 != null)
                    {
                        Specialist selectedSpec = _specialists.GetItemById(Discrepancy.CertificateOfReleaseToService.AuthorizationB1.ItemId);
                        if (selectedSpec != null)
                        {
                            comboSpecialist1.SelectedItem = selectedSpec;
                        }
                        else
                        {
                            //Искомый специалист недействителен
                            comboSpecialist1.Items.Add(Discrepancy.CertificateOfReleaseToService.AuthorizationB1);
                            comboSpecialist1.SelectedItem = Discrepancy.CertificateOfReleaseToService.AuthorizationB1;
                        }
                        comboSpecialist1.BackColor =
                            ((Specialist)comboSpecialist1.SelectedItem).IsDeleted
                          ? Color.FromArgb(Highlight.Red.Color)
                          : Color.White;
                    }
                    if (Discrepancy.CertificateOfReleaseToService.AuthorizationB2 != null)
                    {
                        Specialist selectedSpec = _specialists.GetItemById(Discrepancy.CertificateOfReleaseToService.AuthorizationB2.ItemId);
                        if (selectedSpec != null)
                        {
                            comboSpecialist2.SelectedItem = selectedSpec;
                        }
                        else
                        {
                            //Искомый специалист недействителен
                            comboSpecialist2.Items.Add(Discrepancy.CertificateOfReleaseToService.AuthorizationB2);
                            comboSpecialist2.SelectedItem = Discrepancy.CertificateOfReleaseToService.AuthorizationB2;
                        }
                        comboSpecialist2.BackColor =
                            ((Specialist)comboSpecialist2.SelectedItem).IsDeleted
                                    ? Color.FromArgb(Highlight.Red.Color)
                                    : Color.White;
                    }
                }
                else
                {
                    textStation.Text = "";
                    comboSpecialist1.SelectedItem = null;
                    comboSpecialist2.SelectedItem = null;
                    dateTimePickerRTSDate.Value   = DateTime.Today;
                }
            }
            else
            {
                textADDNo.Text                = textDescription.Text = textCorrectiveAction.Text = textPNOff.Text =
                    textSNOff.Text            = textPNOn.Text = textSNOn.Text = textStation.Text = "";
                radioOpen.Checked             = radioClose.Checked = radioCrew.Checked = radioMaintenanceStaff.Checked = false;
                dateTimePickerRTSDate.Value   = DateTime.Today;
                comboSpecialist1.SelectedItem = null;
                comboSpecialist2.SelectedItem = null;
                textDescription.Text          = "What Where When Extent";
            }


            comboBoxWP.Items.Clear();
            comboBoxWP.Items.AddRange(_workPackages.ToArray());
            comboBoxWP.SelectedItem  = _workPackages.FirstOrDefault(i => i.ItemId == Discrepancy.WorkPackageId);
            comboBoxWP.DisplayMember = "ComboBoxMember";


            comboBoxComp.Items.Clear();
            comboBoxComp.Items.AddRange(_transferRecords.ToArray());
            comboBoxComp.SelectedItem = _transferRecords.FirstOrDefault(i => (bool)i.ParentComponent?.SerialNumber.Equals(textSNOn.Text) && (bool)i.ParentComponent?.PartNumber.Equals(textPNOn.Text) &&
                                                                        (bool)i.ReplaceComponent?.SerialNumber.Equals(textSNOff.Text) && (bool)i.ReplaceComponent?.PartNumber.Equals(textPNOff.Text));
            comboBoxComp.DisplayMember = "ComboBoxMember";

            SetExtendableControlCaption();

            lookupComboboxDeferred.SelectedIndexChanged += LookupComboboxDeferredSelectedIndexChanged;

            EndUpdate();

            comboBoxPhase.Select(comboBoxPhase.Text.Length, 0);
        }
コード例 #9
0
 private void BackgroundWorkerRunWorkerLoadCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     comboBox1.Items.Clear();
     comboBox1.Items.AddRange(_initialTrackArray.OrderBy(i => i.TripName).ToArray());
 }
コード例 #10
0
ファイル: FlightForm.cs プロジェクト: mgladilov/Cas
 private void BackgroundWorkerRunWorkerLoadCompleted(object sender, RunWorkerCompletedEventArgs e)
 {
     comboBox1.Items.Clear();
     comboBox1.Items.AddRange(_initialFlightNumberArray.OrderBy(f => f.FlightNo).ToArray());
 }