示例#1
0
        /// <summary>
        /// Возвращает все NonRoutineJobs воздушного судна
        /// </summary>
        /// <returns></returns>
        public NonRoutineJob[] GetNonRoutineJobsStatus(Aircraft aircraft)
        {
            var preJobs = _nonRoutineJobDataAccess.GetNonRoutineJobDTOsFromAircraftWorkPackages(aircraft.ItemId);

            //поиск всех записей о использовании нерутинных работ в рабочих пакетах данного самолета
            var wpIds   = _newLoader.GetSelectColumnOnly <WorkPackageDTO>(new [] { new Filter("ParentId", aircraft.ItemId) }, "ItemId");
            var wprList = _newLoader.GetObjectListAll <WorkPackageRecordDTO, WorkPackageRecord>(new List <Filter>()
            {
                new Filter("WorkPackageItemType", SmartCoreType.NonRoutineJob.ItemId),
                new Filter("WorkPakageId", wpIds)
            });

            //загрузка всех рабочих пакетов заданного самолета
            var wpList = _workPackageCore.GetWorkPackages(aircraft);

            var preJobsDict = preJobs.Select(j => NonRoutineJobHelper.Convert(j, _casEnvironment)).ToDictionary(p => p.ItemId);

            //связывание нерутинных работ с рабочими пакетами
            var resultJobs = new List <NonRoutineJob>();

            foreach (var wpr in wprList)
            {
                var nonRoutineJob = preJobsDict[wpr.DirectiveId];

                resultJobs.Add(nonRoutineJob);
                nonRoutineJob.WorkPackageRecord = wpr;

                //поиск рабочего пакета
                var wp = wpList.FirstOrDefault(w => w.ItemId == wpr.WorkPakageId);
                if (wp != null)
                {
                    wpr.WorkPackage = wp;
                    nonRoutineJob.ParentWorkPackage = wp;
                }
            }
            return(resultJobs.ToArray());
        }
示例#2
0
        public void Delete(NonRoutineJob nonRoutineJob)
        {
            var nrjDTO = NonRoutineJobHelper.Convert(nonRoutineJob);

            _nonRoutineJobDataAccess.Delete(nrjDTO);
        }