Пример #1
0
        public void SaveJobWithContent(JobWithContent job)
        {
            _tracer.TraceEvent(TraceEventType.Start, 0);

            var contentRepository = new PageContentRepository(this._settings);

            using (contentRepository.AcquireLock(job.ID))
            {
                using (var scope = new TransactionScope(TransactionScopeOption.Required))
                {
                    if (job.HasTestScraped)
                    {
                        string jsonZones = JsonConvert.SerializeObject(job.TestContent.AdZoneNodes);
                        job.AdsInfo = jsonZones;
                    }

                    InternalSaveJob(job);
                    // save content to files
                    if (job.HasReferenceScraped)
                    {
                        contentRepository.SaveReferenceContent(job.ReferenceContent, job.ID);
                    }

                    if (job.HasTestScraped)
                    {
                        contentRepository.SaveTestContent(job.TestContent, job.ID);
                    }

                    scope.Complete();
                }
            }

            _tracer.TraceEvent(TraceEventType.Stop, 0);
        }