当前位置: 首页>>代码示例>>C#>>正文


C# IEventRepository.Add方法代码示例

本文整理汇总了C#中IEventRepository.Add方法的典型用法代码示例。如果您正苦于以下问题:C# IEventRepository.Add方法的具体用法?C# IEventRepository.Add怎么用?C# IEventRepository.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IEventRepository的用法示例。


在下文中一共展示了IEventRepository.Add方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ProcessFirstBackOff

        private void ProcessFirstBackOff(
            Pmta pmta,
            string queue,
            IUnitOfWork unitOfWork,
            IEventRepository eventRepository
            )
        {
            _logger.InfoFormat("First Back Off for {0} on {1}", queue, pmta.Host);

            Event dbLogEvent = eventRepository.Add(new Event()
                                                   {
                                                       EventName = Event.EventNames.FirstBackOff,
                                                       Monitor = Event.Monitors.Four21,
                                                       SeriesId = Guid.NewGuid()
                                                   });

            _mtaAgent.RemoveBackoff(pmta.ToMta(), queue);
            _logger.InfoFormat("Removed Back Off from {0} on {1}", queue, pmta.Host);

            dbLogEvent.EventActions.Add(new EventAction()
                                            {
                                                Action = EventAction.Actions.RemoveBackOff,
                                                Pmta = pmta,
                                                PmtaQueue = queue
                                            });

            lock (_locker)
            {
                unitOfWork.SaveChanges();
            }
        }
开发者ID:c0d3m0nky,项目名称:mty,代码行数:31,代码来源:Four21.cs

示例2: ResumeSecondBackOff

        private void ResumeSecondBackOff(
            Event secondEventInstance,
            IUnitOfWork unitOfWork,
            IJobRepository jobRepository,
            IEventRepository eventRepository,
            IDeliveryGroupRepository deliveryGroupRepository,
            Event currentEvent = null
            )
        {
            var eventDetail = secondEventInstance.EventActions.FirstOrDefault(ed => ed.Action == EventAction.Actions.MTAPause);

            if (eventDetail != null && !_mtaAgent.IsQueueActive(eventDetail.Pmta.ToMta(), eventDetail.PmtaQueue))
            {
                _logger.InfoFormat("Resuming {0} on {1}", eventDetail.PmtaQueue, eventDetail.Pmta.Host);

                Event dbLogEvent = currentEvent ?? eventRepository.Add(new Event()
                                                       {
                                                           EventName = Event.EventNames.SecondBackOffResume,
                                                           Monitor = Event.Monitors.Four21,
                                                           SeriesId = secondEventInstance.SeriesId
                                                       });

                _mtaAgent.Purge(eventDetail.Pmta.ToMta(), eventDetail.PmtaQueue);
                _logger.InfoFormat("Purged {0} on {1}", eventDetail.PmtaQueue, eventDetail.Pmta.Host);

                dbLogEvent.EventActions.Add(new EventAction()
                        {
                            Action = EventAction.Actions.MTAPurge,
                            Pmta = eventDetail.Pmta,
                            PmtaQueue = eventDetail.PmtaQueue
                        });

                _mtaAgent.UnPause(eventDetail.Pmta.ToMta(), eventDetail.PmtaQueue);
                _logger.InfoFormat("Resumed {0} on {1}", eventDetail.PmtaQueue, eventDetail.Pmta.Host);

                dbLogEvent.EventActions.Add(new EventAction()
                {
                    Action = EventAction.Actions.ResumedQueue,
                    Pmta = eventDetail.Pmta,
                    PmtaQueue = eventDetail.PmtaQueue
                });

                lock (_locker)
                {
                    unitOfWork.SaveChanges();
                }
            }
        }
开发者ID:c0d3m0nky,项目名称:mty,代码行数:48,代码来源:Four21.cs

示例3: ProcessSecondBackOff

        private void ProcessSecondBackOff(
            Pmta pmta,
            string queue,
            Event lastEvent,
            IUnitOfWork unitOfWork,
            IEventRepository eventRepository
            )
        {
            _logger.InfoFormat("Second Back Off for {0} on {1}", queue, pmta.Host);

            Event dbLogEvent = eventRepository.Add(new Event()
                                                   {
                                                       EventName = Event.EventNames.SecondBackOff,
                                                       Monitor = Event.Monitors.Four21,
                                                       SeriesId = lastEvent.SeriesId
                                                   });

            _mtaAgent.Pause(pmta.ToMta(), queue);
            _logger.InfoFormat("Paused {0} on {1}", queue, pmta.Host);

            dbLogEvent.EventActions.Add(new EventAction()
                {
                    Action = EventAction.Actions.MTAPause,
                    Pmta = pmta,
                    PmtaQueue = queue
                });

            _mtaAgent.RemoveBackoff(pmta.ToMta(), queue);
            _logger.InfoFormat("Removed Back Off from {0} on {1}", queue, pmta.Host);

            dbLogEvent.EventActions.Add(new EventAction()
                {
                    Action = EventAction.Actions.RemoveBackOff,
                    Pmta = pmta,
                    PmtaQueue = queue
                });

            _mtaAgent.Purge(pmta.ToMta(), queue);
            _logger.InfoFormat("Purged {0} on {1}", queue, pmta.Host);

            dbLogEvent.EventActions.Add(new EventAction()
            {
                Action = EventAction.Actions.MTAPurge,
                Pmta = pmta,
                PmtaQueue = queue
            });

            lock (_locker)
            {
                unitOfWork.SaveChanges();
            }
        }
开发者ID:c0d3m0nky,项目名称:mty,代码行数:52,代码来源:Four21.cs

示例4: ProcessFourthBackOff

        private void ProcessFourthBackOff(
            Pmta pmta,
            string queue,
            Event lastEvent,
            DateTime nextReset,
            IUnitOfWork unitOfWork,
            IJobRepository jobRepository,
            IEventRepository eventRepository,
            IDeliveryGroupRepository deliveryGroupRepository
            )
        {
            _logger.InfoFormat("Fourth Back Off for {0} on {1}", queue, pmta.Host);

            var dbLogEvent = eventRepository.Add(new Event()
            {
                EventName = Event.EventNames.FourthBackOff,
                Monitor = Event.Monitors.Four21,
                SeriesId = lastEvent.SeriesId
            });

            _mtaAgent.Pause(pmta.ToMta(), queue);
            _logger.InfoFormat("Paused {0} on {1}", queue, pmta.Host);

            dbLogEvent.EventActions.Add(new EventAction()
                {
                    Action = EventAction.Actions.MTAPause,
                    Pmta = pmta,
                    PmtaQueue = queue
                });

            _mtaAgent.RemoveBackoff(pmta.ToMta(), queue);
            _logger.InfoFormat("Removed Back Off from {0} on {1}", queue, pmta.Host);

            dbLogEvent.EventActions.Add(new EventAction()
                {
                    Action = EventAction.Actions.RemoveBackOff,
                    Pmta = pmta,
                    PmtaQueue = queue
                });

            _mtaAgent.Purge(pmta.ToMta(), queue);
            _logger.InfoFormat("Purged {0} on {1}", queue, pmta.Host);

            dbLogEvent.EventActions.Add(new EventAction()
            {
                Action = EventAction.Actions.MTAPurge,
                Pmta = pmta,
                PmtaQueue = queue
            });

            lock (_locker)
            {
                var deliveryGroup = DeliveryGroup.GetByVmta(pmta, queue, deliveryGroupRepository);

                if (deliveryGroup != null)
                {
                    DeliveryGroup.CancelHotmailJobsByDeliveryGroup(jobRepository, _logger, deliveryGroup, nextReset, dbLogEvent);
                }

                unitOfWork.SaveChanges();
            }

            _emailNotification.SendEvent(dbLogEvent);

        }
开发者ID:c0d3m0nky,项目名称:mty,代码行数:65,代码来源:Four21.cs


注:本文中的IEventRepository.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。