///<summary> ///</summary> ///<param name="checkItems"></param> ///<param name="aircraft"></param> ///<param name="schedule"></param> public void UpdateInformation(MaintenanceCheckCollection checkItems, Aircraft aircraft, bool schedule) { CheckItems = checkItems; Schedule = schedule; _complianceGroupCollection = CheckItems.GetNextComplianceCheckGroups(Schedule).OrderBy(GetNextComplianceDate); TsnCsn = GlobalObjects.CasEnvironment.Calculator.GetCurrentFlightLifelength(aircraft); listViewLastCheck.Items.Clear(); listViewNextCheck.Items.Clear(); if (CheckItems.Count == 0) { return; } if (!BackGroundWorker.IsBusy) { BackGroundWorker.RunWorkerAsync(); } List <MaintenanceCheck> orderedBySchedule = checkItems.OrderBy(c => c.Schedule) .OrderByDescending(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); } } List <MaintenanceProgramControl> mpcs = flowLayoutPanel1.Controls.OfType <MaintenanceProgramControl>().ToList(); for (int j = 0; j < mpcs.Count; j++) { if (j >= checkGroups.Count) { //Если кол-во контролов превышает кол-во групп чеков //то необходимо убрать лишние контролы flowLayoutPanel1.Controls.Remove(mpcs[j]); continue; } mpcs[j].SetParameters(checkGroups[j].Checks, checkGroups[j].Schedule, checkGroups[j].Grouping, checkGroups[j].Resource); } for (int j = mpcs.Count; j < checkGroups.Count; j++) { MaintenanceProgramControl mpc = new MaintenanceProgramControl(checkGroups[j].Checks, checkGroups[j].Schedule, checkGroups[j].Grouping, checkGroups[j].Resource) { Extended = false }; flowLayoutPanel1.Controls.Add(mpc); flowLayoutPanel1.Controls.SetChildIndex(mpc, j); } mpcs = flowLayoutPanel1.Controls.OfType <MaintenanceProgramControl>().ToList(); if (mpcs.Count == 1) { mpcs[0].EnableExtendedControl = false; } else if (mpcs.Count >= 1) { mpcs[0].EnableExtendedControl = true; } maintenancePerformanceControl1.Reload(checkItems, aircraft); }
///<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); } } }