private void AppendDetailsToJob(BackgrounderJob job, BsonDocument endEvent)
        {
            DateTime endTime          = BsonDocumentHelper.GetDateTime("ts", endEvent);
            var      eventsInJobRange = MongoQueryHelper.GetEventsInRange(backgrounderJavaCollection, job.WorkerId, job.BackgrounderId, job.StartTime, endTime).ToList();

            // Append all errors associated with job.
            job.Errors = CollectErrorsForJob(job, eventsInJobRange);

            // Append details for certain job types of interest.
            if (job.JobType.Equals("refresh_extracts") || job.JobType.Equals("increment_extracts"))
            {
                BackgrounderExtractJobDetail extractJobDetail = new BackgrounderExtractJobDetail(job, GetVqlSessionServiceEvents(eventsInJobRange));
                if (!String.IsNullOrEmpty(extractJobDetail.VizqlSessionId))
                {
                    job.BackgrounderJobDetail = extractJobDetail;
                }
            }
            else if (job.JobType.Equals("single_subscription_notify"))
            {
                List <BsonDocument> eventList = new List <BsonDocument>(GetVqlSessionServiceEvents(eventsInJobRange));
                eventList.AddRange(GetSubscriptionRunnerEvents(eventsInJobRange));

                BackgrounderSubscriptionJobDetail subscriptionJobDetail = new BackgrounderSubscriptionJobDetail(job, eventList);
                if (!String.IsNullOrEmpty(subscriptionJobDetail.VizqlSessionId))
                {
                    job.BackgrounderJobDetail = subscriptionJobDetail;
                }
            }
        }
 public void AddSubscriptionDetail(BackgrounderSubscriptionJobDetail newDetail)
 {
     if (SubscriptionJobDetails == null)
     {
         SubscriptionJobDetails = newDetail;
     }
     else
     {
         SubscriptionJobDetails.MergeInfo(newDetail);
     }
 }
        public void MergeInfo(BackgrounderSubscriptionJobDetail otherEvent)
        {
            if (otherEvent == null)
            {
                return;
            }

            RecipientEmail   = RecipientEmail ?? otherEvent.RecipientEmail;
            SenderEmail      = SenderEmail ?? otherEvent.SenderEmail;
            SmtpServer       = SmtpServer ?? otherEvent.SmtpServer;
            SubscriptionName = SubscriptionName ?? otherEvent.SubscriptionName;
            VizqlSessionId   = VizqlSessionId ?? otherEvent.VizqlSessionId;
        }
 public void AddSubscriptionJobDetails(BackgrounderSubscriptionJobDetail subscriptionJobDetail)
 {
     if (_events.ContainsKey(subscriptionJobDetail.BackgrounderJobId))
     {
         var existingEvent = _events[subscriptionJobDetail.BackgrounderJobId];
         existingEvent.AddSubscriptionDetail(subscriptionJobDetail);
     }
     else
     {
         _events.Add(subscriptionJobDetail.BackgrounderJobId, new BackgrounderEvent {
             SubscriptionJobDetails = subscriptionJobDetail
         });
     }
 }