Beispiel #1
0
        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");
        }
Beispiel #2
0
        private void ExportActivityWork(object sender, DoWorkEventArgs e)
        {
            _worker.ReportProgress(0, "load Activity");
            _worker.ReportProgress(0, "Generate file! Please wait....");

            _exportProvider = new ExcelExportProvider();
            _exportProvider.ExportActivity(_result.ToList());
        }
Beispiel #3
0
        private void ExportDirectiveWork(object sender, DoWorkEventArgs e)
        {
            _worker.ReportProgress(0, "load Directive");
            _worker.ReportProgress(0, "Generate file! Please wait....");

            _exportProvider = new ExcelExportProvider();
            _exportProvider.ExportDirective(_resultDirectiveArray.ToList());
        }
Beispiel #4
0
        private void AnimatedThreadWorkerDoLoad(object sender, DoWorkEventArgs e)
        {
            _animatedThreadWorker.ReportProgress(0, "Loading");

            _schedulePeriods.AddRange(GlobalObjects.CasEnvironment.NewLoader.GetObjectListAll <SchedulePeriodDTO, SchedulePeriods>());

            _animatedThreadWorker.ReportProgress(100, "Loading complete");
        }
Beispiel #5
0
        private void AnimatedThreadWorkerDoLoad(object sender, DoWorkEventArgs e)
        {
            _suppliers.Clear();

            _animatedThreadWorker.ReportProgress(0, "Loading");

            _suppliers.AddRange(GlobalObjects.CasEnvironment.NewLoader.GetObjectList <SupplierDTO, Supplier>());

            _animatedThreadWorker.ReportProgress(100, "Loading complete");
        }
        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");
        }
Beispiel #7
0
        private void AnimatedThreadWorkerDoLoad(object sender, DoWorkEventArgs e)
        {
            if (_currentDocument == null)
            {
                return;
            }

            parentDocs.Clear();
            _suppliers.Clear();

            _animatedThreadWorker.ReportProgress(0, "Loading");

            if (_currentDocument.ItemId <= 0 && _currentDocument.IssueDateValidTo == DateTimeExtend.GetCASMinDateTime() && _loadTemplate)
            {
                if (_parent is Operator)
                {
                    parentDocs = GlobalObjects.DocumentCore.GetDocuments(_parent, DocumentType.Other, true);
                }
                else if (_parent is Specialist || _parent is Supplier)
                {
                    parentDocs = GlobalObjects.DocumentCore.GetDocumentsByParentType(_parent, DocumentType.Other);
                }
                else
                {
                    parentDocs = GlobalObjects.DocumentCore.GetDocuments(_parent.SmartCoreObjectType, DocumentType.Other, true);
                }
            }

            var links = GlobalObjects.CasEnvironment.NewLoader.GetObjectListAll <ItemFileLinkDTO, ItemFileLink>(new List <Filter>()
            {
                new Filter("ParentId", _currentDocument.ItemId),
                new Filter("ParentTypeId", _currentDocument.SmartCoreObjectType.ItemId)
            }, true);

            _currentDocument.Files.AddRange(links);

            _animatedThreadWorker.ReportProgress(80, "Loading Suppliers");
            _suppliers.AddRange(GlobalObjects.CasEnvironment.NewLoader.GetObjectListAll <SupplierDTO, Supplier>());

            var q = _suppliers.Where(i => i.Name == null);

            foreach (var supplier in q)
            {
                GlobalObjects.CasEnvironment.Keeper.Delete(supplier);
            }

            _animatedThreadWorker.ReportProgress(100, "Loading complete");
        }
Beispiel #8
0
        protected override void AnimatedThreadWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            _initialDocumentArray.Clear();
            _resultDocumentArray.Clear();

            AnimatedThreadWorker.ReportProgress(0, "load directives");


            if (_operatorId == -1)
            {
                _initialDocumentArray.AddRange(GlobalObjects.CaaEnvironment.NewLoader
                                               .GetObjectListAll <FindingLevelsDTO, FindingLevels>());
            }
            else
            {
                _initialDocumentArray.AddRange(GlobalObjects.CaaEnvironment.NewLoader
                                               .GetObjectListAll <FindingLevelsDTO, FindingLevels>(new Filter("OperatorId", _operatorId)));
            }

            AnimatedThreadWorker.ReportProgress(70, "filter directives");

            FilterItems(_initialDocumentArray, _resultDocumentArray);

            AnimatedThreadWorker.ReportProgress(100, "Complete");
        }
Beispiel #9
0
        protected override void AnimatedThreadWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            _initialDirectiveArray.Clear();
            _resultDirectiveArray.Clear();

            AnimatedThreadWorker.ReportProgress(0, "load Work Packages");

            _initialDirectiveArray.AddRange(GlobalObjects.WorkPackageCore.GetWorkPackages(CurrentAircraft).ToArray());

            var airports  = GlobalObjects.CasEnvironment.GetDictionary <AirportsCodes>();
            var flightNum = GlobalObjects.CasEnvironment.GetDictionary <FlightNum>();

            foreach (var wp in _initialDirectiveArray)
            {
                wp.PerfAfter.AirportFrom = (AirportsCodes)airports.GetItemById(wp.PerfAfter.AirportFromId);
                wp.PerfAfter.AirportTo   = (AirportsCodes)airports.GetItemById(wp.PerfAfter.AirportToId);
                wp.PerfAfter.FlightNum   = (FlightNum)flightNum.GetItemById(wp.PerfAfter.FlightNumId);
            }

            AnimatedThreadWorker.ReportProgress(40, "filter directives");

            AnimatedThreadWorker.ReportProgress(70, "filter directives");

            FilterItems(_initialDirectiveArray, _resultDirectiveArray);

            AnimatedThreadWorker.ReportProgress(100, "Complete");
        }
Beispiel #10
0
        private void AnimatedThreadWorkerDoFilteringWork(object sender, DoWorkEventArgs e)
        {
            _resultDirectiveArray.Clear();

            #region Фильтрация директив
            AnimatedThreadWorker.ReportProgress(50, "filter directives");

            AdditionalFilterItems(_preResultDirectiveArray, _resultDirectiveArray);

            var component = new List <Component>();

            if (_resultDirectiveArray.All(c => c is ComponentDirective))
            {
                foreach (ComponentDirective cd in _resultDirectiveArray)
                {
                    component.Add(cd.ParentComponent);
                }
            }

            _resultDirectiveArray.AddRange(component.ToArray());

            if (AnimatedThreadWorker.CancellationPending)
            {
                e.Cancel = true;
                return;
            }
            #endregion

            AnimatedThreadWorker.ReportProgress(100, "Complete");
        }
Beispiel #11
0
        private void ExportActivity_Click(object sender, EventArgs eventArgs)
        {
            _worker.ReportProgress(0, "Generate file! Please wait....");

            _exportProvider = new ExcelExportProvider();
            _exportProvider.ExportShouldBeOnStock(InitialDirectiveArray.OfType <StockComponentInfo>().ToList());
        }
Beispiel #12
0
        protected override void AnimatedThreadWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            _initialDocumentArray.Clear();
            _resultDocumentArray.Clear();

            AnimatedThreadWorker.ReportProgress(0, "load");
            _initialDocumentArray.AddRange(GlobalObjects.CaaEnvironment.NewLoader.GetObjectList <CheckListRevisionDTO, CheckListRevision>(new []
            {
                new Filter("OperatorId", _operatorId),
                new Filter("ManualId", _manual.ItemId)
            }));

            foreach (var revision in _initialDocumentArray.Where(i => i.Type == RevisionType.Revision))
            {
                revision.CurrentStatus = _initialDocumentArray.FirstOrDefault(i => i.ItemId == revision.EditionId).Status;
            }

            foreach (var edition in _initialDocumentArray.Where(i => i.Type == RevisionType.Edition))
            {
                edition.CurrentStatus = edition.Status;
            }

            AnimatedThreadWorker.ReportProgress(70, "filter directives");

            FilterItems(_initialDocumentArray, _resultDocumentArray);

            AnimatedThreadWorker.ReportProgress(100, "Complete");
        }
Beispiel #13
0
        protected override void AnimatedThreadWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            AnimatedThreadWorker.ReportProgress(0, "Load");

            if (_educationManagment.Record != null && _educationManagment.Record.ItemId > 0)
            {
                _educationManagment.Record = GlobalObjects.CaaEnvironment.NewLoader
                                             .GetObjectById <EducationRecordsDTO, CAAEducationRecord>(_educationManagment.Record.ItemId);
            }
            else
            {
                _educationManagment.Record = new CAAEducationRecord()
                {
                    EducationId  = _educationManagment.Education.ItemId,
                    OccupationId = _educationManagment.Occupation.ItemId,
                    SpecialistId = _educationManagment.Specialist.ItemId,
                    OperatorId   = _educationManagment.Specialist.OperatorId,
                    PriorityId   = _educationManagment.Education.Priority.ItemId,
                    Settings     = new CAAEducationRecordSettings()
                    {
                        IsCombination = _educationManagment.IsCombination,
                    }
                };
            }

            _educationManagment.Record.Education = _educationManagment.Education;

            AnimatedThreadWorker.ReportProgress(40, "Calculation");
            EducationCalculator.CalculateEducation(_educationManagment.Record);
            AnimatedThreadWorker.ReportProgress(100, "Complete");
        }
Beispiel #14
0
        protected override void AnimatedThreadWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            #region Загрузка элементов

            AnimatedThreadWorker.ReportProgress(0, "load directives");

            try
            {
                if (_currentDirective.ItemId > 0)
                {
                    _currentDirective = GlobalObjects.AircraftFlightsCore.GetFlightNumberById(_currentDirective.ItemId, true);
                }
            }
            catch (Exception ex)
            {
                Program.Provider.Logger.Log("Error while loading directives", ex);
            }

            if (AnimatedThreadWorker.CancellationPending)
            {
                e.Cancel = true;
                return;
            }
            #endregion

            _schedulePeriods.Clear();
            _schedulePeriods.AddRange(GlobalObjects.CasEnvironment.NewLoader.GetObjectListAll <SchedulePeriodDTO, SchedulePeriods>());

            AnimatedThreadWorker.ReportProgress(100, "Complete");
        }
Beispiel #15
0
        protected override async void AnimatedThreadWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            _initial.Clear();
            _specialists.Clear();
            _result.Clear();

            AnimatedThreadWorker.ReportProgress(0, "load documents");

            try
            {
                var userDto = GlobalObjects.CasEnvironment.ApiProvider.GetAllUsersAsync();
                _initial.AddRange(userDto.Select(i => new User(i)));

                _specialists.AddRange(GlobalObjects.CasEnvironment.NewLoader.GetObjectList <SpecialistDTO, Specialist>());
                foreach (var user in _initial)
                {
                    user.Personnel = _specialists.FirstOrDefault(i => i.ItemId == user.PersonnelId) ??
                                     Specialist.Unknown;
                }
            }
            catch (Exception ex)
            {
                Program.Provider.Logger.Log("Error while load documents", ex);
            }

            AnimatedThreadWorker.ReportProgress(20, "calculation documents");

            AnimatedThreadWorker.ReportProgress(70, "filter documents");
            FilterItems(_initial, _result);

            AnimatedThreadWorker.ReportProgress(100, "Complete");
        }
Beispiel #16
0
        protected override void AnimatedThreadWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            #region Загрузка элементов

            AnimatedThreadWorker.ReportProgress(0, "load directives");

            try
            {
                if (_currentItem.ItemId > 0 && (_needReload || !_currentItem.PackageItemsLoaded))
                {
                    _currentItem =
                        GlobalObjects.PackageCore.GetDirectivePackage <WorkOrder, WorkOrderRecord>(_currentItem.ItemId, true);
                }
            }
            catch (Exception ex)
            {
                Program.Provider.Logger.Log("Error while loading directives", ex);
            }

            if (AnimatedThreadWorker.CancellationPending)
            {
                e.Cancel = true;
                return;
            }
            #endregion

            #region Калькуляция состояния директив

            AnimatedThreadWorker.ReportProgress(40, "calculation of directives");

            if (AnimatedThreadWorker.CancellationPending)
            {
                e.Cancel = true;
                return;
            }
            #endregion

            #region Фильтрация директив
            AnimatedThreadWorker.ReportProgress(70, "filter directives");

            if (AnimatedThreadWorker.CancellationPending)
            {
                e.Cancel = true;
                return;
            }
            #endregion

            #region Сравнение с рабочими пакетами

            AnimatedThreadWorker.ReportProgress(90, "comparison with the Work Packages");

            if (AnimatedThreadWorker.CancellationPending)
            {
                e.Cancel = true;
                return;
            }
            #endregion

            AnimatedThreadWorker.ReportProgress(100, "Complete");
        }
        protected override void AnimatedThreadWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            _initialDirectiveArray.Clear();

            AnimatedThreadWorker.ReportProgress(0, "load Fligths");

            GlobalObjects.AircraftFlightsCore.LoadAircraftFlights(CurrentAircraft.ItemId);

            var flights = GlobalObjects.AircraftFlightsCore.GetAircraftFlightsByAircraftId(CurrentAircraft.ItemId);

            _initialDirectiveArray.AddRange(flights.Where(t => t.FlightDate >= dateTimePickerDateFrom.Value &&
                                                          t.FlightDate <= dateTimePickerDateTo.Value));
            _maintenanceChecks = new List <MaintenanceCheck>(GlobalObjects.CasEnvironment.NewLoader.GetObjectListAll <MaintenanceCheckDTO, MaintenanceCheck>(new List <Filter>()
            {
                new Filter("ParentAircraft", CurrentAircraft.ItemId),
                new Filter("Grouping", true)
            }, true));
            AnimatedThreadWorker.ReportProgress(40, "filter Fligths");

            AnimatedThreadWorker.ReportProgress(70, "filter Fligths");

            FilterItems(_initialDirectiveArray, _resultDirectiveArray);

            AnimatedThreadWorker.ReportProgress(100, "Complete");
        }
Beispiel #18
0
        private void AnimatedThreadWorkerDoFilteringWork(object sender, DoWorkEventArgs e)
        {
            _resultMaintenanceDirectives.Clear();
            _resultZeroMaintenanceDirectives.Clear();

            #region Фильтрация директив

            AnimatedThreadWorker.ReportProgress(50, "filter directives");

            FilterItems(_initialMaintenanceDirectives, _resultMaintenanceDirectives);

            if (AnimatedThreadWorker.CancellationPending)
            {
                e.Cancel = true;
                return;
            }


            AnimatedThreadWorker.ReportProgress(90, "filter records");

            FilterZeroItems(_initialZeroMaintenanceDirectives, _resultZeroMaintenanceDirectives);

            if (AnimatedThreadWorker.CancellationPending)
            {
                e.Cancel = true;
                return;
            }

            #endregion

            AnimatedThreadWorker.ReportProgress(100, "Complete");
        }
        protected override void AnimatedThreadWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            if (_parent == null)
            {
                return;
            }
            _initialArray.Clear();
            _resultArray.Clear();

            AnimatedThreadWorker.ReportProgress(0, "load Quotations");

            try
            {
                if (filter != null)
                {
                    _initialArray.AddRange(GlobalObjects.CasEnvironment.NewLoader.GetObjectList <InitialOrderDTO, InitialOrder>(filter));
                }
                else
                {
                    _initialArray.AddRange(GlobalObjects.CasEnvironment.NewLoader.GetObjectList <InitialOrderDTO, InitialOrder>());
                }
            }
            catch (Exception ex)
            {
                Program.Provider.Logger.Log("Error while load Quotations", ex);
            }

            AnimatedThreadWorker.ReportProgress(20, "calculation Quotations");

            AnimatedThreadWorker.ReportProgress(70, "filter Quotations");
            FilterItems(_initialArray, _resultArray);
            AnimatedThreadWorker.ReportProgress(100, "Complete");
        }
Beispiel #20
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void AnimatedThreadWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            _itemsArray.Clear();

            AnimatedThreadWorker.ReportProgress(0, "load directives");

            if (GlobalObjects.CasEnvironment != null)
            {
                _itemsArray.AddRange(GlobalObjects.CasEnvironment.GetDictionary <Occupation>());
            }
            else
            {
                //_itemsArray.AddRange(GlobalObjects.CaaEnvironment.GetDictionary<Specialization>());
                var res = GlobalObjects.CaaEnvironment.NewLoader.GetObjectListAll <CAASpecializationDTO, Occupation>(
                    new Filter("OperatorId", _operatorId));

                foreach (var specialization in res)
                {
                    _itemsArray.Add(specialization);
                }
            }

            AnimatedThreadWorker.ReportProgress(40, "filter directives");

            AnimatedThreadWorker.ReportProgress(70, "filter directives");

            //FilterItems(_itemsArray);

            AnimatedThreadWorker.ReportProgress(100, "Complete");
        }
Beispiel #21
0
        protected override void AnimatedThreadWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            _initialDirectiveArray.Clear();
            _resultDirectiveArray.Clear();

            AnimatedThreadWorker.ReportProgress(0, "load Work Packages");

            var discrip = GlobalObjects.DiscrepanciesCore.GetDiscrepancies(@from: dateTimePickerDateFrom.Value, to: dateTimePickerDateTo.Value).ToArray();

            _initialDirectiveArray.AddRange(discrip);

            foreach (var discrepancy in _initialDirectiveArray)
            {
                discrepancy.Aircraft = GlobalObjects.AircraftsCore.GetAircraftById(discrepancy.ParentFlight.AircraftId);
            }


            AnimatedThreadWorker.ReportProgress(40, "filter directives");

            AnimatedThreadWorker.ReportProgress(70, "filter directives");

            FilterItems(_initialDirectiveArray, _resultDirectiveArray);

            AnimatedThreadWorker.ReportProgress(100, "Complete");
        }
Beispiel #22
0
        protected override void AnimatedThreadWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            if (_parent == null)
            {
                return;
            }
            _initialDocumentArray.Clear();
            _resultDocumentArray.Clear();

            AnimatedThreadWorker.ReportProgress(0, "load documents");

            try
            {
                GlobalObjects.CaaEnvironment.NewLoader.ReloadDictionary(typeof(DocumentSubType), typeof(ServiceType), typeof(Nomenclatures), typeof(Department), typeof(Occupation));

                _initialDocumentArray.AddRange(GlobalObjects
                                               .CaaEnvironment
                                               .NewLoader
                                               .GetObjectListAll <DocumentDTO, SmartCore.Entities.General.Document>(new Filter("OperatorId", FilterType.Equal, _operatorId), true));
            }
            catch (Exception ex)
            {
                Program.Provider.Logger.Log("Error while load documents", ex);
            }

            AnimatedThreadWorker.ReportProgress(20, "calculation documents");

            AnimatedThreadWorker.ReportProgress(70, "filter documents");
            FilterItems(_initialDocumentArray, _resultDocumentArray);

            AnimatedThreadWorker.ReportProgress(100, "Complete");
        }
Beispiel #23
0
        protected override void AnimatedThreadWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            _initialDirectiveArray.Clear();
            _resultDirectiveArray.Clear();
            AnimatedThreadWorker.ReportProgress(0, "load directives");

            if (!string.IsNullOrEmpty(TextBoxFilter.Text))
            {
                var dir = new List <Directive>();

                try
                {
                    dir.AddRange(GlobalObjects.DirectiveCore.GetDirectivesFromAllAircrafts(DirectiveType.AirworthenessDirectives, TextBoxFilter.Text, TextBoxFilterParagraph.Text));
                }
                catch (Exception ex)
                {
                    Program.Provider.Logger.Log("Error while loading directives", ex);
                }


                AnimatedThreadWorker.ReportProgress(40, "filter directives");

                #region Калькуляция состояния директив

                AnimatedThreadWorker.ReportProgress(60, "calculation of directives");

                foreach (Directive pd in dir)
                {
                    var aircrraft =
                        GlobalObjects.AircraftsCore.GetAircraftById(pd.ParentBaseComponent?.ParentAircraftId ?? -1);

                    if (aircrraft != null)
                    {
                        GlobalObjects.MTOPCalculator.CalculateDirectiveNew(pd);
                        _initialDirectiveArray.Add(pd);
                    }
                }

                AnimatedThreadWorker.ReportProgress(70, "filter directives");

                FilterItems(_initialDirectiveArray, _resultDirectiveArray);

                if (AnimatedThreadWorker.CancellationPending)
                {
                    e.Cancel = true;
                    return;
                }


                if (AnimatedThreadWorker.CancellationPending)
                {
                    e.Cancel = true;
                    return;
                }
                #endregion

                AnimatedThreadWorker.ReportProgress(100, "Complete");
            }
        }
Beispiel #24
0
        private void AnimatedThreadWorkerDoLoad(object sender, DoWorkEventArgs e)
        {
            _suppliers.Clear();
            _departments.Clear();
            _specialists.Clear();
            _specializations.Clear();

            _animatedThreadWorker.ReportProgress(0, "Loading");

            _suppliers.AddRange(GlobalObjects.CasEnvironment.NewLoader.GetObjectList <SupplierDTO, Supplier>());
            _departments.AddRange(GlobalObjects.CasEnvironment.NewLoader.GetObjectList <DepartmentDTO, Department>());
            _specialists.AddRange(GlobalObjects.CasEnvironment.NewLoader.GetObjectList <SpecialistDTO, Specialist>());
            _specializations.AddRange(GlobalObjects.CasEnvironment.NewLoader.GetObjectList <SpecializationDTO, Occupation>());
            _nomenclatures.AddRange(GlobalObjects.CasEnvironment.NewLoader.GetObjectList <NomenclatureDTO, Nomenclatures>());

            _animatedThreadWorker.ReportProgress(100, "Loading complete");
        }
        private void AnimatedThreadWorkerDoLoad(object sender, DoWorkEventArgs e)
        {
            if (_supplier == null)
            {
                e.Cancel = true;
                return;
            }

            if (_tasksForSelect == null)
            {
                _tasksForSelect = new CommonCollection <Product>();
            }
            _tasksForSelect.Clear();

            if (_bindedTasks == null)
            {
                _bindedTasks = new CommonCollection <KitSuppliersRelation>();
            }
            _bindedTasks.Clear();

            _animatedThreadWorker.ReportProgress(0, "load binded tasks");
            try
            {
                _tasksForSelect.AddRange(GlobalObjects.CasEnvironment.NewLoader.GetObjectListAll <AccessoryDescriptionDTO, Product>(new Filter("ModelingObjectTypeId", -1), true));

                List <Product> supplierProducts = GlobalObjects.PurchaseCore.GetProducts(_supplier);
                foreach (Product supplierProduct in supplierProducts)
                {
                    _tasksForSelect.RemoveById(supplierProduct.ItemId);
                    _bindedTasks.Add(supplierProduct.SupplierRelations.FirstOrDefault(ksr => ksr.SupplierId == _supplier.ItemId));
                }
            }
            catch (Exception ex)
            {
                string s = $"Error while load Products For selection for supplier {_supplier} id: {_supplier.ItemId}";
                Program.Provider.Logger.Log(s, ex);
            }

            if (_animatedThreadWorker.CancellationPending)
            {
                e.Cancel = true;
                return;
            }

            _animatedThreadWorker.ReportProgress(100, "binding complete");
        }
        private void ExportATLBWork(object sender, DoWorkEventArgs e)
        {
            AnimatedThreadWorker.ReportProgress(0, "load ATLB");
            _worker.ReportProgress(0, "Generate file! Please wait....");

            _exportProvider = new ExcelExportProvider();

            _exportProvider.ExportATLB();
        }
Beispiel #27
0
        protected override void AnimatedThreadWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            _initialDirectiveArray.Clear();
            _resultDirectiveArray.Clear();

            AnimatedThreadWorker.ReportProgress(0, "load Work Packages");

            if (_flag)
            {
                _initialDirectiveArray.AddRange(GlobalObjects.WorkPackageCore.GetWorkPackages(null, WorkPackageStatus.Opened).ToArray());
                _initialDirectiveArray.AddRange(GlobalObjects.WorkPackageCore.GetWorkPackages(null, WorkPackageStatus.Published).ToArray());
            }
            else
            {
                _initialDirectiveArray.AddRange(GlobalObjects.WorkPackageCore.GetWorkPackages().ToArray());
            }


            var airports  = GlobalObjects.CasEnvironment.GetDictionary <AirportsCodes>();
            var flightNum = GlobalObjects.CasEnvironment.GetDictionary <FlightNum>();

            foreach (var wp in _initialDirectiveArray)
            {
                wp.PerfAfter.AirportFrom = (AirportsCodes)airports.GetItemById(wp.PerfAfter.AirportFromId);
                wp.PerfAfter.AirportTo   = (AirportsCodes)airports.GetItemById(wp.PerfAfter.AirportToId);
                wp.PerfAfter.FlightNum   = (FlightNum)flightNum.GetItemById(wp.PerfAfter.FlightNumId);
            }

            AnimatedThreadWorker.ReportProgress(30, "calculation Work Packages");

            if (AnimatedThreadWorker.CancellationPending)
            {
                e.Cancel = true;
                return;
            }

            foreach (WorkPackage workPackage in _initialDirectiveArray)
            {
                //if(workPackage.Status != WorkPackageStatus.Closed)
                //    GlobalObjects.CasEnvironment.Manipulator.GetWorkPackageItemsWithCalculate(workPackage);
                workPackage.AircraftCurrentLifelenght =
                    GlobalObjects.CasEnvironment.Calculator.GetCurrentFlightLifelength(workPackage.Aircraft);
            }


            AnimatedThreadWorker.ReportProgress(70, "filter directives");

            if (AnimatedThreadWorker.CancellationPending)
            {
                e.Cancel = true;
                return;
            }

            FilterItems(_initialDirectiveArray, _resultDirectiveArray);

            AnimatedThreadWorker.ReportProgress(100, "Complete");
        }
Beispiel #28
0
        private void AnimatedThreadWorkerDoFilteringWork(object sender, DoWorkEventArgs e)
        {
            _resultDocumentArray.Clear();

            #region Фильтрация директив
            AnimatedThreadWorker.ReportProgress(50, "filter directives");

            FilterItems(_initialDocumentArray, _resultDocumentArray);

            if (AnimatedThreadWorker.CancellationPending)
            {
                e.Cancel = true;
                return;
            }
            #endregion

            AnimatedThreadWorker.ReportProgress(100, "Complete");
        }
Beispiel #29
0
        protected override void AnimatedThreadWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            _result.Clear();
            _initial.Clear();
            var mtopDirectives = new List <IMtopCalc>();

            AnimatedThreadWorker.ReportProgress(10, "load Directives");


            var baseComponents      = GlobalObjects.ComponentCore.GetAicraftBaseComponents(CurrentAircraft.ItemId);
            var components          = GlobalObjects.ComponentCore.GetComponents(baseComponents.ToList());
            var componentDirectives = components.SelectMany(i => i.ComponentDirectives);

            var mpds = GlobalObjects.MaintenanceCore.GetMaintenanceDirectives(CurrentAircraft);

            foreach (var componentDirective in componentDirectives)
            {
                foreach (var items in componentDirective.ItemRelations.Where(i =>
                                                                             i.FirtsItemTypeId == SmartCoreType.MaintenanceDirective.ItemId ||
                                                                             i.SecondItemTypeId == SmartCoreType.MaintenanceDirective.ItemId))
                {
                    var id = componentDirective.IsFirst == true ? items.SecondItemId : items.FirstItemId;
                    componentDirective.MaintenanceDirective = mpds.FirstOrDefault(i => i.ItemId == id);
                }
            }

            var directives = GlobalObjects.DirectiveCore.GetDirectives(CurrentAircraft, DirectiveType.All);

            mtopDirectives.AddRange(mpds.Where(i => i.Status == DirectiveStatus.Open || i.Status == DirectiveStatus.Repetative));
            mtopDirectives.AddRange(directives.Where(i => i.Status == DirectiveStatus.Open || i.Status == DirectiveStatus.Repetative));
            mtopDirectives.AddRange(componentDirectives.Where(i => i.Status == DirectiveStatus.Open || i.Status == DirectiveStatus.Repetative));



            if (AnimatedThreadWorker.CancellationPending)
            {
                e.Cancel = true;
                return;
            }


            AnimatedThreadWorker.ReportProgress(50, "Calculation");

            GlobalObjects.MTOPCalculator.CalculateDirectiveNew(mtopDirectives);

            _initial.AddRange(mtopDirectives.SelectMany(i => i.NextPerformances));

            FilterItems(_initial, _result);

            if (AnimatedThreadWorker.CancellationPending)
            {
                e.Cancel = true;
                return;
            }
            AnimatedThreadWorker.ReportProgress(100, "Completed");
        }
        protected override void AnimatedThreadWorkerDoWork(object sender, DoWorkEventArgs e)
        {
            _initialDocumentArray.Clear();

            AnimatedThreadWorker.ReportProgress(0, "load BaseComponents");

            _initialDocumentArray.AddRange(GlobalObjects.CasEnvironment.BaseComponents.Where(c => c.BaseComponentType == BaseComponentType.Engine));

            AnimatedThreadWorker.ReportProgress(100, "Complete");
        }