/// <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"); }
//This method is for getting the Destinations. The Destinations are displayed in card and tile layout private async void DestinationList() { DestinationHelper dm = new DestinationHelper(); _destinations = await dm.GetDestinations(); _adapter.UpdateDataSource(_destinations); }
private void InitializeQuickSettingsMenu() { this.contextmenu_quicksettings.DropDownItems.Clear(); // screenshot destination ToolStripMenuSelectList selectList = new ToolStripMenuSelectList("destinations", true); selectList.Text = Language.GetString(LangKey.settings_destination); // Working with IDestination: foreach (IDestination destination in DestinationHelper.GetAllDestinations()) { selectList.AddItem(destination.Description, destination, conf.OutputDestinations.Contains(destination.Designation)); } selectList.CheckedChanged += new EventHandler(this.QuickSettingDestinationChanged); this.contextmenu_quicksettings.DropDownItems.Add(selectList); // Capture Modes selectList = new ToolStripMenuSelectList("capturemodes", false); selectList.Text = Language.GetString(LangKey.settings_window_capture_mode); string enumTypeName = typeof(WindowCaptureMode).Name; foreach (WindowCaptureMode captureMode in Enum.GetValues(typeof(WindowCaptureMode))) { selectList.AddItem(Language.GetString(enumTypeName + "." + captureMode.ToString()), captureMode, conf.WindowCaptureMode == captureMode); } selectList.CheckedChanged += new EventHandler(this.QuickSettingCaptureModeChanged); this.contextmenu_quicksettings.DropDownItems.Add(selectList); // print options selectList = new ToolStripMenuSelectList("printoptions", true); selectList.Text = Language.GetString(LangKey.settings_printoptions); IniValue iniValue; foreach (string propertyName in conf.Values.Keys) { if (propertyName.StartsWith("OutputPrint")) { iniValue = conf.Values[propertyName]; if (iniValue.Attributes.LanguageKey != null) { selectList.AddItem(Language.GetString(iniValue.Attributes.LanguageKey), iniValue, (bool)iniValue.Value); } } } selectList.CheckedChanged += new EventHandler(this.QuickSettingBoolItemChanged); this.contextmenu_quicksettings.DropDownItems.Add(selectList); // effects selectList = new ToolStripMenuSelectList("effects", true); selectList.Text = Language.GetString(LangKey.settings_visualization); iniValue = conf.Values["PlayCameraSound"]; selectList.AddItem(Language.GetString(iniValue.Attributes.LanguageKey), iniValue, (bool)iniValue.Value); iniValue = conf.Values["ShowTrayNotification"]; selectList.AddItem(Language.GetString(iniValue.Attributes.LanguageKey), iniValue, (bool)iniValue.Value); selectList.CheckedChanged += new EventHandler(this.QuickSettingBoolItemChanged); this.contextmenu_quicksettings.DropDownItems.Add(selectList); }
/// <summary> /// Build the view with all the destinations /// </summary> private void DisplayDestinations() { bool destinationsEnabled = true; if (coreConfiguration.Values.ContainsKey("Destinations")) { destinationsEnabled = !coreConfiguration.Values["Destinations"].IsFixed; } checkbox_picker.Checked = false; listview_destinations.Items.Clear(); listview_destinations.ListViewItemSorter = new ListviewWithDestinationComparer(); ImageList imageList = new ImageList(); listview_destinations.SmallImageList = imageList; int imageNr = -1; foreach (IDestination currentDestination in DestinationHelper.GetAllDestinations()) { Image destinationImage = currentDestination.DisplayIcon; if (destinationImage != null) { imageList.Images.Add(currentDestination.DisplayIcon); imageNr++; } if (PickerDestination.DESIGNATION.Equals(currentDestination.Designation)) { checkbox_picker.Checked = coreConfiguration.OutputDestinations.Contains(currentDestination.Designation); checkbox_picker.Text = currentDestination.Description; } else { ListViewItem item; if (destinationImage != null) { item = listview_destinations.Items.Add(currentDestination.Description, imageNr); } else { item = listview_destinations.Items.Add(currentDestination.Description); } item.Tag = currentDestination; item.Checked = coreConfiguration.OutputDestinations.Contains(currentDestination.Designation); } } if (checkbox_picker.Checked) { listview_destinations.Enabled = false; foreach (int index in listview_destinations.CheckedIndices) { ListViewItem item = listview_destinations.Items[index]; item.Checked = false; } } checkbox_picker.Enabled = destinationsEnabled; listview_destinations.Enabled = destinationsEnabled; }
//get detailed info about a destination private async void GetData(string id) { DestinationHelper dm = new DestinationHelper(); if (!string.IsNullOrEmpty(id)) { _destinationDetail = await dm.GetTravelDestinationDetail(id); _adapter.UpdateDataSource(_destinationDetail); } }
// This method is for loading the banner image private void LoadBackdropCover() { try { DestinationHelper sm = new DestinationHelper(); Glide.With(this).Load(Resource.Drawable.Backdrop) .Into((ImageView)FindViewById(Resource.Id.imageBackdrop)); } catch (System.Exception e) { Log.Error("error occured in LoadBackdropCover method in Main Activity", e.Message); } }
static string GetDestination(Role x) { #region Other Common Works //Do logging //Other Business Activities #endregion string destination = String.Empty; dynamic inputRole = x; destination = DestinationHelper.GetDestinationSepcificImplm(inputRole); return(destination); }
/// <summary> /// Build the view with all the destinations /// </summary> private void DisplayDestinations() { checkbox_picker.Checked = false; destinationsListView.Items.Clear(); destinationsListView.ListViewItemSorter = new ListviewWithDestinationComparer(); ImageList imageList = new ImageList(); destinationsListView.SmallImageList = imageList; int imageNr = -1; foreach (IDestination destination in DestinationHelper.GetAllDestinations()) { Image destinationImage = destination.DisplayIcon; if (destinationImage != null) { imageList.Images.Add(destination.DisplayIcon); imageNr++; } if (PickerDestination.DESIGNATION.Equals(destination.Designation)) { checkbox_picker.Checked = coreConfiguration.OutputDestinations.Contains(destination.Designation); checkbox_picker.Text = destination.Description; } else { ListViewItem item; if (destinationImage != null) { item = destinationsListView.Items.Add(destination.Description, imageNr); } else { item = destinationsListView.Items.Add(destination.Description); } item.Tag = destination; item.Checked = coreConfiguration.OutputDestinations.Contains(destination.Designation); } } if (checkbox_picker.Checked) { destinationsListView.Enabled = false; foreach (int index in destinationsListView.CheckedIndices) { ListViewItem item = destinationsListView.Items[index]; item.Checked = false; } } }
protected override void Initialize() { base.Initialize(); if (coreConfiguration.OutputDestinations == null) { coreConfiguration.OutputDestinations = new List <string>(); } foreach (IDestination destination in DestinationHelper.GetAllDestinations()) { Destinations.Add(new DestinationSelectionContainer { Destination = destination, IsSelected = coreConfiguration.OutputDestinations.Contains(destination.Designation) }); } }
protected override void Initialize() { base.Initialize(); if (coreConfiguration.PickerDestinations == null) { coreConfiguration.PickerDestinations = new List <string>(); } if (coreConfiguration.PickerDestinations.Count > 0) { // Show selected (and active) destinations foreach (string designation in coreConfiguration.PickerDestinations) { IDestination destination = DestinationHelper.GetDestination(designation); if ("Picker".Equals(destination.Designation)) { continue; } selectedDestinations.Add(destination); } foreach (IDestination destination in DestinationHelper.GetAllDestinations()) { // Skip picker if ("Picker".Equals(destination.Designation)) { continue; } if (!coreConfiguration.PickerDestinations.Contains(destination.Designation)) { availableDestinations.Add(destination); } } } else { foreach (IDestination destination in DestinationHelper.GetAllDestinations()) { // Skip picker if ("Picker".Equals(destination.Designation)) { continue; } selectedDestinations.Add(destination); } } }
/// <summary> /// Export the capture with the destination picker /// </summary> /// <param name="manuallyInitiated">Did the user select this destination?</param> /// <param name="surface">Surface to export</param> /// <param name="captureDetails">Details of the capture</param> /// <returns>true if export was made</returns> public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { List <IDestination> destinations = new List <IDestination>(); if (conf.PickerDestinations != null && conf.PickerDestinations.Count > 0) { // Show selected (and active) destinations foreach (string designation in conf.PickerDestinations) { IDestination destination = DestinationHelper.GetDestination(designation); if (DESIGNATION.Equals(destination.Designation)) { continue; } if (!destination.IsActive) { continue; } destinations.Add(destination); } } else { // Show active destinations foreach (IDestination destination in DestinationHelper.GetAllDestinations()) { if ("Picker".Equals(destination.Designation)) { continue; } if (!destination.IsActive) { continue; } destinations.Add(destination); } } // No Processing, this is done in the selected destination (if anything was selected) return(ShowPickerMenu(true, surface, captureDetails, destinations)); }
/// <summary> /// Export the capture with the destination picker /// </summary> /// <param name="manuallyInitiated">Did the user select this destination?</param> /// <param name="surface">Surface to export</param> /// <param name="captureDetails">Details of the capture</param> /// <returns>true if export was made</returns> public override ExportInformation ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { List <IDestination> destinations = new List <IDestination>(); foreach (IDestination destination in DestinationHelper.GetAllDestinations()) { if ("Picker".Equals(destination.Designation)) { continue; } if (!destination.isActive) { continue; } destinations.Add(destination); } // No Processing, this is done in the selected destination (if anything was selected) return(ShowPickerMenu(true, surface, captureDetails, destinations)); }
public override bool ExportCapture(bool manuallyInitiated, ISurface surface, ICaptureDetails captureDetails) { List <IDestination> destinations = new List <IDestination>(); foreach (IDestination destination in DestinationHelper.GetAllDestinations()) { if ("Picker".Equals(destination.Designation)) { continue; } if (!destination.isActive) { continue; } destinations.Add(destination); } ContextMenuStrip menu = CreatePickerMenu(true, surface, captureDetails, destinations); ShowMenuAtCursor(menu); return(true); }
protected override List <CustomCell> GetListViewSubItems(TransferRecord item) { var subItems = new List <CustomCell>(); string on, off, ata, goodClass, reason = "", description = "", fromTo = ""; if (item.IsReplaceComponentRemoved) { off = item.ReplaceComponent.ToString(); on = item.ParentComponent.ToString(); ata = item.ReplaceComponent.ATAChapter.ToString(); goodClass = item.ReplaceComponent.GoodsClass.ToString(); var tr = item.ReplaceComponent.TransferRecords.LastOrDefault(x => x.TransferDate.Date.Equals(item.TransferDate.Date)); if (tr?.DestinationObject != null) { reason = tr.Reason.ToString(); description = tr.Description; var from = ""; if (tr.FromAircraft != null) { from = "Aircraft: " + tr.FromAircraft; } if (tr.FromStore != null) { from = "Store: " + tr.FromStore; } if (tr.FromBaseComponent != null) { if (from != "") { from += " "; } from += "Base Component:" + tr.FromBaseComponent; } fromTo += $"{from} => {DestinationHelper.GetDestinationObjectString(tr)}"; } } else { on = item.ReplaceComponent.ToString(); off = item.ParentComponent.ToString(); ata = item.ParentComponent.ATAChapter.ToString(); goodClass = item.ParentComponent.GoodsClass.ToString(); var tr = item.ReplaceComponent.TransferRecords.FirstOrDefault(x => x.TransferDate.Date.Equals(item.TransferDate.Date)); if (tr != null) { reason = tr.Reason.ToString(); description = tr.Description; } var from = ""; if (item.FromAircraft != null) { from = "Aircraft: " + item.FromAircraft; } if (item.FromStore != null) { from = "Store: " + item.FromStore; } if (item.FromBaseComponent != null) { if (from != "") { from += " "; } from += "Base Component:" + item.FromBaseComponent; } fromTo += $"{from} => {DestinationHelper.GetDestinationObjectString(item)}"; } var author = GlobalObjects.CasEnvironment.GetCorrector(item); subItems.Add(CreateRow(item.TransferDate.ToString(new GlobalTermsProvider()["DateFormat"].ToString()), item.TransferDate)); subItems.Add(CreateRow(fromTo, fromTo)); subItems.Add(CreateRow(off, off)); subItems.Add(CreateRow(on, on)); subItems.Add(CreateRow(ata, ata)); subItems.Add(CreateRow(goodClass, goodClass)); subItems.Add(CreateRow(description, description)); subItems.Add(CreateRow(reason, reason)); subItems.Add(CreateRow(author, author)); return(subItems); }
protected override List <CustomCell> GetListViewSubItems(TransferRecord item) { var subItems = new List <CustomCell>(); var component = item.ParentComponent; string descriptionOn = "", descriptionOff = ""; var fromSupplierReciveDate = item.ParentComponent.FromSupplierReciveDate >= DateTimeExtend.GetCASMinDateTime() ? item.ParentComponent.FromSupplierReciveDate.ToString(new GlobalTermsProvider()["DateFormat"].ToString()) : ""; string fromTo = ""; if (item.FromAircraft != null) { fromTo = "Aircraft: " + item.FromAircraft; } if (item.FromStore != null) { fromTo = "Store: " + item.FromStore; descriptionOn = component.Description + " " + item.Position + " P/N:" + component.PartNumber + " S/N: " + component.SerialNumber; } if (item.FromBaseComponent != null) { if (fromTo != "") { fromTo += " "; } fromTo += "Base Component:" + item.FromBaseComponent; descriptionOff = component.Description + " " + item.Position + " P/N:" + component.PartNumber + " S/N: " + component.SerialNumber; } if (item.FromSupplier != null) { fromTo = "Supplier: " + item.FromSupplier; descriptionOff = component.Description + " " + item.Position + " P/N:" + component.PartNumber + " S/N: " + component.SerialNumber; } if (item.FromSpecialist != null) { fromTo = "Employee: " + item.FromSpecialist; descriptionOff = component.Description + " " + item.Position + " P/N:" + component.PartNumber + " S/N: " + component.SerialNumber; } if (item.FromAircraft == null && item.FromBaseComponent == null && item.FromStore == null && item.FromSupplier == null && item.FromSpecialist == null) { if (IsStore) { descriptionOff = component.Description + " " + item.Position + " P/N:" + component.PartNumber + " S/N: " + component.SerialNumber; } else { descriptionOn = component.Description + " " + item.Position + " P/N:" + component.PartNumber + " S/N: " + component.SerialNumber; } } if (item.DestinationObject != null) { if (fromTo != "") { fromTo += " "; } fromTo += "=> " + DestinationHelper.GetDestinationObjectString(item); } string quantity; if (item.ParentComponent is BaseComponent) { quantity = $"{1:0.##}" + (item.ParentComponent.Measure != null ? " " + item.ParentComponent.Measure + "(s)" : ""); } else { quantity = $"{item.ParentComponent.QuantityIn:0.##}" + (item.ParentComponent.Measure != null ? " " + item.ParentComponent.Measure + "(s)" : ""); } var released = item.ReleasedSpecialist?.ToString() ?? ""; var received = item.ReceivedSpecialist?.ToString() ?? ""; var author = GlobalObjects.CasEnvironment.GetCorrector(item); subItems.Add(CreateRow(item.TransferDate.ToString(new GlobalTermsProvider()["DateFormat"].ToString()), item.TransferDate)); subItems.Add(CreateRow(fromTo, fromTo)); subItems.Add(CreateRow(quantity, item.ParentComponent.QuantityIn)); subItems.Add(CreateRow(item.ParentComponent.ATAChapter.ToString(), item.ParentComponent.ATAChapter)); subItems.Add(CreateRow(item.GoodsClass.ToString(), item.GoodsClass)); if (IsStore) { subItems.Add(CreateRow(descriptionOn, descriptionOn)); subItems.Add(CreateRow(descriptionOff, descriptionOff)); } else { subItems.Add(CreateRow(descriptionOff, descriptionOff)); subItems.Add(CreateRow(descriptionOn, descriptionOn)); } subItems.Add(CreateRow(item.Reason.ToString(), item.Reason)); subItems.Add(CreateRow(item.Description, item.Description)); subItems.Add(CreateRow(item.Remarks, item.Remarks)); subItems.Add(CreateRow(released, released)); subItems.Add(CreateRow(received, received)); subItems.Add(CreateRow(item.ParentComponent.FromSupplier.ToString(), item.ParentComponent.FromSupplier)); subItems.Add(CreateRow(fromSupplierReciveDate, item.ParentComponent.FromSupplierReciveDate)); subItems.Add(CreateRow(author, author)); return(subItems); }
/// <summary> /// Данные у директивы обновляются по введенным данным /// </summary> /// <param name="destinationDamageItem">Директива</param> /// <param name="changePageName">Менять ли название вкладки</param> public void ApplyChanges(DamageItem destinationDamageItem, bool changePageName) { textboxTitle.Focus(); if (destinationDamageItem == null) { throw new ArgumentNullException("destinationDamageItem"); } destinationDamageItem.ATAChapter = ATAChapter; if (destinationDamageItem.Title != Title) { destinationDamageItem.Title = Title; if (changePageName) { var caption = ""; if (destinationDamageItem.ParentBaseComponent != null) { var baseComponent = destinationDamageItem.ParentBaseComponent; if (baseComponent.BaseComponentTypeId == BaseComponentType.Frame.ItemId) { //у Frame всегда есть ParentAircraftId caption = $"{DestinationHelper.GetDestinationStringFromAircraft(baseComponent.ParentAircraftId, false, null)}. {destinationDamageItem.DirectiveType.CommonName}. {destinationDamageItem.Title}"; } else { if (baseComponent.ParentAircraftId > 0) { caption = $"{DestinationHelper.GetDestinationStringFromAircraft(baseComponent.ParentAircraftId, false, null)}. "; } else if (baseComponent.ParentStoreId > 0) { caption = $"{DestinationHelper.GetDestinationStringFromStore(baseComponent.ParentStoreId, null, true)}. "; } caption += baseComponent + ". " + destinationDamageItem.DirectiveType.CommonName + ". " + destinationDamageItem.Title; } } if (DisplayerRequested != null) { DisplayerRequested(this, new ReferenceEventArgs(null, ReflectionTypes.ChangeTextOfContainingDisplayer, caption)); } } } destinationDamageItem.HiddenRemarks = HiddenRemarks; destinationDamageItem.Threshold.EffectiveDate = EffectiveDate; destinationDamageItem.Applicability = Applicability; destinationDamageItem.CorrectiveAction = Corrective; destinationDamageItem.ServiceBulletinNo = ServiceBulletin; destinationDamageItem.EngineeringOrders = EngOrderNumber; destinationDamageItem.InspectionDocumentsNo = InspectionDocuments; destinationDamageItem.Description = Subject; destinationDamageItem.Remarks = Remarks; destinationDamageItem.DamageMeasure = comboBoxMeasure.SelectedItem as Measure; destinationDamageItem.DamageType = (DamageType)comboBoxDamageType.SelectedItem; destinationDamageItem.DamageClass = (DamageClass)comboBoxClass.SelectedItem; destinationDamageItem.Location = textBoxLocation.Text; destinationDamageItem.Number = textBoxDamageNumber.Text; destinationDamageItem.DamageDepth = (double)numericUpDownDepth.Value; destinationDamageItem.DamageDepthLimit = (double)numericUpDownDepthLimit.Value; destinationDamageItem.DamageLenght = (double)numericUpDownLenght.Value; destinationDamageItem.DamageLenghtLimit = (double)numericUpDownLenghtLimit.Value; destinationDamageItem.DamageWidth = (double)numericUpDownWidth.Value; destinationDamageItem.DamageWidthLimit = (double)numericUpDownWidthLimit.Value; destinationDamageItem.JobCard = lookupComboboxJobCard.SelectedItem as JobCard; if (fileControlSB.GetChangeStatus()) { fileControlSB.ApplyChanges(); destinationDamageItem.ServiceBulletinFile = fileControlSB.AttachedFile; } if (fileControlEO.GetChangeStatus()) { fileControlEO.ApplyChanges(); destinationDamageItem.EngineeringOrderFile = fileControlEO.AttachedFile; } if (fileControlADNo.GetChangeStatus()) { fileControlADNo.ApplyChanges(); destinationDamageItem.ADNoFile = fileControlADNo.AttachedFile; } if (fileControlInspectionDocs.GetChangeStatus()) { fileControlInspectionDocs.ApplyChanges(); destinationDamageItem.InspectionDocumentsFile = fileControlInspectionDocs.AttachedFile; } }
protected override void BackgroundWorkerDoWork(object sender, DoWorkEventArgs e) { backgroundWorker.ReportProgress(50); try { Invoke(new Action(() => listViewCompliance.Items.Clear())); } catch (Exception) { } if (_currentComponent == null) { e.Cancel = true; return; } var parentAircraft = GlobalObjects.AircraftsCore.GetParentAircraft(_currentComponent); var lastRecords = new List <AbstractRecord>(); var nextPerformances = new List <NextPerformance>(); var allWorkPackagesIncludedTask = new CommonCollection <WorkPackage>(); var openPubWorkPackagesIncludedTask = new CommonCollection <WorkPackage>(); var closedWorkPackages = new CommonCollection <WorkPackage>(); var taskThatIncludeInWorkPackage = new List <IDirective>(); lastRecords.AddRange(_currentComponent.TransferRecords.ToArray()); lastRecords.AddRange(_currentComponent.ChangeLLPCategoryRecords.ToArray()); lastRecords.AddRange(_currentComponent.ActualStateRecords.ToArray()); //Объекты для в котороые будет извлекаться информация //из записеи о перемещении var lastDestination = ""; //прогнозируемый ресурс //если известна родительская деталь данной директивы, //то ее текущая наработка и средняя утилизация //используются в качестве ресурсов прогноза //для расчета всех просроченных выполнений var forecastData = new ForecastData(DateTime.Now, GlobalObjects.AverageUtilizationCore.GetAverageUtillization(_currentComponent), GlobalObjects.CasEnvironment.Calculator.GetCurrentFlightLifelength(_currentComponent)); foreach (var directive in _currentComponent.ComponentDirectives) { if (directive.IsAffect().GetValueOrDefault(true)) { //расчет след. выполнений директивы. //если известен ресурс прогноза, то будут расчитаны все просрочнные выполнения //если неизвестне, то только первое //GlobalObjects.PerformanceCalculator.GetNextPerformance(directive, forecastData); nextPerformances.AddRange(directive.NextPerformances); lastRecords.AddRange(directive.PerformanceRecords.ToArray()); if (backgroundWorker.CancellationPending) { e.Cancel = true; return; } taskThatIncludeInWorkPackage.Add(directive); } else { var bindedItems = GlobalObjects.BindedItemsCore.GetBindedItemsFor(parentAircraft.ItemId, directive); foreach (var bindedItem in bindedItems) { if (bindedItem is MaintenanceDirective) { var mpd = (MaintenanceDirective)bindedItem; //прогнозируемый ресурс //если известна родительская деталь данной директивы, //то ее текущая наработка и средняя утилизация //используются в качестве ресурсов прогноза //для расчета всех просроченных выполнений //расчет след. выполнений директивы. //если известен ресурс прогноза, то будут расчитаны все просрочнные выполнения //если неизвестне, то только первое GlobalObjects.PerformanceCalculator.GetNextPerformance(mpd, forecastData); nextPerformances.AddRange(mpd.NextPerformances); lastRecords.AddRange(mpd.PerformanceRecords.ToArray()); taskThatIncludeInWorkPackage.Add(mpd); } } } } //загрузка рабочих пакетов для определения //перекрытых ими выполнений задач if (_openPubWorkPackages == null) { _openPubWorkPackages = new CommonCollection <WorkPackage>(); } _openPubWorkPackages.Clear(); //загрузка рабочих пакетов для определения _openPubWorkPackages.AddRange(GlobalObjects.WorkPackageCore.GetWorkPackagesLite(parentAircraft, WorkPackageStatus.Opened)); _openPubWorkPackages.AddRange(GlobalObjects.WorkPackageCore.GetWorkPackagesLite(parentAircraft, WorkPackageStatus.Published)); allWorkPackagesIncludedTask.AddRange(GlobalObjects.WorkPackageCore.GetWorkPackagesLite(parentAircraft, WorkPackageStatus.All, taskThatIncludeInWorkPackage)); #region Добавление в список просроченных выполнений //и сравнение их с открытыми и опубликованными рабочими пакетами openPubWorkPackagesIncludedTask.AddRange( allWorkPackagesIncludedTask.Where(wp => wp.Status == WorkPackageStatus.Opened || wp.Status == WorkPackageStatus.Published)); //сбор всех записей рабочих пакетов для удобства фильтрации var openPubWpRecords = openPubWorkPackagesIncludedTask.SelectMany(wp => wp.WorkPakageRecords).ToList(); //LINQ запрос для сортировки записей по дате var sortNextRecords = (from record in nextPerformances orderby GetDate(record) descending select record).ToList(); for (int i = 0; i < sortNextRecords.Count; i++) { if (backgroundWorker.CancellationPending) { allWorkPackagesIncludedTask.Clear(); openPubWorkPackagesIncludedTask.Clear(); closedWorkPackages.Clear(); e.Cancel = true; return; } //поиск записи в рабочих пакетах по данному чеку //чей номер группы выполнения (по записи) совпадает с расчитанным var parentDirective = sortNextRecords[i].Parent; //номер выполнения int parentCountPerf; if (parentDirective.LastPerformance != null) { parentCountPerf = parentDirective.LastPerformance.PerformanceNum <= 0 ? 1 : parentDirective.LastPerformance.PerformanceNum; } else { parentCountPerf = 0; } parentCountPerf += parentDirective.NextPerformances.IndexOf(sortNextRecords[i]); parentCountPerf += 1; var wpr = openPubWpRecords.FirstOrDefault(r => r.PerformanceNumFromStart == parentCountPerf && r.WorkPackageItemType == parentDirective.SmartCoreObjectType.ItemId && r.DirectiveId == parentDirective.ItemId); if (wpr != null) { var wp = openPubWorkPackagesIncludedTask.GetItemById(wpr.WorkPakageId); //запись о выполнении блокируется найденым пакетом sortNextRecords[i].BlockedByPackage = wp; //последующие записи о выполнении так же должны быть заблокированы for (int j = i - 1; j >= 0; j--) { //блокировать нужно все рабочие записи, или до первой записи, //заблокированной другим рабочим пакетом if (sortNextRecords[j].BlockedByPackage != null || sortNextRecords[j].Condition != ConditionState.Overdue) { break; } if (sortNextRecords[j].Parent == parentDirective) { sortNextRecords[j].BlockedByPackage = wp; Invoke(new Action <int, Color>(SetItemColor), j, Color.FromArgb(Highlight.GrayLight.Color)); } } } Invoke(new Action <NextPerformance>(AddListViewItem), sortNextRecords[i]); } #endregion #region Добавление в список записей о произведенных выполнениях //и сравнение их с закрытыми рабочими пакетами closedWorkPackages.AddRange(allWorkPackagesIncludedTask.Where(wp => wp.Status == WorkPackageStatus.Closed)); //LINQ запрос для сортировки записей по дате var sortLastRecords = (from record in lastRecords orderby record.RecordDate ascending select record).ToList(); var items = new List <KeyValuePair <AbstractRecord, string[]> >(); for (int i = 0; i < sortLastRecords.Count; i++) { if (backgroundWorker.CancellationPending) { allWorkPackagesIncludedTask.Clear(); openPubWorkPackagesIncludedTask.Clear(); closedWorkPackages.Clear(); e.Cancel = true; return; } string[] subs; if (sortLastRecords[i] is DirectiveRecord) { var directiveRecord = (DirectiveRecord)sortLastRecords[i]; subs = new[] { directiveRecord.WorkType, UsefulMethods.NormalizeDate(directiveRecord.RecordDate), directiveRecord.OnLifelength != null ? directiveRecord.OnLifelength.ToString() : "", "", "", directiveRecord.Remarks }; } else if (sortLastRecords[i] is TransferRecord) { TransferRecord transferRecord = (TransferRecord)sortLastRecords[i]; string currentDestination, destinationObject; DestinationHelper.GetDestination(transferRecord, out currentDestination, out destinationObject); subs = new[] { lastDestination != "" ? "Transfered " + destinationObject + " from " + lastDestination + " to " + currentDestination : "Transfered " + destinationObject + " to " + currentDestination, UsefulMethods.NormalizeDate(transferRecord.TransferDate), transferRecord.OnLifelength.ToString(), "", "", transferRecord.Remarks, }; lastDestination = currentDestination; } else if (sortLastRecords[i] is ComponentLLPCategoryChangeRecord) { ComponentLLPCategoryChangeRecord llpRecord = (ComponentLLPCategoryChangeRecord)sortLastRecords[i]; LLPLifeLimitCategory toCategory = llpRecord.ToCategory; subs = new[] { "Changed to " + toCategory, UsefulMethods.NormalizeDate(llpRecord.RecordDate), llpRecord.OnLifelength.ToString(), "", "", llpRecord.Remarks, }; } else if (sortLastRecords[i] is ActualStateRecord) { ActualStateRecord actualStateRecord = (ActualStateRecord)sortLastRecords[i]; subs = new[] { "Actual state:", UsefulMethods.NormalizeDate(actualStateRecord.RecordDate.Date), actualStateRecord.OnLifelength != null ? actualStateRecord.OnLifelength.ToString() : "", "", "", actualStateRecord.Remarks, }; } else { subs = new[] { "Unknown record ", UsefulMethods.NormalizeDate(sortLastRecords[i].RecordDate), sortLastRecords[i].OnLifelength.ToString(), "", "", sortLastRecords[i].Remarks, }; } items.Add(new KeyValuePair <AbstractRecord, string[]>(sortLastRecords[i], subs)); } #endregion for (int i = items.Count - 1; i >= 0; i--) { WorkPackage workPackage = null; if (items[i].Key is AbstractPerformanceRecord) { var apr = items[i].Key as AbstractPerformanceRecord; workPackage = closedWorkPackages.FirstOrDefault(wp => wp.ItemId == apr.DirectivePackageId); } Invoke(new Action <AbstractRecord, string[], WorkPackage>(AddListViewItem), items[i].Key, items[i].Value, workPackage); } allWorkPackagesIncludedTask.Clear(); openPubWorkPackagesIncludedTask.Clear(); closedWorkPackages.Clear(); backgroundWorker.ReportProgress(100); }
/// <summary> /// Добавляет элементы в ListView /// </summary> /// <param name="itemsArray"></param> //protected override void AddItems(IBaseCoreObject[] itemsArray) //{ // ColumnHeader ch = ColumnHeaderList.FirstOrDefault(h => h.Text == "Performances"); // if (ch == null) // { // base.AddItems(itemsArray); // return; // } // if(itemsArray == null || itemsArray.Length == 0) // { // ch.Width = 0; // base.AddItems(itemsArray); // return; // } // ch.Width = itemsArray.OfType<IDirective>() // .Count(d => d.NextPerformances != null && d.NextPerformances.Count > 1) > 0 ? 100 : 0; // base.AddItems(itemsArray); //} #endregion #region protected override ListViewItem.ListViewSubItem[] GetListViewSubItems(IBaseCoreObject item) protected override List <CustomCell> GetListViewSubItems(IBaseEntityObject item) { var subItems = new List <CustomCell>(); DateTime? approx = null; AtaChapter ata; string maintenanceTypeString = ""; DateTime transferDate = DateTimeExtend.GetCASMinDateTime(); bool isPool = false, IsDangerous = false; Lifelength firstPerformance = Lifelength.Null, lastPerformance = Lifelength.Null, remains = null, next = null, warranty = Lifelength.Null, warrantyRemain = Lifelength.Null, repeatInterval = Lifelength.Null; string partNumber = "", description = "", altPartNumber = "", standart = "", name = "", refference = "", effectivity = "", serialNumber = "", code = "", classString = "", batchNumber = "", idNumber = "", supplier = ""; string status = "", location = "", facility = "", lastPerformanceString = "", kitRequieredString = "", remarks = "", hiddenRemarks = "", workType = "", timesString, quantityString = "", currentString = "", shouldBeOnStockString = "", from = "", id = "", quantityInString = "", author = "", currency = ""; double manHours = 0, unitPrice = 0, totalPrice = 0, shipPrice = 0, subTotal = 0, tax1 = 0, tax2 = 0, tax3 = 0, total = 0, quantity = 0, current = 0, quantityIn = 0, shouldBeOnStock = 0, needWpQuantity = 0, reserve = 0; int times, kitCount = 0; string position = ComponentStorePosition.UNK.ToString(); IDirective parent; if (item is NextPerformance) { NextPerformance np = (NextPerformance)item; parent = np.Parent; int index = np.Parent.NextPerformances.IndexOf(np); timesString = index == 0 ? np.Parent.TimesToString : "#" + (index + 1); times = index == 0 ? np.Parent.Times : index + 1; } else { parent = item as IDirective; if (parent == null) { return(subItems); } timesString = parent.TimesToString; times = parent.Times; } if (parent is Component) { Component componentItem = (Component)parent; id = componentItem.ItemId.ToString(); author = GlobalObjects.CasEnvironment.GetCorrector(componentItem); approx = componentItem.NextPerformanceDate; next = componentItem.NextPerformanceSource; remains = componentItem.Remains; ata = componentItem.Product?.ATAChapter ?? componentItem.ATAChapter; partNumber = componentItem.Product?.PartNumber ?? componentItem.PartNumber; altPartNumber = componentItem.Product?.AltPartNumber ?? componentItem.ALTPartNumber; standart = componentItem.Product?.Standart?.ToString() ?? componentItem.Standart?.ToString(); refference = componentItem.Product?.Reference; effectivity = componentItem.Product?.IsEffectivity; name = componentItem.Product?.Name; description = componentItem.Description; serialNumber = componentItem.SerialNumber; code = componentItem.Product != null ? componentItem.Product.Code :componentItem.Code; classString = componentItem.GoodsClass.ToString(); batchNumber = componentItem.BatchNumber; idNumber = componentItem.IdNumber; position = componentItem.TransferRecords.GetLast()?.State?.ToString(); status = componentItem.ComponentStatus.ToString(); location = componentItem.Location.ToString(); facility = componentItem.Location.LocationsType?.ToString() ?? LocationsType.Unknown.ToString(); maintenanceTypeString = componentItem.GoodsClass.IsNodeOrSubNodeOf(GoodsClass.ComponentsAndParts) ? componentItem.MaintenanceControlProcess.ShortName : componentItem.LifeLimit.IsNullOrZero() ? "" : MaintenanceControlProcess.HT.ShortName; transferDate = componentItem.TransferRecords.GetLast().TransferDate; firstPerformance = componentItem.LifeLimit; warranty = componentItem.Warranty; warrantyRemain = componentItem.NextPerformance?.WarrantlyRemains ?? Lifelength.Null; kitRequieredString = componentItem.Kits.Count > 0 ? componentItem.Kits.Count + " kits" : ""; kitCount = componentItem.Kits.Count; bool isComponent = componentItem.GoodsClass.IsNodeOrSubNodeOf(new IDictionaryTreeItem[] { GoodsClass.ComponentsAndParts, GoodsClass.ProductionAuxiliaryEquipment, }); quantity = isComponent && componentItem.ItemId > 0 ? 1 : componentItem.Quantity; quantityString = quantity.ToString(); quantityIn = isComponent && componentItem.ItemId > 0 ? 1 : componentItem.QuantityIn; quantityInString = $"{quantityIn:0.##}" + (componentItem.Measure != null ? " " + componentItem.Measure + "(s)" : "") + componentItem.Packing; needWpQuantity = Math.Round(componentItem.NeedWpQuantity, 2); reserve = quantity - needWpQuantity; shouldBeOnStock = componentItem.ShouldBeOnStock; shouldBeOnStockString = componentItem.ShouldBeOnStock > 0 ? "Yes" : "No"; manHours = componentItem.ManHours; remarks = componentItem.Remarks; hiddenRemarks = componentItem.HiddenRemarks; isPool = componentItem.IsPOOL; IsDangerous = componentItem.IsDangerous; supplier = componentItem.FromSupplier.ToString(); if (componentItem.ProductCosts.Count > 0) { var productost = componentItem.ProductCosts.FirstOrDefault(); unitPrice = productost.UnitPrice; totalPrice = productost.TotalPrice; shipPrice = productost.ShipPrice; subTotal = productost.SubTotal; tax1 = productost.Tax; tax2 = productost.Tax1; tax3 = productost.Tax2; total = productost.Total; currency = productost.Currency.ToString(); } TransferRecord tr = componentItem.TransferRecords.GetLast(); if (tr.FromAircraftId == 0 && tr.FromBaseComponentId == 0 && tr.FromStoreId == 0 && tr.FromSupplierId == 0 && tr.FromSpecialistId == 0) { from = componentItem.Suppliers.ToString(); } else { from = DestinationHelper.FromObjectString(tr); } } else if (parent is ComponentDirective) { ComponentDirective dd = (ComponentDirective)parent; author = GlobalObjects.CasEnvironment.GetCorrector(dd); if (dd.Threshold.FirstPerformanceSinceNew != null && !dd.Threshold.FirstPerformanceSinceNew.IsNullOrZero()) { firstPerformance = dd.Threshold.FirstPerformanceSinceNew; } if (dd.LastPerformance != null) { lastPerformanceString = SmartCore.Auxiliary.Convert.GetDateFormat(dd.LastPerformance.RecordDate) + " " + dd.LastPerformance.OnLifelength; lastPerformance = dd.LastPerformance.OnLifelength; } if (dd.Threshold.RepeatInterval != null && !dd.Threshold.RepeatInterval.IsNullOrZero()) { repeatInterval = dd.Threshold.RepeatInterval; } approx = dd.NextPerformanceDate; next = dd.NextPerformanceSource; remains = dd.Remains; ata = dd.ParentComponent.Product?.ATAChapter ?? dd.ParentComponent.ATAChapter; maintenanceTypeString = dd.ParentComponent.MaintenanceControlProcess.ShortName; warranty = dd.Threshold.Warranty; kitRequieredString = dd.Kits.Count > 0 ? dd.Kits.Count + " kits" : ""; kitCount = dd.Kits.Count; manHours = dd.ManHours; remarks = dd.Remarks; hiddenRemarks = dd.HiddenRemarks; workType = dd.DirectiveType.ToString(); position = " " + dd.ParentComponent.TransferRecords.GetLast()?.State?.ToString(); isPool = dd.IsPOOL; IsDangerous = dd.IsDangerous; partNumber = " " + (dd.ParentComponent.Product?.PartNumber ?? dd.ParentComponent.PartNumber); altPartNumber = " " + (dd.ParentComponent.Product?.AltPartNumber ?? dd.ParentComponent.ALTPartNumber); standart = dd.ParentComponent.Product?.Standart?.ToString() ?? dd.ParentComponent.Standart?.ToString(); name = " " + dd.ParentComponent.Product?.Name; description = " " + dd.ParentComponent.Description; serialNumber = " " + dd.ParentComponent.SerialNumber; classString = dd.ParentComponent.GoodsClass.ToString(); warrantyRemain = dd.NextPerformance?.WarrantlyRemains ?? Lifelength.Null; } else { ata = (AtaChapter)GlobalObjects.CasEnvironment.GetDictionary <AtaChapter>().GetItemById(21); } subItems.Add(CreateRow(id, id)); subItems.Add(CreateRow(ata.ToString(), ata)); subItems.Add(CreateRow(refference, refference)); subItems.Add(CreateRow(partNumber, partNumber)); subItems.Add(CreateRow(altPartNumber, altPartNumber)); subItems.Add(CreateRow(standart, standart)); subItems.Add(CreateRow(name, name)); subItems.Add(CreateRow(description, description)); subItems.Add(CreateRow(serialNumber, serialNumber)); subItems.Add(CreateRow(classString, classString)); subItems.Add(CreateRow(batchNumber, batchNumber)); subItems.Add(CreateRow(idNumber, idNumber)); subItems.Add(CreateRow(position.ToUpper(), position)); subItems.Add(CreateRow(status, status)); subItems.Add(CreateRow(location, location)); subItems.Add(CreateRow(facility, facility)); subItems.Add(CreateRow(from, from)); subItems.Add(CreateRow(transferDate > DateTimeExtend.GetCASMinDateTime() ? SmartCore.Auxiliary.Convert.GetDateFormat(transferDate) : "", transferDate)); subItems.Add(CreateRow(workType, workType)); subItems.Add(CreateRow(needWpQuantity.ToString(), needWpQuantity)); subItems.Add(CreateRow(reserve.ToString(), reserve)); subItems.Add(CreateRow(quantityString, quantity)); subItems.Add(CreateRow(shouldBeOnStockString, shouldBeOnStock)); subItems.Add(CreateRow(quantityInString, quantityIn)); subItems.Add(CreateRow(unitPrice.ToString(), unitPrice)); subItems.Add(CreateRow(totalPrice.ToString(), totalPrice)); subItems.Add(CreateRow(shipPrice.ToString(), shipPrice)); subItems.Add(CreateRow(subTotal.ToString(), subTotal)); subItems.Add(CreateRow(tax1.ToString(), tax1)); subItems.Add(CreateRow(tax2.ToString(), tax2)); subItems.Add(CreateRow(tax3.ToString(), tax3)); subItems.Add(CreateRow(total.ToString(), total)); subItems.Add(CreateRow(currency, currency)); subItems.Add(CreateRow(supplier, supplier)); subItems.Add(CreateRow(code, code)); subItems.Add(CreateRow(remarks, remarks)); subItems.Add(CreateRow(effectivity, effectivity)); subItems.Add(CreateRow(isPool ? "Yes" : "No", isPool)); subItems.Add(CreateRow(IsDangerous ? "Yes" : "No", IsDangerous)); subItems.Add(CreateRow(maintenanceTypeString, maintenanceTypeString)); subItems.Add(CreateRow(manHours.ToString(), manHours)); subItems.Add(CreateRow(firstPerformance.ToString(), firstPerformance)); subItems.Add(CreateRow(repeatInterval.ToString(), repeatInterval)); subItems.Add(CreateRow(timesString, times)); subItems.Add(CreateRow(approx != null ? SmartCore.Auxiliary.Convert.GetDateFormat((DateTime)approx) + " " + next : next != null && !next.IsNullOrZero() ? next.ToString() : "", approx == null ? DateTimeExtend.GetCASMinDateTime() : (DateTime)approx)); subItems.Add(CreateRow(remains != null && !remains.IsNullOrZero() ? remains.ToString() : "", remains ?? Lifelength.Null)); subItems.Add(CreateRow(lastPerformanceString, lastPerformance)); subItems.Add(CreateRow(warranty.ToString(), warranty)); subItems.Add(CreateRow(warrantyRemain.ToString(), warrantyRemain)); subItems.Add(CreateRow(kitRequieredString, kitCount)); subItems.Add(CreateRow(hiddenRemarks, hiddenRemarks)); subItems.Add(CreateRow(author, author)); return(subItems); }
/// <summary> /// Данные у директивы обновляются по введенным данным /// </summary> /// <param name="destinationDefferedItem">Директива</param> /// <param name="changePageName">Менять ли название вкладки</param> public void ApplyChanges(DeferredItem destinationDefferedItem, bool changePageName) { textboxTitle.Focus(); if (destinationDefferedItem == null) { throw new ArgumentNullException("destinationDefferedItem"); } destinationDefferedItem.ATAChapter = ATAChapter; if (CurrentDefferedCategory != null && CurrentDefferedCategory != destinationDefferedItem.DeferredCategory) { destinationDefferedItem.DeferredCategory = CurrentDefferedCategory; } destinationDefferedItem.ADType = (ADType)(radioButtonAirFrame.Checked ? 0 : 1); if (destinationDefferedItem.Title != Title) { destinationDefferedItem.Title = Title; if (changePageName) { string caption = ""; if (destinationDefferedItem.ParentBaseComponent != null) { //TODO:(Evgenii Babak) Использовать DestinationHelper var baseComponent = destinationDefferedItem.ParentBaseComponent; if (baseComponent.BaseComponentTypeId == BaseComponentType.Frame.ItemId) { //у Frame всегда есть ParentAircraftId caption = $"{DestinationHelper.GetDestinationStringFromAircraft(baseComponent.ParentAircraftId, false, null)}. {destinationDefferedItem.DirectiveType.CommonName}. {destinationDefferedItem.Title}"; } else { if (baseComponent.ParentAircraftId > 0) { caption = $"{DestinationHelper.GetDestinationStringFromAircraft(baseComponent.ParentAircraftId, false, null)}. "; } else if (baseComponent.ParentStoreId > 0) { caption = $"{DestinationHelper.GetDestinationStringFromStore(baseComponent.ParentStoreId, null, true)}. "; } caption += baseComponent + ". " + destinationDefferedItem.DirectiveType.CommonName + ". " + destinationDefferedItem.Title; } } if (DisplayerRequested != null) { DisplayerRequested(this, new ReferenceEventArgs(null, ReflectionTypes.ChangeTextOfContainingDisplayer, caption)); } } } destinationDefferedItem.HiddenRemarks = HiddenRemarks; destinationDefferedItem.Threshold.EffectiveDate = EffectiveDate; destinationDefferedItem.ServiceBulletinNo = ServiceBulletin; destinationDefferedItem.EngineeringOrders = EngOrderNumber; destinationDefferedItem.Applicability = Applicability; destinationDefferedItem.Description = Subject; destinationDefferedItem.DeferredLogBookRef = LogBookReferences; destinationDefferedItem.DeferredMelCdlItem = MelCdlItem; destinationDefferedItem.DeferredExtention = Extention; destinationDefferedItem.Remarks = Remarks; if (fileControlSB.GetChangeStatus()) { fileControlSB.ApplyChanges(); fileControlSB.Save(); destinationDefferedItem.ServiceBulletinFile = fileControlSB.AttachedFile; } if (fileControlEO.GetChangeStatus()) { fileControlEO.ApplyChanges(); fileControlEO.Save(); destinationDefferedItem.EngineeringOrderFile = fileControlEO.AttachedFile; } if (fileControlADNo.GetChangeStatus()) { fileControlADNo.ApplyChanges(); fileControlADNo.Save(); destinationDefferedItem.ADNoFile = fileControlADNo.AttachedFile; } }
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; } }
private void HeaderControlPrintButtonDisplayerRequested(object sender, Interfaces.ReferenceEventArgs e) { BaseComponent baseComponent; Operator reportedOperator; var reportedDetail = _currentComponent; var directiveList = new List <ComponentDirective>(_currentComponent.ComponentDirectives.ToArray()); if (_currentComponent is BaseComponent) { baseComponent = (BaseComponent)_currentComponent; var parentAircraft = GlobalObjects.AircraftsCore.GetAircraftById(baseComponent.ParentAircraftId); var parentStore = GlobalObjects.StoreCore.GetStoreById(baseComponent.ParentStoreId); reportedOperator = parentAircraft != null ? GlobalObjects.CasEnvironment.Operators.First(o => o.ItemId == parentAircraft.OperatorId) : parentStore.Operator; } else { baseComponent = _currentComponent.ParentBaseComponent; //TODO:(Evgenii Babak) заменить на использование ComponentCore if (baseComponent == null) { return; } var parentAircraft = GlobalObjects.AircraftsCore.GetAircraftById(baseComponent.ParentAircraftId); var parentStore = GlobalObjects.StoreCore.GetStoreById(baseComponent.ParentStoreId); reportedOperator = parentAircraft != null ? GlobalObjects.CasEnvironment.Operators.First(o => o.ItemId == parentAircraft.OperatorId) : parentStore.Operator; } var caption = $"{DestinationHelper.GetDestinationObjectString(baseComponent)}. Compliance List"; if (sender == _itemPrintReportEngineRecords) { var selection = ""; var header = ""; var trust = ""; if (baseComponent.BaseComponentType == BaseComponentType.Frame) { selection = "All"; header = "FRAME"; } if (baseComponent.BaseComponentType == BaseComponentType.LandingGear) { selection = baseComponent.TransferRecords.GetLast().Position; header = "LANDING GEAR"; } if (baseComponent.BaseComponentType == BaseComponentType.Engine) { selection = BaseComponentType.Engine + " " + baseComponent.TransferRecords.GetLast().Position; header = "ENGINE"; trust = $"Thrust: {baseComponent.Thrust}"; } if (baseComponent.BaseComponentType == BaseComponentType.Apu) { selection = BaseComponentType.Apu.ToString(); header = "APU"; } var builder = new ComponentTasksReportBuilderNew(header, trust); e.DisplayerText = caption; e.TypeOfReflection = ReflectionTypes.DisplayInNew; builder.DateAsOf = DateTime.Today.ToString(new GlobalTermsProvider()["DateFormat"].ToString()); builder.ReportedComponent = reportedDetail; builder.OperatorLogotype = reportedOperator.LogoTypeWhite; builder.FilterSelection = selection; builder.AddDirectives(directiveList.ToArray()); builder.ForecastData = null; e.RequestedEntity = new ReportScreen(builder); } else { var builder = new ComponentTasksReportBuilder(); e.DisplayerText = caption; e.TypeOfReflection = ReflectionTypes.DisplayInNew; builder.DateAsOf = DateTime.Today.ToString(new GlobalTermsProvider()["DateFormat"].ToString()); builder.ReportedComponent = reportedDetail; builder.OperatorLogotype = reportedOperator.LogoTypeWhite; if (baseComponent.BaseComponentType == BaseComponentType.Frame) { var selection = "All"; builder.FilterSelection = selection; builder.AddDirectives(directiveList.ToArray()); builder.ForecastData = null; e.RequestedEntity = new ReportScreen(builder); } else { var selection = ""; if (baseComponent.BaseComponentType == BaseComponentType.LandingGear) { selection = baseComponent.TransferRecords.GetLast().Position; } if (baseComponent.BaseComponentType == BaseComponentType.Engine) { selection = BaseComponentType.Engine + " " + baseComponent.TransferRecords.GetLast().Position; } if (baseComponent.BaseComponentType == BaseComponentType.Apu) { selection = BaseComponentType.Apu.ToString(); } builder.LifelengthAircraftSinceNew = GlobalObjects.CasEnvironment.Calculator.GetCurrentFlightLifelength(CurrentAircraft); builder.FilterSelection = selection; builder.AddDirectives(directiveList.ToArray()); builder.ForecastData = null; e.RequestedEntity = new ReportScreen(builder); } } }
/// <summary> /// Данные у директивы обновляются по введенным данным /// </summary> /// <param name="destinationOutOfPhaseItem">Директива</param> /// <param name="changePageName">Менять ли название вкладки</param> public void ApplyChanges(Directive destinationOutOfPhaseItem, bool changePageName) { textboxTitle.Focus(); if (destinationOutOfPhaseItem == null) { throw new ArgumentNullException("destinationOutOfPhaseItem"); } destinationOutOfPhaseItem.ATAChapter = ATAChapter; if (destinationOutOfPhaseItem.Title != Title) { destinationOutOfPhaseItem.Title = Title; if (changePageName) { var caption = ""; if (destinationOutOfPhaseItem.ParentBaseComponent != null) { var baseComponent = destinationOutOfPhaseItem.ParentBaseComponent; if (baseComponent.BaseComponentTypeId == BaseComponentType.Frame.ItemId) { //у Frame всегда есть ParentAircraftId caption = $"{DestinationHelper.GetDestinationStringFromAircraft(baseComponent.ParentAircraftId, false, null)}. {destinationOutOfPhaseItem.DirectiveType.CommonName}. {destinationOutOfPhaseItem.Title}"; } else { if (baseComponent.ParentAircraftId > 0) { caption = $"{DestinationHelper.GetDestinationStringFromAircraft(baseComponent.ParentAircraftId, false, null)}. "; } else if (baseComponent.ParentStoreId > 0) { caption = $"{DestinationHelper.GetDestinationStringFromStore(baseComponent.ParentStoreId, null, true)}. "; } caption += baseComponent + ". " + destinationOutOfPhaseItem.DirectiveType.CommonName + ". " + destinationOutOfPhaseItem.Title; } } if (DisplayerRequested != null) { DisplayerRequested(this, new ReferenceEventArgs(null, ReflectionTypes.ChangeTextOfContainingDisplayer, caption)); } } } destinationOutOfPhaseItem.HiddenRemarks = HiddenRemarks; destinationOutOfPhaseItem.Threshold.EffectiveDate = EffectiveDate; destinationOutOfPhaseItem.ServiceBulletinNo = ServiceBulletin; destinationOutOfPhaseItem.EngineeringOrders = EngOrderNumber; //if (destinationOutOfPhaseItem.Applicability != Applicability) destinationOutOfPhaseItem.Applicability = Applicability; destinationOutOfPhaseItem.Description = Subject; destinationOutOfPhaseItem.Remarks = Remarks; if (fileControlSB.GetChangeStatus()) { fileControlSB.ApplyChanges(); fileControlSB.Save(); destinationOutOfPhaseItem.ServiceBulletinFile = fileControlSB.AttachedFile; } if (fileControlEO.GetChangeStatus()) { fileControlEO.ApplyChanges(); fileControlEO.Save(); destinationOutOfPhaseItem.EngineeringOrderFile = fileControlEO.AttachedFile; } if (fileControlADNo.GetChangeStatus()) { fileControlADNo.ApplyChanges(); fileControlADNo.Save(); destinationOutOfPhaseItem.ADNoFile = fileControlADNo.AttachedFile; } }
/// <summary> /// Данные у директивы обновляются по введенным данным /// </summary> /// <param name="directive">Директива</param> /// <param name="changePageName">Менять ли название вкладки</param> public void ApplyChanges(Directive directive, bool changePageName) { textboxTitle.Focus(); if (directive == null) { throw new ArgumentNullException("directive"); } directive.ATAChapter = ATAChapter; if (directive.Title != Title) { directive.Title = Title; if (changePageName /*&& destinationDirective.ExistAtDataBase*/) { string caption = ""; if (directive.ParentBaseComponent != null) { var baseComponent = directive.ParentBaseComponent; if (baseComponent.BaseComponentTypeId == BaseComponentType.Frame.ItemId) { //у Frame всегда есть ParentAircraftId caption = $"{DestinationHelper.GetDestinationStringFromAircraft(baseComponent.ParentAircraftId, false, null)}. {directive.DirectiveType.CommonName}. {directive.Title}"; } else { if (baseComponent.ParentAircraftId > 0) { caption = $"{DestinationHelper.GetDestinationStringFromAircraft(baseComponent.ParentAircraftId, false, null)}. "; } else if (baseComponent.ParentStoreId > 0) { caption = $"{DestinationHelper.GetDestinationStringFromStore(baseComponent.ParentStoreId, null, true)}. "; } caption += baseComponent + ". " + directive.DirectiveType.CommonName + ". " + directive.Title; } } if (DisplayerRequested != null) { DisplayerRequested(this, new ReferenceEventArgs(null, ReflectionTypes.ChangeTextOfContainingDisplayer, caption)); } } } directive.HiddenRemarks = HiddenRemarks; directive.Threshold.EffectiveDate = EffectiveDate; directive.StcNo = STCApplicability; directive.EngineeringOrders = EngOrderNumber; directive.ServiceBulletinNo = ServiceBulletin; directive.ADType = ADType; directive.SBType = SBType; directive.Description = Subject; directive.Remarks = Remarks; directive.SBSubjects = SBSubject; directive.IsApplicability = checkBoxIsApplicability.Checked; directive.Applicability = Applicability; if (checkBoxIsApplicability.Checked) { directive.Applicability = directive.Applicability.Replace("APL", "").TrimStart(); } else { directive.Applicability = directive.Applicability.Replace("N/A", "").TrimStart(); } if (fileControlSB.GetChangeStatus()) { fileControlSB.ApplyChanges(); directive.ServiceBulletinFile = fileControlSB.AttachedFile; } if (attachedFileControlSTC.GetChangeStatus()) { attachedFileControlSTC.ApplyChanges(); directive.STCFile = attachedFileControlSTC.AttachedFile; } if (fileControlEO.GetChangeStatus()) { fileControlEO.ApplyChanges(); directive.EngineeringOrderFile = fileControlEO.AttachedFile; } if (fileControlADNo.GetChangeStatus()) { fileControlADNo.ApplyChanges(); directive.ADNoFile = fileControlADNo.AttachedFile; } }
public MainForm(CopyDataTransport dataTransport) { instance = this; // Make sure we never capture the mainform WindowDetails.RegisterIgnoreHandle(this.Handle); // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); this.Icon = GreenshotPlugin.Core.GreenshotResources.getGreenshotIcon(); IniConfig.IniChanged += new FileSystemEventHandler(ReloadConfiguration); tooltip = new ToolTip(); UpdateUI(); // Do loading on a different Thread to shorten the startup Thread pluginInitThread = new Thread(delegate() { // Load all the plugins PluginHelper.instance.LoadPlugins(this); // Check destinations, remove all that don't exist foreach (string destination in conf.OutputDestinations.ToArray()) { if (DestinationHelper.GetDestination(destination) == null) { conf.OutputDestinations.Remove(destination); } } // we should have at least one! if (conf.OutputDestinations.Count == 0) { conf.OutputDestinations.Add(Destinations.EditorDestination.DESIGNATION); } BeginInvoke((MethodInvoker) delegate { // Do after all plugins & finding the destination, otherwise they are missing! InitializeQuickSettingsMenu(); }); }); pluginInitThread.Name = "Initialize plug-ins"; pluginInitThread.IsBackground = true; pluginInitThread.Start(); SoundHelper.Initialize(); // Create a new instance of the class: copyData = new CopyData(); copyData = new CopyData(); // Assign the handle: copyData.AssignHandle(this.Handle); // Create the channel to send on: copyData.Channels.Add("Greenshot"); // Hook up received event: copyData.CopyDataReceived += new CopyDataReceivedEventHandler(CopyDataDataReceived); if (dataTransport != null) { HandleDataTransport(dataTransport); } }
///<summary> ///обновление информации в контроле ///</summary> public void UpdateInformation() { if (_parentType != null) { if (_parentType == SmartCoreType.Aircraft) { ButtonAdd.TextMain = "Add to aircraft "; ButtonAdd.TextSecondary = "components"; ButtonDelete.TextMain = "Delete from aircraft "; ButtonDelete.TextSecondary = "components"; } if (_parentType == SmartCoreType.Store) { ButtonAdd.TextMain = "Add to store "; ButtonAdd.TextSecondary = "components"; ButtonDelete.TextMain = "Delete from store "; ButtonDelete.TextSecondary = "components"; } if (_parentType == SmartCoreType.Supplier) { ButtonAdd.TextMain = "Add to supplier "; ButtonAdd.TextSecondary = "components"; ButtonDelete.TextMain = "Delete from supplier "; ButtonDelete.TextSecondary = "components"; } if (_parentType == SmartCoreType.Employee) { ButtonAdd.TextMain = "Add to employee "; ButtonAdd.TextSecondary = "components"; ButtonDelete.TextMain = "Delete from employee "; ButtonDelete.TextSecondary = "components"; } } listViewTransferedDetails.Items.Clear(); if (((_removedComponents.Count == 0 && _removedTransfers.Count == 0) || _removedComponents.Count != _removedTransfers.Count) && ((_waitremovedConfirmComponents.Count == 0 && _waitRemovedTransfers.Count == 0) || _waitremovedConfirmComponents.Count != _waitRemovedTransfers.Count) && ((_installedComponents.Count == 0 && _installedTransfers.Count == 0) || _installedComponents.Count != _installedTransfers.Count)) { return; } if ((_installedComponents.Count > 0 && _removedComponents.Count > 0) || (_waitremovedConfirmComponents.Count > 0 && _removedComponents.Count > 0) || (_waitremovedConfirmComponents.Count > 0 && _installedComponents.Count > 0)) { Text = "Transfered Details"; ButtonDelete.Enabled = true; ButtonCancel.Enabled = true; ButtonAdd.Enabled = true; listViewTransferedDetails.ShowGroups = true; } else if (_waitremovedConfirmComponents.Count > 0) { Text = "Wait remove confirm"; ButtonDelete.Enabled = false; ButtonCancel.Enabled = true; ButtonAdd.Enabled = false; listViewTransferedDetails.ShowGroups = false; } else if (_removedComponents.Count > 0) { Text = "Last removed details"; ButtonDelete.Enabled = true; ButtonCancel.Enabled = false; ButtonAdd.Enabled = false; listViewTransferedDetails.ShowGroups = false; } else if (_installedComponents.Count > 0) { Text = "Last installed details"; ButtonDelete.Enabled = false; ButtonCancel.Enabled = false; ButtonAdd.Enabled = true; listViewTransferedDetails.ShowGroups = false; } string[] subs; ListViewItem newItem; string lastDestination, currentDestination; TransferRecord record; for (int i = 0; i < _waitremovedConfirmComponents.Count; i++) { record = _waitRemovedTransfers.GetRecordByComponentId(_waitremovedConfirmComponents[i].ItemId); DestinationHelper.GetPreviosAndCurrentDestination(record, out lastDestination, out currentDestination); subs = new [] { _waitremovedConfirmComponents[i].Description + " P/N:" + _waitremovedConfirmComponents[i].PartNumber + " S/N:" + _waitremovedConfirmComponents[i].SerialNumber, "From " + lastDestination + " to " + currentDestination, record.TransferDate.ToString(), }; newItem = new ListViewItem(subs); newItem.Tag = _waitremovedConfirmComponents[i]; newItem.Group = listViewTransferedDetails.Groups[2]; listViewTransferedDetails.Items.Add(newItem); } for (int i = 0; i < _removedComponents.Count; i++) { record = _removedTransfers.GetRecordByComponentId(_removedComponents[i].ItemId); DestinationHelper.GetPreviosAndCurrentDestination(record, out lastDestination, out currentDestination); subs = new [] { _removedComponents[i].Description + " P/N:" + _removedComponents[i].PartNumber + " S/N:" + _removedComponents[i].SerialNumber, "From " + lastDestination + " to " + currentDestination, record.TransferDate.ToString(), }; newItem = new ListViewItem(subs); newItem.Tag = _removedComponents[i]; newItem.Group = listViewTransferedDetails.Groups[0]; listViewTransferedDetails.Items.Add(newItem); } for (int i = 0; i < _installedComponents.Count; i++) { record = _installedTransfers.GetRecordByComponentId(_installedComponents[i].ItemId); DestinationHelper.GetPreviosAndCurrentDestination(record, out lastDestination, out currentDestination); subs = new [] { _installedComponents[i].Description + " P/N:" + _installedComponents[i].PartNumber + " S/N:" + _installedComponents[i].SerialNumber, "From " + lastDestination + " to " + currentDestination, record.TransferDate.ToString(), }; newItem = new ListViewItem(subs); newItem.Tag = _installedComponents[i]; newItem.Group = listViewTransferedDetails.Groups[1]; listViewTransferedDetails.Items.Add(newItem); } }