Example #1
0
        private void ButtonPrintDisplayerRequested(object sender, ReferenceEventArgs e)
        {
            var aircraft = GlobalObjects.AircraftsCore.GetParentAircraft(_currentDamage);

            if (aircraft == null)
            {
                return;
            }

            if (sender == _itemPrintReportRecords)
            {
                string caption = aircraft.RegistrationNumber + ". " + _currentDamage.DirectiveType.CommonName + ". " +
                                 _currentDamage.Title + ". Compliance List";
                var builder = new DirectiveTasksReportBuilder();
                if (_currentBaseComponent == null)
                {
                    builder.ReportedAircraft = CurrentAircraft;
                    builder.ReportTitle      = "DAMAGE RECORD";
                    builder.FilterSelection  = "All";
                }
                else
                {
                    builder.ReportedBaseComponent = _currentBaseComponent;
                    var selection = "";
                    if (_currentBaseComponent.BaseComponentType == BaseComponentType.LandingGear)
                    {
                        selection           = _currentBaseComponent.TransferRecords.GetLast().Position;
                        builder.ReportTitle = "LANDING GEAR RECORD";
                    }
                    if (_currentBaseComponent.BaseComponentType == BaseComponentType.Engine)
                    {
                        selection           = BaseComponentType.Engine + " " + _currentBaseComponent.TransferRecords.GetLast().Position;
                        builder.ReportTitle = "ENGINE RECORD";
                    }
                    if (_currentBaseComponent.BaseComponentType == BaseComponentType.Apu)
                    {
                        selection           = BaseComponentType.Apu.ToString();
                        builder.ReportTitle = "APU RECORD";
                    }
                    builder.LifelengthAircraftSinceNew =
                        GlobalObjects.CasEnvironment.Calculator.GetCurrentFlightLifelength(CurrentAircraft);
                    builder.FilterSelection = selection;
                }

                builder.AddDirectives(new[] { _currentDamage });
                builder.ForecastData = null;
                e.DisplayerText      = caption;
                e.TypeOfReflection   = ReflectionTypes.DisplayInNew;
                e.RequestedEntity    = new ReportScreen(builder);
            }
        }
Example #2
0
        private void ButtonPrintDisplayerRequested(object sender, ReferenceEventArgs e)
        {
            var baseDetail = _currentDirective.ParentBaseComponent;

            if (baseDetail == null)
            {
                return;
            }

            if (sender == itemPrintReportRecords)
            {
                var caption = "";
                if (baseDetail.ParentAircraftId > 0)
                {
                    caption = $"{DestinationHelper.GetDestinationStringFromAircraft(baseDetail.ParentAircraftId, false, null)}. ";
                }
                else if (baseDetail.ParentStoreId > 0)
                {
                    caption = $"{DestinationHelper.GetDestinationStringFromStore(baseDetail.ParentStoreId, null, true)}. ";
                }

                caption += _currentDirective.DirectiveType.CommonName + ". " +
                           _currentDirective.Title + ". Compliance List";

                var builder = new DirectiveTasksReportBuilder();
                if (_currentBaseComponent == null)
                {
                    builder.ReportedAircraft = CurrentAircraft;

                    if (_currentDirective.DirectiveType == DirectiveType.AirworthenessDirectives)
                    {
                        builder.ReportTitle = "AD RECORD";
                    }
                    if (_currentDirective.DirectiveType == DirectiveType.EngineeringOrders)
                    {
                        builder.ReportTitle = "EO STATUS";
                    }
                    if (_currentDirective.DirectiveType == DirectiveType.SB)
                    {
                        builder.ReportTitle = "SB STATUS";
                    }

                    builder.FilterSelection = "All";
                }
                else
                {
                    builder.ReportedBaseComponent = _currentBaseComponent;
                    String selection = "";
                    if (_currentBaseComponent.BaseComponentType == BaseComponentType.LandingGear)
                    {
                        selection           = _currentBaseComponent.TransferRecords.GetLast().Position;
                        builder.ReportTitle = "LANDING GEAR RECORD";
                    }
                    if (_currentBaseComponent.BaseComponentType == BaseComponentType.Engine)
                    {
                        selection           = BaseComponentType.Engine + " " + _currentBaseComponent.TransferRecords.GetLast().Position;
                        builder.ReportTitle = "ENGINE RECORD";
                    }
                    if (_currentBaseComponent.BaseComponentType == BaseComponentType.Apu)
                    {
                        selection           = BaseComponentType.Apu.ToString();
                        builder.ReportTitle = "APU RECORD";
                    }
                    builder.LifelengthAircraftSinceNew =
                        GlobalObjects.CasEnvironment.Calculator.GetCurrentFlightLifelength(CurrentAircraft);
                    builder.FilterSelection = selection;
                }

                builder.AddDirectives(new[] { _currentDirective });
                builder.ForecastData = null;
                e.DisplayerText      = caption;
                e.TypeOfReflection   = ReflectionTypes.DisplayInNew;
                e.RequestedEntity    = new ReportScreen(builder);
            }
            else
            {
                e.Cancel = true;
            }
        }