public async IAsyncEnumerable <HmrRockfallReport> SaveRockfallReportAsnyc(HmrSubmissionObject submission, List <RockfallReportGeometry> rockfallReports)
        {
            foreach (var rockfallReport in rockfallReports)
            {
                rockfallReport.RockfallReportTyped.SubmissionObjectId = submission.SubmissionObjectId;

                var entity = await DbSet
                             .Where(x => x.SubmissionObject.PartyId == submission.PartyId && x.McrrIncidentNumber == rockfallReport.RockfallReportTyped.McrrIncidentNumber)
                             .FirstOrDefaultAsync();

                if (entity == null)
                {
                    entity          = Mapper.Map <HmrRockfallReport>(rockfallReport.RockfallReportTyped);
                    entity.Geometry = rockfallReport.Geometry;

                    submission.HmrRockfallReports
                    .Add(entity);
                }
                else
                {
                    rockfallReport.RockfallReportTyped.RockfallReportId = entity.RockfallReportId;
                    Mapper.Map(rockfallReport.RockfallReportTyped, entity);
                    entity.Geometry = rockfallReport.Geometry;
                }

                yield return(entity);
            }
        }
        public async IAsyncEnumerable <HmrRockfallReport> SaveRockfallReportAsnyc(HmrSubmissionObject submission, List <RockfallReportGeometry> rockfallReports)
        {
            foreach (var rockfallReport in rockfallReports)
            {
                rockfallReport.RockfallReportTyped.SubmissionObjectId = submission.SubmissionObjectId;

                //HMCR-1063 Rockfall reports with same MCRR numbers submitted for different service areas were over writing the original
                //  changed it from PartyID to ContractTermID which handles the service area and party distinction
                var entity = await DbSet
                             //.Where(x => x.SubmissionObject.PartyId == submission.PartyId && x.McrrIncidentNumber == rockfallReport.RockfallReportTyped.McrrIncidentNumber)
                             .Where(x => x.SubmissionObject.ContractTermId == submission.ContractTermId && x.McrrIncidentNumber == rockfallReport.RockfallReportTyped.McrrIncidentNumber)
                             .FirstOrDefaultAsync();

                if (entity == null)
                {
                    entity          = Mapper.Map <HmrRockfallReport>(rockfallReport.RockfallReportTyped);
                    entity.Geometry = rockfallReport.Geometry;

                    submission.HmrRockfallReports
                    .Add(entity);
                }
                else
                {
                    rockfallReport.RockfallReportTyped.RockfallReportId = entity.RockfallReportId;
                    Mapper.Map(rockfallReport.RockfallReportTyped, entity);
                    entity.Geometry = rockfallReport.Geometry;
                }

                yield return(entity);
            }
        }
示例#3
0
        public async IAsyncEnumerable <HmrWorkReport> SaveWorkReportAsnyc(HmrSubmissionObject submission, List <WorkReportGeometry> workReports)
        {
            foreach (var workReport in workReports)
            {
                workReport.WorkReportTyped.SubmissionObjectId = submission.SubmissionObjectId;

                var entity = await DbSet
                             .Where(x => x.SubmissionObject.PartyId == submission.PartyId && x.RecordNumber == workReport.WorkReportTyped.RecordNumber)
                             .FirstOrDefaultAsync();

                if (entity == null)
                {
                    entity          = Mapper.Map <HmrWorkReport>(workReport.WorkReportTyped);
                    entity.Geometry = workReport.Geometry;

                    submission.HmrWorkReports
                    .Add(entity);
                }
                else
                {
                    workReport.WorkReportTyped.WorkReportId = entity.WorkReportId;
                    Mapper.Map(workReport.WorkReportTyped, entity);
                    entity.Geometry = workReport.Geometry;
                }

                yield return(entity);
            }
        }
示例#4
0
        public void SaveWildlifeReport(HmrSubmissionObject submission, List <WildlifeReportGeometry> rows)
        {
            foreach (var row in rows)
            {
                row.WildlifeReportTyped.SubmissionObjectId = submission.SubmissionObjectId;

                var entity = Mapper.Map <HmrWildlifeReport>(row.WildlifeReportTyped);
                entity.Geometry = row.Geometry;

                submission.HmrWildlifeReports
                .Add(entity);
            }
        }
示例#5
0
        protected async Task <bool> SetSubmissionAsync(SubmissionDto submissionDto)
        {
            _logger.LogInformation("[Hangfire] Starting submission {submissionObjectId}", (long)submissionDto.SubmissionObjectId);

            _submission = await _submissionRepo.GetSubmissionObjecForBackgroundJobAsync(submissionDto.SubmissionObjectId);

            _submission.SubmissionStatusId = _statusService.FileInProgress;
            _unitOfWork.Commit();

            _submissionRows = new Dictionary <decimal, HmrSubmissionRow>();

            _methodLogHeader = $"[Hangfire] Submission ({_submission.SubmissionObjectId}): ";
            _enableMethodLog = _config.GetValue <string>("DISABLE_METHOD_LOGGER") != "Y"; //enabled by default

            _serviceArea = await _serviceAreaService.GetServiceAreaByServiceAreaNumberAsyc(_submission.ServiceAreaNumber);

            return(true);
        }