Ejemplo n.º 1
0
        /// <summary>
        /// 频率设置
        /// </summary>
        /// <param name="name"></param>
        public MainService(string name)
        {
            Name = name;

            _PM_ALT_BASEBO        = ObjectContainer.BuildUp <IPM_ALT_BASEBO>();
            _ICV_PM_EMAIL_NOTIBO  = ObjectContainer.BuildUp <ICV_PM_EMAIL_NOTIBO>();
            _ICV_PM_WECHAT_NOTIBO = ObjectContainer.BuildUp <ICV_PM_WECHAT_NOTIBO>();
            //
            //1.load alert
            _alert = _PM_ALT_BASEBO.GetEntity(name);
            if (_alert == null)
            {
                _loopPeriod = new TimeSpan(0, 0, 300);
            }
            else
            {
                if (_alert.AlertInterval.HasValue)
                {
                    _loopPeriod = new TimeSpan(0, 0, _alert.AlertInterval.Value);
                }
                else if (!string.IsNullOrEmpty(_alert.AlertTimePoints))
                {
                    _fixedTimers = new List <DateTime>();
                    foreach (string fixedTimer in _alert.AlertTimePoints.Split(','))
                    {
                        if (string.IsNullOrEmpty(fixedTimer.Trim()))
                        {
                            continue;
                        }
                        //
                        _fixedTimers.Add(Convert.ToDateTime(string.Format("2000-01-01 {0}:00", fixedTimer.Trim())));
                    }
                    //
                    _loopPeriod = new TimeSpan(0, 0, 60);
                }
                else //没有设置频率,默认5分钟
                {
                    _loopPeriod = new TimeSpan(0, 0, 300);
                }
            }
        }
Ejemplo n.º 2
0
 public Service()
 {
     InitializeComponent();
     _PM_ALT_BASEBO = ObjectContainer.BuildUp <IPM_ALT_BASEBO>();
 }