/// <summary> /// Возвращает DisplayerParams для MaintenanceDirective /// </summary> public static DisplayerParams GetMaintenanceDirectiveScreen(MaintenanceDirective mpd) { string regNumber; Aircraft parentAircraft = null; if (mpd.ParentBaseComponent.LastDestinationObjectType == SmartCoreType.Aircraft) { parentAircraft = GlobalObjects.AircraftsCore.GetAircraftById(mpd.ParentBaseComponent.LastDestinationObjectId); } if (mpd.ParentBaseComponent.BaseComponentType == BaseComponentType.Frame) { regNumber = mpd.ParentBaseComponent.GetParentAircraftRegNumber(); } else { if (parentAircraft != null) { regNumber = $"{parentAircraft.RegistrationNumber}. {mpd.ParentBaseComponent}"; } else { regNumber = mpd.ParentBaseComponent.ToString(); } } regNumber += $". MPD. {mpd.WorkType.CommonName}. {mpd.TaskNumberCheck}"; return(DisplayerParams.CreateScreenParams(ReflectionTypes.DisplayInNew, regNumber, new MaintenanceDirectiveScreen(mpd))); }
/// <summary> /// Возвращает DisplayerParams для ComponentDirective /// </summary> public static DisplayerParams GetComponentDirectiveScreen(ComponentDirective componentDirective) { string pagecaption; if (componentDirective.ParentComponent != null) { //TODO:(Evgenii Babak) Пересмотреть подход здесь if (componentDirective.ParentComponent.ParentAircraftId > 0) { pagecaption = $"{DestinationHelper.GetDestinationStringFromAircraft(componentDirective.ParentComponent.ParentAircraftId, false, null)}. Component PN {componentDirective.ParentComponent.PartNumber}"; } else if (componentDirective.ParentComponent.ParentStoreId > 0) { var parentStore = GlobalObjects.StoreCore.GetStoreById(componentDirective.ParentComponent.ParentStoreId); pagecaption = $"{parentStore.Name}. Component PN {componentDirective.ParentComponent.PartNumber}"; } else if (componentDirective.ParentBaseComponent != null) { pagecaption = $"Component PN {componentDirective.ParentComponent.ParentBaseComponent.PartNumber}"; //TODO:(Evgenii Babak) заменить на использование ComponentCore } else { pagecaption = $"Component PN {componentDirective.ParentComponent.PartNumber}"; } return(DisplayerParams.CreateScreenParams(ReflectionTypes.DisplayInNew, pagecaption, new ComponentScreenNew(componentDirective.ParentComponent))); } throw new NullReferenceException("ComponentDirective.ParentComponent is null"); }
/// <summary> /// Возвращает DisplayerParams для Component /// </summary> public static DisplayerParams GetComponentScreen(Component component) { if (component.GoodsClass.IsNodeOrSubNodeOf(GoodsClass.MaintenanceMaterials) || component.GoodsClass.IsNodeOrSubNodeOf(GoodsClass.Tools) || component.GoodsClass.IsNodeOrSubNodeOf(GoodsClass.Tools) || component.GoodsClass.IsNodeOrSubNodeOf(GoodsClass.Unknown)) { return(null); } string pagecaption; //TODO:(Evgenii Babak) Пересмотреть подход здесь var parentStore = GlobalObjects.StoreCore.GetStoreById(component.ParentStoreId); if (component.ParentAircraftId > 0) { pagecaption = $"{component.GetParentAircraftRegNumber()}. Component PN {component.PartNumber}"; } else if (parentStore != null) { pagecaption = $"{parentStore.Name}. Component PN {component.PartNumber}"; } else if (component.ParentBaseComponent != null) { pagecaption = $"Component PN {component.ParentBaseComponent.PartNumber}"; //TODO:(Evgenii Babak) заменить на использование ComponentCore } else { pagecaption = $"Component PN {component.PartNumber}"; } return(DisplayerParams.CreateScreenParams(ReflectionTypes.DisplayInNew, pagecaption, new ComponentScreenNew(component))); }
private void OpenItemClick(object sender, EventArgs e) { var refE = new ReferenceEventArgs(); var selectedItem = _directivesViewer.SelectedItem; var period = $"{selectedItem.From:dd-MMMM-yyyy} - {selectedItem.To:dd-MMMM-yyyy}"; var dp = DisplayerParams.CreateScreenParams(ReflectionTypes.DisplayInNew, period, new FlightPlanOpsRecordListScreen(GlobalObjects.CasEnvironment.Operators[0], selectedItem)); refE.SetParameters(dp); InvokeDisplayerRequested(refE); }
/// <summary> /// Возвращает DisplayerParams для Directive /// </summary> public static DisplayerParams GetDirectiveScreen(Directive directive) { var pagecaption = $"{directive.ParentBaseComponent.GetParentAircraftRegNumber()} {directive.Title}"; if (directive is DeferredItem) { return(DisplayerParams.CreateScreenParams(ReflectionTypes.DisplayInNew, pagecaption, new DeferredScreen((DeferredItem)directive))); } else if (directive is DamageItem) { return(DisplayerParams.CreateScreenParams(ReflectionTypes.DisplayInNew, pagecaption, new DamageDirectiveScreen((DamageItem)directive))); } else if (directive.DirectiveType == DirectiveType.OutOfPhase) { return(DisplayerParams.CreateScreenParams(ReflectionTypes.DisplayInNew, pagecaption, new OutOfPhaseReferenceScreen(directive))); } else { return(DisplayerParams.CreateScreenParams(ReflectionTypes.DisplayInNew, pagecaption, new DirectiveScreen(directive))); } }
/// <summary> /// Возвращает DisplayerParams для BaseComponent /// </summary> public static DisplayerParams GetBaseComponentScreen(BaseComponent baseComponent) { string pagecaption; //TODO:(Evgenii Babak) Пересмотреть подход здесь var parentStore = GlobalObjects.StoreCore.GetStoreById(baseComponent.ParentStoreId); if (baseComponent.ParentAircraftId > 0) { pagecaption = $"{baseComponent.GetParentAircraftRegNumber()} {baseComponent.BaseComponentType}. Component PN {baseComponent.PartNumber}"; } else if (parentStore != null) { pagecaption = $"{parentStore.Name}. Component PN {baseComponent.PartNumber}"; } else { pagecaption = $"Component PN {baseComponent.PartNumber}"; } return(DisplayerParams.CreateScreenParams(ReflectionTypes.DisplayInNew, pagecaption, new ComponentScreenNew(baseComponent))); }
/// <summary> /// Возвращает DisplayerParams для MaintenanceCheck /// </summary> public static DisplayerParams GetMaintenanceCheckScreen(MaintenanceCheck maintenanceCheck) { string pagecaption = maintenanceCheck.ParentAircraft.RegistrationNumber + ". Maintenance Program"; return(DisplayerParams.CreateScreenParams(ReflectionTypes.DisplayInNew, pagecaption, new MaintenanceScreen(maintenanceCheck.ParentAircraft))); }