/// <summary> /// Производит выгруску ресурсов страницы /// </summary> public override void DisposeScreen() { if (AnimatedThreadWorker.IsBusy) { AnimatedThreadWorker.CancelAsync(); } AnimatedThreadWorker.Dispose(); if (_initialDirectiveArray != null) { _initialDirectiveArray.Clear(); } _initialDirectiveArray = null; if (_resultDirectiveArray != null) { _resultDirectiveArray.Clear(); } _resultDirectiveArray = null; _openPubQuotations.Clear(); _openPubQuotations = null; if (_toolStripMenuItemOpen != null) { _toolStripMenuItemOpen.Dispose(); } if (_directivesViewer != null) { _directivesViewer.Dispose(); } Dispose(true); }
private void AnimatedThreadWorkerDoLoad(object sender, DoWorkEventArgs e) { if (_maintenanceCheck == null || _currentAircraft == null) { e.Cancel = true; return; } if (_bindedDirectives == null) { _bindedDirectives = new CommonCollection <MaintenanceDirective>(); } _bindedDirectives.Clear(); _animatedThreadWorker.ReportProgress(0, "load binded tasks"); _bindedDirectives.AddRange(_maintenanceCheck.BindMpds.ToArray()); _mpdForSelect = _allDirectives.Where(mpd => mpd.MaintenanceCheck == null); if (_animatedThreadWorker.CancellationPending) { e.Cancel = true; return; } _animatedThreadWorker.ReportProgress(100, "binding complete"); }
/// <summary> /// Конструктор создает объект с привязкой родительского объекта /// </summary> public Product(Product toCopy) : this() { if (toCopy == null) return; _batchNumber = toCopy.BatchNumber; _costNew = toCopy.CostNew; _costOvehaul = toCopy.CostOverhaul; _costServiceable = toCopy.CostServiceable; _description = toCopy.Description; _manufacturer = toCopy.Manufacturer; _measure = toCopy.Measure; _partNumber = toCopy.PartNumber; _remarks = toCopy.Remarks; _serialNumber = toCopy.SerialNumber; _standart = toCopy.Standart; if (_suppliers == null) _suppliers = new SupplierCollection(); _suppliers.Clear(); foreach (Supplier supplier in toCopy.Suppliers) { _suppliers.Add(supplier); } if (_supplierRelations == null) _supplierRelations = new CommonCollection<KitSuppliersRelation>(); _supplierRelations.Clear(); foreach (KitSuppliersRelation ksr in toCopy.SupplierRelations) { _supplierRelations.Add(new KitSuppliersRelation(ksr) {KitId = ItemId}); } }
///<summary> /// Cоздается графический элемент на основе данной коллекции ///</summary> ///<param name="storesCollection">Данная бизнес коллекция</param> public HangarCollectionControl(CommonCollection <Hangar> storesCollection) { waitForm = StaticWaitFormProvider.WaitForm; extendableRichContainer.Caption = storesCollection.Count + " Hangars"; _itemsollection = storesCollection; FillUiElementsFromCollection(); }
public override void DisposeScreen() { if (AnimatedThreadWorker.IsBusy) { AnimatedThreadWorker.CancelAsync(); } AnimatedThreadWorker.Dispose(); _initialDirectiveArray.Clear(); _initialDirectiveArray = null; if (_toolStripMenuItemOpen != null) { _toolStripMenuItemOpen.Dispose(); } if (_toolStripMenuItemHighlight != null) { _toolStripMenuItemHighlight.Dispose(); } if (_toolStripSeparator2 != null) { _toolStripSeparator2.Dispose(); } if (_directivesViewer != null) { _directivesViewer.Dispose(); } Dispose(true); }
protected override void CreateWorkPakage() { var selectedItems = new CommonCollection <NonRoutineJob>(); foreach (NonRoutineJob o in DirectivesViewer.SelectedItems) { selectedItems.CompareAndAdd(o); } try { string message; var wp = GlobalObjects.WorkPackageCore.AddWorkPakage(selectedItems, CurrentAircraft, out message); if (wp == null) { MessageBox.Show(message, (string)new GlobalTermsProvider()["SystemName"], MessageBoxButtons.OK, MessageBoxIcon.Error); return; } base.AddWorkPackageToContextMenu(wp); var refArgs = new ReferenceEventArgs { TypeOfReflection = ReflectionTypes.DisplayInNew, DisplayerText = CurrentAircraft != null ? CurrentAircraft.RegistrationNumber + "." + wp.Title : wp.Title, RequestedEntity = new WorkPackageScreen(wp) }; InvokeDisplayerRequested(refArgs); } catch (Exception ex) { Program.Provider.Logger.Log("error while create Work Package", ex); } }
/* * Методы */ #region public Forecast() /// <summary> /// Прогноз на будущее - выступает в роли контейнера всех объектов системы Cas /// </summary> public Forecast() { // Создаем все коллекции ForecastDatas = new List <ForecastData>(); // BaseComponents = new BaseComponentCollection(); BaseComponentDirectives = new CommonCollection <ComponentDirective>(); Components = new ComponentCollection(); ComponentDirectives = new CommonCollection <ComponentDirective>(); AdStatus = new DirectiveCollection(); Damages = new DirectiveCollection(); DefferedItems = new DirectiveCollection(); EngineeringOrders = new DirectiveCollection(); ModificationStatus = new DirectiveCollection(); OutOfPhaseItems = new DirectiveCollection(); ServiceBulletins = new DirectiveCollection(); MaintenanceChecks = new List <MaintenanceCheck>(); MaintenanceDirectives = new List <MaintenanceDirective>(); Kits = new List <AccessoryRequired>(); DirectiveCollections = new Dictionary <DirectiveType, DirectiveCollection> { { DirectiveType.AirworthenessDirectives, AdStatus }, { DirectiveType.DamagesRequiring, Damages }, { DirectiveType.DeferredItems, DefferedItems }, { DirectiveType.EngineeringOrders, EngineeringOrders }, { DirectiveType.ModificationStatus, ModificationStatus }, { DirectiveType.OutOfPhase, OutOfPhaseItems }, { DirectiveType.SB, ServiceBulletins } }; }
public CAAUserForm(CAAUser user, CommonCollection <Specialist> specialists) { InitializeComponent(); _user = user; _specialists = specialists; UpdateInformation(); }
private void ButtonDeleteClick(object sender, EventArgs e) { CommonCollection <Hangar> stores = new CommonCollection <Hangar>(); foreach (ReferenceStatusImageLinkLabel item in _controlItems) { stores.Add((Hangar)item.Tag); } CommonDeletingForm cdf = new CommonDeletingForm(typeof(Hangar), stores); if (cdf.ShowDialog() == DialogResult.OK) { if (cdf.DeletedObjects.Count == 0) { return; } foreach (BaseEntityObject o in cdf.DeletedObjects) { Hangar s = o as Hangar; if (s != null) { _itemsollection.Remove(s); } } FillUiElementsFromCollection(); } }
public void UpdateControl(CommonCollection <CAAEducationManagment> initialDocumentArray, Operator @operator, List <CAAEducationRecord> records) { _managmentListView.DisableEdit = true; _managmentListView.CurrentOperator = @operator; _managmentListView.SortDirection = SortDirection.Asc; _managmentListView.OldColumnIndex = 12; _managmentListView.SetItemsArray(initialDocumentArray.ToArray()); var last = new List <LastComplianceView>(); foreach (var record in records) { foreach (var comp in record.Settings.LastCompliances.OrderByDescending(i => i.LastDate)) { last.Add(new LastComplianceView() { Record = record, Course = record.Education?.Task?.FullName, LastCompliance = comp, Group = "Last compliance" }); } } listViewCompliance.SetItemsArray(last.ToArray()); listViewCompliance.IsEditable = false; }
/* * Методы */ #region public Directive() /// <summary> /// Создает директиву без дополнительной информации /// </summary> public Directive() { SmartCoreObjectType = SmartCoreType.Directive; // Задаем все String Title = Remarks = Applicability = Description = EngineeringOrders = KitRequired = HiddenRemarks = ""; ATAChapter = new AtaChapter { ItemId = -1 }; IsClosed = false; // Ad директива DirectiveType = DirectiveType.AirworthenessDirectives; // тип работ данной директивы WorkType = DirectiveWorkType.Inspection; // Задаем все String Title = Remarks = EngineeringOrders = Paragraph = KitRequired = HiddenRemarks = ""; // Создаем объекты, чтобы они были не null _threshold = new DirectiveThreshold(); // Создаем колелкции _performanceRecords = new BaseRecordCollection <DirectiveRecord>(); Kits = new CommonCollection <AccessoryRequired>(); NDTType = NDTType.UNK; PrintInWorkPackage = true; }
private void InitListView() { var col = new CommonCollection <ATLB>(GlobalObjects.AircraftFlightsCore.GetATLBsByAircraftId(CurrentAircraft.ItemId)); _directivesViewer = new MouthlyUtilizationListView(CurrentAircraft, col); _directivesViewer.TabIndex = 2; _directivesViewer.Location = new Point(panel1.Left, panel1.Top); _directivesViewer.Dock = DockStyle.Fill; _directivesViewer.SelectedItemsChanged += DirectivesViewerSelectedItemsChanged; Controls.Add(_directivesViewer); _directivesViewer.AddMenuItems(_toolStripMenuItemOpen, _toolStripSeparator1, _toolStripMenuItemHighlight); _directivesViewer.MenuOpeningAction = () => { if (_directivesViewer.SelectedItems.Count <= 0) { return; } if (_directivesViewer.SelectedItems.Count == 1) { _toolStripMenuItemOpen.Enabled = true; } }; panel1.Controls.Add(_directivesViewer); }
private void ButtonDeleteClick(object sender, EventArgs e) { if (listViewBindedTasks.SelectedItems.Count == 0) { return; } //Коллекция элементов которые нужно добавить в элемента управления содержащий список всех задач var itemsToInsert = new CommonCollection <BaseEntityObject>(); var detailDirectives = listViewBindedTasks.SelectedItems.OfType <ComponentDirective>().ToList(); foreach (var selectedItem in detailDirectives) { try { //Если задача по компоненту была сохранена в бд , то добавляем в список удаляемых элементов if (selectedItem.ItemId > 0) { itemsToInsert.Add(selectedItem); _bindedItemsToRemove.Add(selectedItem); } //Удаление задачи по компоненту из коллекции содержащей все связаные задачи _bindedItems.Remove(selectedItem); //Удаление задачи по компоненту из элемента управления содержащего список всех привязаных задач listViewBindedTasks.RemoveItem(selectedItem); //если в коллекции содержащей все связные задачи не содержится задач по компоненту, //которые принадлежат тому же компоненту что и текущая задача //требуется удалить компонент из коллекции содержащей все связные задачи if (_bindedItems.OfType <ComponentDirective>().All(x => x.ParentComponent.ItemId != selectedItem.ParentComponent.ItemId)) { _bindedItems.Remove(selectedItem.ParentComponent); //Удаление компонента из элемента управления содержащего список всех привязаных задач listViewBindedTasks.RemoveItem(selectedItem.ParentComponent); } if (_newBindedItems.ContainsKey(selectedItem.ParentComponent)) { //Удаление задачи по компоненту из коллекции новых привязанных зачач по компоненту _newBindedItems[selectedItem.ParentComponent].Remove(selectedItem); //Если среди новых привязанных задач по компоненту не содержатся задачи по компонентам, //которые принадлежат тому же компоненту что и текущая задача //требуется удалить компонент из словаря if (_newBindedItems[selectedItem.ParentComponent].Count == 0) { _newBindedItems.Remove(selectedItem.ParentComponent); } } } catch (Exception ex) { Program.Provider.Logger.Log("Error while delete bind task record", ex); } } listViewTasksForSelect.InsertItems(itemsToInsert); }
/// <summary> /// Создает нерутинную работу без дополнительной информации /// </summary> public NonRoutineJob() { ItemId = -1; SmartCoreObjectType = SmartCoreType.NonRoutineJob; Kits = new CommonCollection <AccessoryRequired>(); PrintInWorkPackage = true; }
public override void SetItemsArray(ICommonCollection itemsArray) { if (_selectedItemsList == null) { _selectedItemsList = new CommonCollection <BaseEntityObject>(); } base.SetItemsArray(itemsArray); }
public override void DisposeScreen() { if (AnimatedThreadWorker.IsBusy) { AnimatedThreadWorker.CancelAsync(); } AnimatedThreadWorker.DoWork -= AnimatedThreadWorkerDoWork; AnimatedThreadWorker.RunWorkerCompleted -= AnimatedThreadWorkerRunWorkerCompleted; AnimatedThreadWorker.Dispose(); _initialDirectiveArray.Clear(); _resultDirectiveArray.Clear(); _openPubWorkPackages.Clear(); _initialDirectiveArray = null; _resultDirectiveArray = null; _openPubWorkPackages = null; if (_currentForecast != null) { _currentForecast.Dispose(); _currentForecast = null; } if (_currentForecast != null) { _currentForecast.Clear(); } _currentForecast = null; if (_toolStripMenuItemOpen != null) { _toolStripMenuItemOpen.Dispose(); } if (_toolStripMenuItemHighlight != null) { foreach (var ttmi in _toolStripMenuItemHighlight.Items) { ttmi.Click -= HighlightItemClick; } _toolStripMenuItemHighlight.Items.Clear(); _toolStripMenuItemHighlight.Dispose(); } if (_toolStripSeparator1 != null) { _toolStripSeparator1.Dispose(); } if (_directivesViewer != null) { _directivesViewer.Dispose(); } Dispose(true); }
/* * Методы */ #region public EventType() /// <summary> /// Создает директиву без дополнительной информации /// </summary> public SmsEventType() { SmartCoreObjectType = SmartCoreType.SmsEventType; //задаем все ID в -1 ItemId = -1; _fullName = ""; _description = ""; _changeRecords = new BaseRecordCollection <EventTypeRiskLevelChangeRecord>(); _eventConditions = new CommonCollection <EventCondition>(); }
/* * Методы */ #region public Event() /// <summary> /// Создает событие без дополнительной информации /// </summary> public Event() { //задаем все ID в -1 ItemId = -1; SmartCoreObjectType = SmartCoreType.SmsEvent; _recordDate = DateTime.Today; _eventConditions = new CommonCollection <EventCondition>(); EventStatus = SmsEventStatus.Discovered; }
public AuditTeamForm(CommonCollection <Specialist> specialists, int auditId) { InitializeComponent(); _specialists = specialists; _auditId = auditId; _animatedThreadWorker.DoWork += AnimatedThreadWorkerDoLoad; _animatedThreadWorker.RunWorkerCompleted += BackgroundWorkerRunWorkerLoadCompleted; _animatedThreadWorker.RunWorkerAsync(); }
public PelItemForm(int auditId, int operatorId, CommonCollection <CheckLists> initialDocumentArray) { InitializeComponent(); _auditId = auditId; _operatorId = operatorId; _addedChecks.AddRange(initialDocumentArray.ToArray()); _animatedThreadWorker.DoWork += AnimatedThreadWorkerDoLoad; _animatedThreadWorker.RunWorkerCompleted += BackgroundWorkerRunWorkerLoadCompleted; _animatedThreadWorker.RunWorkerAsync(); }
public CheckListRevisionEditForm(int operatorId, CheckListRevision parent, CommonCollection <CheckLists> added, SmartCore.CAA.StandartManual.StandartManual manual) { _operatorId = operatorId; _parent = parent; _manual = manual; _updateChecks.AddRange(added.ToList()); InitializeComponent(); _animatedThreadWorker.DoWork += AnimatedThreadWorkerDoLoad; _animatedThreadWorker.RunWorkerCompleted += BackgroundWorkerRunWorkerLoadCompleted; _animatedThreadWorker.RunWorkerAsync(); }
///<summary> ///</summary> public SelectMPDComplianceForm(IEnumerable <MaintenanceDirective> maintenanceDirectives) : this() { if (_mpdsForSelect == null) { _mpdsForSelect = new CommonCollection <MaintenanceDirective>(); } _mpdsForSelect.AddRange(maintenanceDirectives); UpdateInformation(); }
/* * Методы */ #region public ComponentDirective() /// <summary> /// Создает воздушное судно без дополнительной информации /// </summary> public ComponentDirective() { SmartCoreObjectType = SmartCoreType.ComponentDirective; FaaFormFileId = -1; ItemId = -1; NDTType = NDTType.UNK; _performanceRecords = new BaseRecordCollection <DirectiveRecord>(); _nextPerformances = new List <NextPerformance>(); Kits = new CommonCollection <AccessoryRequired>(); PrintInWorkPackage = true; }
/* * Методы */ #region public BaseComponent() /// <summary> /// Создает воздушное судно без дополнительной информации /// </summary> public BaseComponent() { ItemId = -1; IsBaseComponent = true; AverageUtilization = new AverageUtilization(); manufactureDate = DateTimeExtend.GetCASMinDateTime(); SmartCoreObjectType = SmartCoreType.BaseComponent; // Мат аппарат // OpeningLifelengthCalculated = new LifelengthCollection(); //LifelengthCalculated = new LifelengthCollection(); ComponentWorkParams = new CommonCollection <ComponentWorkInRegimeParams>(); }
/* * Методы */ #region public MaintenanceCheck() public MaintenanceCheck() { _grouping = true; _subResource = LifelengthSubResource.Hours; SmartCoreObjectType = SmartCoreType.MaintenanceCheck; ItemId = -1; Kits = new CommonCollection <AccessoryRequired>(); _threshold = new MaintenanceCheckThreshold(); _nextPerformances = new List <NextPerformance>(); PrintInWorkPackage = true; }
public override void DisposeScreen() { if (AnimatedThreadWorker.IsBusy) { AnimatedThreadWorker.CancelAsync(); } AnimatedThreadWorker.Dispose(); if (InitialDirectiveArray != null) { InitialDirectiveArray.Clear(); } InitialDirectiveArray = null; if (ResultDirectiveArray != null) { ResultDirectiveArray.Clear(); } ResultDirectiveArray = null; if (_currentForecast != null) { _currentForecast.Dispose(); } _currentForecast = null; if (_openPubWorkPackages != null) { _openPubWorkPackages.Clear(); } _openPubWorkPackages = null; _openPubQuotations.Clear(); _openPubQuotations = null; if (_toolStripMenuItemsWorkPackages != null) { foreach (var item in _toolStripMenuItemsWorkPackages.Items) { item.Click -= AddToWorkPackageItemClick; } _toolStripMenuItemsWorkPackages.Items.Clear(); _toolStripMenuItemsWorkPackages.Dispose(); } if (DirectivesViewer != null) { DirectivesViewer.Dispose(); } Dispose(true); }
///<summary> ///</summary> ///<param name="initialCollection"></param> ///<param name="resultCollection"></param> private void FilterItems(CommonCollection <AircraftFlight> initialCollection, CommonCollection <AircraftFlight> resultCollection) { if (_filter == null || _filter.All(i => i.Values.Length == 0)) { resultCollection.Clear(); foreach (var flight in initialCollection) { resultCollection.Add(flight); } return; } resultCollection.Clear(); foreach (var pd in initialCollection) { if (_filter.FilterTypeAnd) { bool acceptable = true; foreach (ICommonFilter filter in _filter) { acceptable = filter.Acceptable(pd); if (!acceptable) { break; } } if (acceptable) { resultCollection.Add(pd); } } else { bool acceptable = true; foreach (ICommonFilter filter in _filter) { if (filter.Values == null || filter.Values.Length == 0) { continue; } acceptable = filter.Acceptable(pd); if (acceptable) { break; } } if (acceptable) { resultCollection.Add(pd); } } } }
private void AnimatedThreadWorkerDoLoad(object sender, DoWorkEventArgs e) { if (_currentDirectivePackage == null) { e.Cancel = true; return; } if (_itemsForSelect == null) { _itemsForSelect = new CommonCollection <BaseEntityObject>(); } _itemsForSelect.Clear(); _animatedThreadWorker.ReportProgress(0, "load binded tasks"); try { _itemsForSelect.AddRange(GlobalObjects.DirectiveCore.GetDirectivesByDirectiveType(DirectiveType.AirworthenessDirectives.ItemId).ToArray()); _itemsForSelect.AddRange(GlobalObjects.ComponentCore.GetComponents().ToArray()); _itemsForSelect.AddRange(GlobalObjects.CasEnvironment.NewLoader.GetObjectListAll <MaintenanceDirectiveDTO, MaintenanceDirective>().ToArray()); _itemsForSelect.AddRange(GlobalObjects.CasEnvironment.NewLoader.GetObjectListAll <MaintenanceCheckDTO, MaintenanceCheck>().ToArray()); _itemsForSelect.AddRange(GlobalObjects.CasEnvironment.NewLoader.GetObjectListAll <NonRoutineJobDTO, NonRoutineJob>().ToArray()); foreach (BaseDirectivePackageRecord pr in _currentDirectivePackage.PackageRecords.OfType <BaseDirectivePackageRecord>()) { _itemsForSelect.Remove(_itemsForSelect.FirstOrDefault(i => i.SmartCoreObjectType == pr.PackageItemType && i.ItemId == pr.DirectiveId)); } //Определение списка привязанных задач и компонентов } catch (Exception ex) { Program.Provider.Logger.Log("Error while load Items For Select for Directive Package Form", ex); } if (_animatedThreadWorker.CancellationPending) { e.Cancel = true; return; } _animatedThreadWorker.ReportProgress(75, "calculate directives for select"); if (_animatedThreadWorker.CancellationPending) { e.Cancel = true; return; } _animatedThreadWorker.ReportProgress(100, "binding complete"); }
protected override void AnimatedThreadWorkerDoWork(object sender, DoWorkEventArgs e) { #region Загрузка элементов if (InitialDirectiveArray == null) { InitialDirectiveArray = new CommonCollection <StockComponentInfo>(); } InitialDirectiveArray.Clear(); AnimatedThreadWorker.ReportProgress(0, "load records"); try { InitialDirectiveArray.AddRange(GlobalObjects.CasEnvironment.NewLoader.GetObjectListAll <StockComponentInfoDTO, StockComponentInfo>(new Filter("StoreID", CurrentStore.ItemId), true)); } catch (Exception exception) { Program.Provider.Logger.Log("Error while load records", exception); } AnimatedThreadWorker.ReportProgress(40, "Calculate records"); try { //TODO: раньше было так я стал передавать компоненты из списка вроде быстрее но не совсем верное решение //GlobalObjects.StockCalculator.CalculateStock(InitialDirectiveArray.OfType<StockComponentInfo>(), CurrentStore); GlobalObjects.StockCalculator.CalculateStock(_resultCollection.ToArray(), InitialDirectiveArray.OfType <StockComponentInfo>()); } catch (Exception exception) { Program.Provider.Logger.Log("Error while calculate records", exception); } #region Фильтрация директив AnimatedThreadWorker.ReportProgress(70, "filter records"); FilterItems(InitialDirectiveArray, ResultDirectiveArray); if (AnimatedThreadWorker.CancellationPending) { e.Cancel = true; return; } #endregion AnimatedThreadWorker.ReportProgress(100, "Complete"); #endregion }
public void UpdateControl(Dictionary <int, Lifelength> groupLifelengths, CommonCollection <IMtopCalc> maintenanceDirectives, List <MTOPCheck> maintenanceChecks) { Controls.Clear(); mtopDirectiveListView1 = new MTOPDirectiveListView(groupLifelengths, maintenanceChecks) { Location = new Point(0, 0), Size = new Size(1310, 400) }; Controls.Add(mtopDirectiveListView1); mtopDirectiveListView1.SetItemsArray(maintenanceDirectives.ToArray()); mtopDirectiveListView1.radGridView1.MasterTemplate.CollapseAllGroups(); }