Esempio n. 1
0
 private CustomCell CreateListViewSubItem(Color backColor, Lifelength lifelength)
 {
     return(new CustomCell
     {
         Text = lifelength.ToHoursMinutesAndCyclesFormat("", ""),
         Tag = lifelength,
     });
 }
Esempio n. 2
0
        private string[] GetItemsString(AircraftFlight item)
        {
            Lifelength perMonth = GetPerMonth(sortedAircraftsFlights.IndexOf(item));
            Lifelength acTft    = GetAC_TFT(sortedAircraftsFlights.IndexOf(item));

            return(new[]
                   { item.FlightDate.ToString(new GlobalTermsProvider()["DateFormat"].ToString()),
                     item.FlightNo,
                     item.StationFrom + " - " + item.StationTo,
                     "",
                     "",
                     UsefulMethods.TimeToString(item.FlightTime) + " (" + UsefulMethods.TimePeriodToString(item.TakeOffTime, item.LdgTime) + ")",
                     perMonth == null ? "" : perMonth.ToHoursMinutesAndCyclesFormat(),
                     acTft == null ? "" : acTft.ToHoursAndCyclesFormat("hrs", "cyc") });
        }
Esempio n. 3
0
        ///<summary>
        ///</summary>
        ///<param name="checkItems"></param>
        ///<param name="aircraftDocuments"></param>
        ///<param name="aircraft"></param>
        ///<param name="schedule"></param>
        public void UpdateInformation(MaintenanceCheckCollection checkItems,
                                      IEnumerable <Document> aircraftDocuments,
                                      Aircraft aircraft,
                                      bool schedule)
        {
            _aircraftDocuments.Clear();
            _aircraftDocuments.AddRange(aircraftDocuments);
            _checkItems                = checkItems;
            _schedule                  = schedule;
            _currentAircraft           = aircraft;
            _complianceGroupCollection = _checkItems.GetNextComplianceCheckGroups(_schedule).OrderBy(c => c.GetNextComplianceDate());
            _aircraftLifelength        = GlobalObjects.CasEnvironment.Calculator.GetCurrentFlightLifelength(aircraft);

            labelMSGValue.Text                       = aircraft.MSG.ToString();
            labelManufactureDateValue.Text           = SmartCore.Auxiliary.Convert.GetDateFormat(aircraft.ManufactureDate);
            labelOwnerValue.Text                     = aircraft.Owner;
            labelOperatorValue.Text                  = GlobalObjects.CasEnvironment.Operators.First(o => o.ItemId == _currentAircraft.OperatorId).Name;
            labelAircraftTypeCertificateNoValue.Text = aircraft.TypeCertificateNumber;
            labelCurrentValue.Text                   = _aircraftLifelength.ToHoursMinutesAndCyclesFormat("FH", "FC");

            labelBasicEmptyWeightValue.Text            = aircraft.BasicEmptyWeight.ToString();
            labelBasicEmptyWeightCargoConfigValue.Text = aircraft.BasicEmptyWeightCargoConfig.ToString();
            labelCargoCapacityContainerValue.Text      = aircraft.CargoCapacityContainer;
            labelCruiseValue.Text                = aircraft.Cruise;
            labelCruiseFuelFlowValue.Text        = aircraft.CruiseFuelFlow;
            labelFuelCapacityValue.Text          = aircraft.FuelCapacity;
            labelMaxCruiseAltitudeValue.Text     = aircraft.MaxCruiseAltitude;
            labelMaxLandingWeightValue.Text      = aircraft.MaxLandingWeight.ToString();
            labelMaxPayloadValue.Text            = aircraft.MaxPayloadWeight.ToString();
            labelMaxTakeOffCrossWeightValue.Text = aircraft.MaxTakeOffCrossWeight.ToString();
            labelMaxZeroFuelWeightValue.Text     = aircraft.MaxZeroFuelWeight.ToString();
            labelMaxTaxiWeightValue.Text         = aircraft.MaxTaxiWeight.ToString();
            labelOpertionalEmptyWeightValue.Text = aircraft.OperationalEmptyWeight.ToString();
            labelCockpitSeatingValue.Text        = aircraft.CockpitSeating;
            labelGalleysValue.Text               = aircraft.Galleys;
            labelLavatoryValue.Text              = aircraft.Lavatory;
            labelSeatingEconomyValue.Text        = aircraft.SeatingEconomy.ToString();
            labelSeatingBusinessValue.Text       = aircraft.SeatingBusiness.ToString();
            labelSeatingFirstValue.Text          = aircraft.SeatingFirst.ToString();
            labelOvenValue.Text          = aircraft.Oven;
            labelBoilerValue.Text        = aircraft.Boiler;
            labelAirStairDoorsValue.Text = aircraft.AirStairsDoors;

            var aircraftEquipment = _currentAircraft.AircraftEquipments.Where(a => a.AircraftEquipmetType == AircraftEquipmetType.Equipmet);
            var aircraftApproval  = _currentAircraft.AircraftEquipments.Where(a => a.AircraftEquipmetType == AircraftEquipmetType.TapeOfOperationApproval);

            var row = 4;

            foreach (var equipmentse in aircraftApproval)
            {
                var labelTitle = new Label
                {
                    Text      = equipmentse.AircraftOtherParameter + " :",
                    Font      = new Font("Verdana", 14, GraphicsUnit.Pixel),
                    ForeColor = Color.FromArgb(122, 122, 122),
                    Width     = 150
                };
                var labelValue = new Label
                {
                    Text      = equipmentse.Description,
                    Font      = new Font("Verdana", 14, GraphicsUnit.Pixel),
                    ForeColor = Color.FromArgb(122, 122, 122),
                    Width     = 150
                };
                row++;
                tableLayoutPanelMain.Controls.Add(labelTitle, 2, row);
                tableLayoutPanelMain.Controls.Add(labelValue, 3, row);
            }

            row = 4;
            foreach (var equipmentse in aircraftEquipment)
            {
                var labelTitle = new Label
                {
                    Text      = equipmentse.AircraftOtherParameter + " :",
                    Font      = new Font("Verdana", 14, GraphicsUnit.Pixel),
                    ForeColor = Color.FromArgb(122, 122, 122),
                    Width     = 150
                };
                var labelValue = new Label
                {
                    Text      = equipmentse.Description,
                    Font      = new Font("Verdana", 14, GraphicsUnit.Pixel),
                    ForeColor = Color.FromArgb(122, 122, 122),
                    Width     = 150
                };
                row++;
                tableLayoutPanelMain.Controls.Add(labelTitle, 6, row);
                tableLayoutPanelMain.Controls.Add(labelValue, 7, row);
            }

            //List<Document> operatorDocs =
            //    GlobalObjects.CasEnvironment.Loader.GetDocuments(aircraft.Operator, DocumentType.Certificate, true);
            //DocumentSubType aocType = (DocumentSubType)
            //    GlobalObjects.CasEnvironment.Dictionaries[typeof(DocumentSubType)].ToArray().FirstOrDefault(d => d.FullName == "AOC");
            //Document awDoc = aocType != null ? operatorDocs.FirstOrDefault(d => d.DocumentSubType == aocType) : null;
            //string aocUpTo = awDoc != null && awDoc.ValidTo
            //                    ? awDoc.DateValidTo.ToString(new GlobalTermsProvider()["DateFormat"].ToString())
            //                    : "";

            var aircraftDocs = GlobalObjects.DocumentCore.GetAircraftDocuments(aircraft);
            var awType       = (DocumentSubType)
                               GlobalObjects.CasEnvironment.GetDictionary <DocumentSubType>().ToArray().FirstOrDefault(d => d.FullName == "AW");
            var awDoc = awType != null?aircraftDocs.FirstOrDefault(d => d.DocumentSubType.ItemId == awType.ItemId) : null;

            string awUpTo = awDoc != null && awDoc.IssueValidTo
                                ? awDoc.IssueDateValidTo.ToString(new GlobalTermsProvider()["DateFormat"].ToString())
                                : "";

            labelAWCValue.Text = awUpTo;

            tableLayoutPanelLastChecks.RowCount = 1;
            tableLayoutPanelLastChecks.RowStyles.Clear();
            tableLayoutPanelLastChecks.RowStyles.Add(new RowStyle());
            tableLayoutPanelLastChecks.Controls.Clear();
            tableLayoutPanelLastChecks.Controls.Add(labelLastCheck, 0, 0);
            tableLayoutPanelLastChecks.Controls.Add(labelLastDate, 1, 0);
            tableLayoutPanelLastChecks.Controls.Add(labelLastTsnCsn, 2, 0);

            tableLayoutPanelNextChecks.RowCount = 1;
            tableLayoutPanelNextChecks.RowStyles.Clear();
            tableLayoutPanelNextChecks.RowStyles.Add(new RowStyle());
            tableLayoutPanelNextChecks.Controls.Clear();
            tableLayoutPanelNextChecks.Controls.Add(labelNextCheck, 0, 0);
            tableLayoutPanelNextChecks.Controls.Add(labelNextDate, 1, 0);
            tableLayoutPanelNextChecks.Controls.Add(labelNextTsnCan, 2, 0);
            tableLayoutPanelNextChecks.Controls.Add(labelRemains, 3, 0);

            tableLayoutPanelDocs.RowCount = 1;
            tableLayoutPanelDocs.RowStyles.Clear();
            tableLayoutPanelDocs.RowStyles.Add(new RowStyle());
            tableLayoutPanelDocs.Controls.Clear();
            tableLayoutPanelDocs.Controls.Add(labelDocDescription, 0, 0);
            tableLayoutPanelDocs.Controls.Add(labelDocNumber, 1, 0);
            tableLayoutPanelDocs.Controls.Add(labelDocIssue, 2, 0);
            tableLayoutPanelDocs.Controls.Add(labelDocValidTo, 3, 0);
            tableLayoutPanelDocs.Controls.Add(labelDocRemain, 4, 0);

            if (_checkItems.Count == 0)
            {
                return;
            }

            if (!BackGroundWorker.IsBusy)
            {
                BackGroundWorker.RunWorkerAsync();
            }
            List <MaintenanceCheck> orderedBySchedule =
                checkItems.OrderBy(c => c.Schedule)
                .ThenByDescending(c => c.Grouping)
                .OrderBy(c => c.Resource)
                .ToList();

            List <MaintenanceCheckGroupByType> checkGroups = new List <MaintenanceCheckGroupByType>();

            foreach (MaintenanceCheck check in orderedBySchedule)
            {
                MaintenanceCheckGroupByType group = checkGroups
                                                    .FirstOrDefault(g => g.Schedule == check.Schedule &&
                                                                    g.Grouping == check.Grouping &&
                                                                    g.Resource == check.Resource);
                if (group != null)
                {
                    group.Checks.Add(check);
                }
                else
                {
                    group = new MaintenanceCheckGroupByType(check.Schedule)
                    {
                        Grouping = check.Grouping,
                        Resource = check.Resource
                    };
                    group.Checks.Add(check);
                    checkGroups.Add(group);
                }
            }
        }
Esempio n. 4
0
        protected override void AddFlight(MonthlyUtilizationDataSet dataSet, AircraftFlight item, string groupName, int counter)
        {
            string                dateString = SmartCore.Auxiliary.Convert.GetDateFormat(item.FlightDate);
            Lifelength            perDays    = Lifelength.Zero;
            List <AircraftFlight> flights    = Flights.Where(f => f.FlightDate.Date.AddMinutes(f.TakeOffTime) <=
                                                             item.FlightDate.Date.AddMinutes(item.TakeOffTime)).ToList();

            foreach (AircraftFlight aircraftFlight in flights)
            {
                perDays.Add(aircraftFlight.FlightTimeLifelength);
            }
            Lifelength aircraftLifelenght = GlobalObjects.CasEnvironment.Calculator.GetFlightLifelengthIncludingThisFlight(item);

            #region колонки для отображения наработок по двигателям и ВСУ

            Lifelength engine1 = Lifelength.Null;
            Lifelength engine2 = Lifelength.Null;
            Lifelength apu     = Lifelength.Null;
            if (_engine1 != null)
            {
                engine1 = GlobalObjects.CasEnvironment.Calculator.GetFlightLifelengthIncludingThisFlight(_engine1, item);
            }
            if (_engine2 != null)
            {
                engine2 = GlobalObjects.CasEnvironment.Calculator.GetFlightLifelengthIncludingThisFlight(_engine2, item);
            }
            if (_apu != null)
            {
                apu = GlobalObjects.CasEnvironment.Calculator.GetFlightLifelengthIncludingThisFlight(_apu, item);
            }

            #endregion

            string color = UsefulMethods.GetColorName(item);
            if (!item.Correct)
            {
                color = "White";
            }

            dataSet.Items.AddItemsRow(dateString,
                                      item.FlightNumber.ToString(),
                                      item.StationFromId.ShortName,
                                      item.StationToId.ShortName,
                                      item.Reference,
                                      item.PageNo,
                                      UsefulMethods.TimeToString(new TimeSpan(0, 0, item.TakeOffTime, 0)),
                                      UsefulMethods.TimeToString(new TimeSpan(0, 0, item.LDGTime, 0)),
                                      "1",
                                      UsefulMethods.TimeToString(new TimeSpan(0, 0, item.FlightTimeTotalMinutes, 0)),
                                      perDays.ToHoursMinutesAndCyclesFormat("", ""),
                                      aircraftLifelenght.ToHoursMinutesFormat(""),
                                      aircraftLifelenght.Cycles != null ? aircraftLifelenght.Cycles.ToString() : "",
                                      groupName,
                                      counter.ToString(),
                                      engine1.ToHoursMinutesFormat(""),
                                      engine1.Cycles != null ? engine1.Cycles.ToString() : "",
                                      engine2.ToHoursMinutesFormat(""),
                                      engine2.Cycles != null ? engine2.Cycles.ToString() : "",
                                      apu.ToHoursMinutesFormat(""),
                                      apu.Cycles != null ? apu.Cycles.ToString() : "",
                                      color);
        }