private void atlb_Reloading(object sender, CancelEventArgs e) { if (!InvokeRequired) { atlbBeforeReload = (ATLB)sender; } }
private void ButtonAddAtlbClick(object sender, EventArgs e) { var newATLB = new ATLB(CurrentAircraft); CommonEditorForm form = new CommonEditorForm(newATLB); form.ShowDialog(); if (newATLB.ItemId <= 0) { return; } buttonAddAtlb.Enabled = false; _currentFlight.ATLBId = newATLB.ItemId; //присваивание идентификатора бортового журнала _currentFlight.AttachedFile = newATLB.AttachedFile; //присваивание идентификатора файла бортового журнала _currentFlight.ParentATLB = newATLB; //присваивание обратной ссылки на объект бортового журнала _currentFlight.AircraftId = CurrentAircraft.ItemId; //присваивание обратной на родительский самолет _currentAtlb = newATLB; var flights = GlobalObjects.AircraftFlightsCore.GetAircraftFlightsByAircraftId(CurrentAircraft.ItemId); var lastAircraftFlight = _currentFlight.ItemId <= 0 ? flights.GetLast() : flights.GetPreviousKnownRecord(_currentFlight.FlightDate); if (lastAircraftFlight != null) { labelDateAsOf.Text = "Current ATLB: " + newATLB.ATLBNo + " Previous Page No: " + lastAircraftFlight.PageNo; } }
///<summary> /// Создает страницу для отображения информации об одной директиве ///</summary> /// <param name="atlb">Директива</param> ///<param name="aircraft"></param> public FlightScreen(ATLB atlb, Aircraft aircraft, bool showDeffects = false, bool allView = false) : this() { if (atlb == null) { throw new ArgumentNullException("atlb", "Argument cannot be null"); } _currentAtlb = atlb; CurrentAircraft = aircraft; #region ButtonPrintContextMenu //buttonPrintMenuStrip = new ContextMenuStrip(); //itemPrintReportRecords = new ToolStripMenuItem { Text = "Records" }; //itemPrintReportHistory = new ToolStripMenuItem { Text = "Compliance history" }; //buttonPrintMenuStrip.Items.AddRange(new ToolStripItem[] { itemPrintReportRecords, itemPrintReportHistory }); //ButtonPrintMenuStrip = buttonPrintMenuStrip; #endregion if (allView) { UpdateControls(); } _showDeffects = showDeffects; AnimatedThreadWorker.DoWork -= AnimatedThreadWorkerDoWorkWithCreateFlight; AnimatedThreadWorker.DoWork -= AnimatedThreadWorkerDoWork; AnimatedThreadWorker.DoWork += AnimatedThreadWorkerDoWorkWithCreateFlight; }
/// <summary> /// Создает форму для редактирования свойств бортового журнала ВС /// </summary> /// <param name="atlb">Бортовой журнал</param> public ATLBForm(ATLB atlb) { currentATLB = atlb; parentAircraft = (Aircraft)atlb.Parent; mode = ScreenMode.Edit; InitializeComponent(); UpdateInformation(); }
/// <summary> /// Создает форму для добавления бортового журнала /// </summary> /// <param name="aircraft">ВС, к которому добавляется бортовой журнал</param> public ATLBForm(Aircraft aircraft) { parentAircraft = aircraft; currentATLB = aircraft.ProposeNextATLB(); mode = ScreenMode.Add; InitializeComponent(); UpdateInformation(); }
//private List<MaintenanceCheckJobCard> MaintenanceSubChecks; #endregion #region Constructor #region public ATLBBuilder(ATLB atlb) /// <summary> /// Создается построитель отчета по бортовому журналу ВС /// </summary> public ATLBBuilder(ATLB atlb) { //загрузка данных Maintenance для отчета //MaintenanceSubChecks = // GlobalObjects.CasEnvironment.Loader. // GetMaintenanceFullSubCheckByAircraftId(atlb.ParentAircraft.AircraftID); _currentATLB = atlb; _currentPageNumber = _currentATLB.StartPageNo; }
public TrackFlightForm(ATLB atlb, Aircraft currentAircraft) : this() { _atlb = atlb; _currentAircraft = currentAircraft; _animatedThreadWorker.DoWork += AnimatedThreadWorkerDoLoad; _animatedThreadWorker.RunWorkerCompleted += BackgroundWorkerRunWorkerLoadCompleted; UpdateInformation(); }
public ATLBView(ATLB source) { if (source == null) { return; } Id = source.Id; AircraftID = source.AircraftID; ATLBNo = source.ATLBNo; }
private void AddNew() { ATLB newATLB = new ATLB(CurrentAircraft); CommonEditorForm form = new CommonEditorForm(newATLB); form.ShowDialog(); if (newATLB.ItemId > 0) { AnimatedThreadWorker.RunWorkerAsync(); } }
/// <summary> /// Создает элемент управления отображающий бортовой журнал ВС /// </summary> /// <param name="atlb">Текущий бортовой журнал</param> public ATLBFlightsListView(ATLB atlb) { currentATLB = atlb; selectedItemsList = new List <AircraftFlight>(); ItemsListView.ColumnClick += ItemsListView_ColumnClick; ItemsListView.MouseDoubleClick += ItemsListView_MouseDoubleClick; ItemsListView.SelectedIndexChanged += ItemsListView_SelectedIndexChanged; ItemsListView.PreviewKeyDown += ItemsListView_PreviewKeyDown; DisplayerRequested += ATLBFlightsListView_DisplayerRequested; oldColumnIndex = 0; columnIndexQueue.Enqueue(0); ShowGroups = true; SetHeaders(); UpdateItems(); }
//private readonly bool permissionForUpdate = true; #endregion #region Constructor /// <summary> /// Создает элемент управления для отображения бортового журнала ВС /// </summary> public ATLBFlightsScreen(ATLB atlb) { if (atlb == null) { throw new ArgumentNullException("atlb", "Cannot display null-currentATLB"); } ((DispatcheredATLBFlightsScreen)this).InitComplition += ATLBFlightsScreen_InitComplition; currentATLB = atlb; InitializeComponent(); permissionForCreate = currentATLB.HasPermission(Users.CurrentUser.Role, DataEvent.Create); permissionForRemove = currentATLB.HasPermission(Users.CurrentUser.Role, DataEvent.Remove); //permissionForUpdate = currentATLB.HasPermission(Users.CurrentUser.Role, DataEvent.Update); HookAircraftFlightsCollection(); HookAircraftFlights(); //filterSelection = new StoreDetailFilterSelectionForm(currentATLB); UpdateInformation(); }
///<summary> /// Создает элемент управления для отображения списка агрегатов ///</summary> ///<param name="currentAtlb">Бортовой журнал, соержащий полеты</param> public FlightsListScreen(ATLB currentAtlb, bool allView = false) : this() { if (currentAtlb == null) { throw new ArgumentNullException("currentAtlb", "Cannot display null-currentAtlb"); } _currentATLB = currentAtlb; _allView = allView; CurrentAircraft = GlobalObjects.AircraftsCore.GetAircraftById(currentAtlb.ParentAircraftId); StatusTitle = currentAtlb + " " + "Fligths"; InitToolStripMenuItems(); InitListView(); if (allView) { UpdateControls(); } }
private void HeaderControlButtonSaveClick(object sender, EventArgs e) { ATLB lastAtlb = null; //TODO:(Evgenii Babak) создать новый метод FindLastATLB if (_currentAtlb == null) { var lastFlight = GlobalObjects.AircraftFlightsCore.GetLastAircraftFlight(CurrentAircraft.ItemId); if (lastFlight != null) { lastAtlb = GlobalObjects.CasEnvironment.NewLoader.GetObjectById <ATLBDTO, ATLB>(lastFlight.ATLBId); } } else { var atlbs = GlobalObjects.AircraftFlightsCore.GetATLBsByAircraftId(CurrentAircraft.ItemId); if (atlbs.Count > 0) { lastAtlb = atlbs.OrderBy(a => a.OpeningDate).Last(); } } if (lastAtlb == null) { MessageBox.Show("On this plane no matches logbook. \n Click Add New ATLB to create a new logbook", "Message infomation", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } if (!Save()) { return; } MessageBox.Show("Saving was successful", "Message infomation", MessageBoxButtons.OK, MessageBoxIcon.Information); AnimatedThreadWorker.RunWorkerAsync(); }
///<summary> /// Создает страницу для отображения информации об одной директиве ///</summary> /// <param name="atlb">Директива</param> ///<param name="aircraft"></param> public FlightScreenLight(ATLB atlb, Aircraft aircraft, AtlbRecordType type = AtlbRecordType.Flight) : this() { if (atlb == null) { throw new ArgumentNullException("atlb", "Argument cannot be null"); } _currentAtlb = atlb; CurrentAircraft = aircraft; _type = type; #region ButtonPrintContextMenu //buttonPrintMenuStrip = new ContextMenuStrip(); //itemPrintReportRecords = new ToolStripMenuItem { Text = "Records" }; //itemPrintReportHistory = new ToolStripMenuItem { Text = "Compliance history" }; //buttonPrintMenuStrip.Items.AddRange(new ToolStripItem[] { itemPrintReportRecords, itemPrintReportHistory }); //ButtonPrintMenuStrip = buttonPrintMenuStrip; #endregion AnimatedThreadWorker.DoWork -= AnimatedThreadWorkerDoWorkWithCreateFlight; AnimatedThreadWorker.DoWork -= AnimatedThreadWorkerDoWork; AnimatedThreadWorker.DoWork += AnimatedThreadWorkerDoWorkWithCreateFlight; }
public void SmartCoreFileTest_ATLB() { var enviroment = GetEnviroment(); var atlb = new ATLB { AttachedFile = new AttachedFile { FileName = "AttachedFile.test" }, }; enviroment.NewKeeper.Save(atlb); Assert.IsTrue(atlb.ItemId > 0, "ItemId должен быть больше 0"); var forCheck = enviroment.NewLoader.GetObject <ATLBDTO, ATLB>(new Filter("ItemId", atlb.ItemId), true); enviroment.NewKeeper.Delete(atlb); Assert.IsTrue(forCheck != null, "значение не должно быть null"); Assert.AreEqual(forCheck.Files.Count, 1, "Кол-во файлов должно быть 1"); Assert.IsTrue(forCheck.AttachedFile != null); Assert.AreEqual(forCheck.AttachedFile.FileName, "AttachedFile.test"); }
/// <summary> /// Обновляет значения полей /// </summary> public override void FillControls() { BeginUpdate(); 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; } #endregion #region lookupComboboxFlight if (Discrepancy != null && Discrepancy.ItemId > 0 && Discrepancy.DirectiveId > 0) { var aircraft = GlobalObjects.AircraftsCore.GetAircraftById(Discrepancy.ParentFlight.AircraftId); 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); } } #endregion _specialists.Clear(); try { _specialists.AddRange(GlobalObjects.CasEnvironment.Loader.GetObjectListAll <Specialist>(loadChild: true).Where(i => i.Occupation?.Department?.FullName == "Line Maintenance")); } catch (Exception ex) { Program.Provider.Logger.Log("Error while load Specialist fo Discrepancy", ex); } if (Discrepancy != null) { comboSpecialist1.Items.AddRange(_specialists.ToArray()); comboSpecialist2.Items.AddRange(_specialists.ToArray()); radioCrew.Checked = Discrepancy.FilledBy == false; // DiscrepancyFilledByEnum.Crew; radioMaintenanceStaff.Checked = Discrepancy.FilledBy; //DiscrepancyFilledByEnum.MaintenanceStaff; ataChapterComboBox.ATAChapter = Discrepancy.ATAChapter; // radioOpen.Checked = Discrepancy.correctiveAction.Status == CorrectiveActionStatus.Open; // radioClose.Checked = Discrepancy.correctiveAction.Status == CorrectiveActionStatus.Close; 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.DeferredItem != null) { ataChapterComboBox.Enabled = false; ataChapterComboBox.ATAChapter = Discrepancy.DeferredItem.ATAChapter; _showDeferredInfoPanel = true; } else { _showDeferredInfoPanel = false; } 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; } else { textCorrectiveAction.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 { dateTimePickerRTSDate.Value = DateTime.Today; comboSpecialist1.SelectedItem = null; comboSpecialist2.SelectedItem = null; textDescription.Text = "What Where When Extent"; } SetExtendableControlCaption(); EndUpdate(); }
/// <summary> /// Создает элемент управления для отображения списка агрегатов склада /// </summary> public DispatcheredATLBFlightsScreen(ATLB atlb) : base(atlb) { currentATLB = atlb; Dock = DockStyle.Fill; }
protected override void AnimatedThreadWorkerDoWork(object sender, DoWorkEventArgs e) { AnimatedThreadWorker.ReportProgress(0, "load flight"); try { _currentFlight = GlobalObjects.AircraftFlightsCore.LoadFullAircraftFlightById(_currentFlight.ItemId, CurrentAircraft.ItemId); if (_currentFlight.ParentATLB == null || _currentFlight.ParentATLB.ItemId != _currentFlight.ATLBId) { _currentFlight.ParentATLB = GlobalObjects.CasEnvironment.NewLoader.GetObjectById <ATLBDTO, ATLB>(_currentFlight.ATLBId); } } catch (Exception ex) { Program.Provider.Logger.Log("Error while loading flight", ex); } if (AnimatedThreadWorker.CancellationPending) { e.Cancel = true; return; } ATLB lastAtlb = null; AircraftFlight lastAircraftFlight; _lastFlightString = "Unknown"; _lastAtlbString = "Unknown"; _flightsOnPage = 0; _flightsOnPageMax = 0; if (_currentFlight.ATLBId > 0) { lastAtlb = GlobalObjects.CasEnvironment.NewLoader.GetObjectById <ATLBDTO, ATLB>(_currentFlight.ATLBId); if (lastAtlb != null) { _lastAtlbString = lastAtlb.ATLBNo; _flightsOnPageMax = lastAtlb.PageFlightCount; } var flights = GlobalObjects.AircraftFlightsCore.GetAircraftFlightsByAircraftId(CurrentAircraft.ItemId); lastAircraftFlight = _currentFlight.ItemId <= 0 ? flights.GetLastFlightInAtlb(_currentFlight.ATLBId) : flights.GetPreviousKnownRecord(_currentFlight.FlightDate); if (lastAircraftFlight != null) { _lastFlightString = lastAircraftFlight.PageNo; _flightsOnPage = flights.GetFlightWithPageNumInAtlb(_currentFlight.PageNo, _currentFlight.ATLBId).Count; } } else { var flights = GlobalObjects.AircraftFlightsCore.GetAircraftFlightsByAircraftId(CurrentAircraft.ItemId); lastAircraftFlight = _currentFlight.ItemId <= 0 ? flights.GetLast() : flights.GetPreviousKnownRecord(_currentFlight.FlightDate); if (lastAircraftFlight != null) { _lastFlightString = lastAircraftFlight.PageNo; lastAtlb = GlobalObjects.CasEnvironment.NewLoader.GetObjectById <ATLBDTO, ATLB>(lastAircraftFlight.ATLBId); } if (lastAtlb != null) { _lastAtlbString = lastAtlb.ATLBNo; _flightsOnPageMax = lastAtlb.PageFlightCount; } } discrepancies.Clear(); discrepancies.AddRange(GlobalObjects.DiscrepanciesCore.GetDiscrepancies(CurrentAircraft).Distinct()); workpackages.Clear(); workpackages.AddRange(GlobalObjects.WorkPackageCore.GetWorkPackages(CurrentAircraft)); transferRecords.Clear(); transferRecords.AddRange(GlobalObjects.TransferRecordCore.GetTransferRecord(CurrentAircraft.ItemId)); AnimatedThreadWorker.ReportProgress(100, "Complete"); }
/// <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); }
private void atlb_Saving(object sender, CancelEventArgs e) { atlbBeforeSave = (ATLB)sender; }
/// <summary> /// Обновляет значения полей /// </summary> public override void FillControls() { BeginUpdate(); ataChapterComboBox.UpdateInformation(); #region lookupComboboxFlight if (Discrepancy != null && Discrepancy.ItemId > 0 && Discrepancy.DirectiveId > 0) { var aircraft = GlobalObjects.AircraftsCore.GetAircraftById(Discrepancy.ParentFlight.AircraftId); ATLB parentAtlb = null; try { parentAtlb = GlobalObjects.CasEnvironment.Loader.GetObject <ATLB>(Discrepancy.ParentFlight.ATLBId); } catch (Exception ex) { Program.Provider.Logger.Log("Error while load linked ATLB fo Discrepancy", ex); } } #endregion _specialists.Clear(); try { _specialists.AddRange(GlobalObjects.CasEnvironment.Loader.GetObjectList <Specialist>()); } catch (Exception ex) { Program.Provider.Logger.Log("Error while load Specialist fo Discrepancy", ex); } if (Discrepancy != null) { radioCrew.Checked = Discrepancy.FilledBy == false; // DiscrepancyFilledByEnum.Crew; radioMaintenanceStaff.Checked = Discrepancy.FilledBy; //DiscrepancyFilledByEnum.MaintenanceStaff; ataChapterComboBox.ATAChapter = Discrepancy.ATAChapter; // radioOpen.Checked = Discrepancy.correctiveAction.Status == CorrectiveActionStatus.Open; // radioClose.Checked = Discrepancy.correctiveAction.Status == CorrectiveActionStatus.Close; textDescription.Text = Discrepancy.Description ?? "No"; 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.DeferredItem != null) { ataChapterComboBox.Enabled = false; ataChapterComboBox.ATAChapter = Discrepancy.DeferredItem.ATAChapter; _showDeferredInfoPanel = true; } else { _showDeferredInfoPanel = false; } 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; } else { textCorrectiveAction.Text = "No"; textPNOff.Text = textSNOff.Text = textPNOn.Text = textSNOn.Text = ""; } } else { textDescription.Text = "What Where When Extent"; } SetExtendableControlCaption(); EndUpdate(); }
/// <summary> /// Создается построитель отчета по полету ВС /// </summary> public ATLBBuilder(AircraftFlight aircraftFlight) { _currentATLB = aircraftFlight.ParentATLB; _currentPageNumber = _currentATLB.StartPageNo; }