Exemple #1
0
        public void SendType(Tdms_Admin taAdmin, Tdms_Info daInfo, Tdms_Winservice item)
        {
            Vnet_Reginfo daVinfo = new Vnet_Reginfo();

            if (!daVinfo.SelectByPK(taAdmin.NodeId))
            {
                return;
            }
            //TODO:接入消息中心,此方法屏蔽掉,直接新建一个类似的方法
            //装饰者
            NotifyAdmin notify = new NotifyAdmin();

            //装饰EMail发送功能
            notify           = EMailNotify.New(notify);
            notify.Address   = taAdmin.Email;
            notify.RunResult = item.RunResult;
            notify.Content   = string.Format("[{0}]{2}监控到{1}条非法数据。", daInfo.Title, item.RunResult, DateTime.Now.ToString("MM月dd日"));

            if ((taAdmin.SendType & SqlSendType.短信) == SqlSendType.短信)
            {
                if ((taAdmin.IsSend == SqlIsSend.发送) ||
                    (DateTime.Now.Hour >= 8))
                {
                    //装饰短信发送功能
                    notify         = SMSNotify.New(notify);
                    notify.Address = daVinfo.Mobileno;
                }
            }
            notify.Send();
        }
Exemple #2
0
        /// <summary>
        /// 验证数据
        /// </summary>
        /// <returns></returns>
        private bool SaveVerify()
        {
            //查看此管理员是否存在
            Vnet_Reginfo daReginfo = new Vnet_Reginfo();

            if (!daReginfo.SelectByPK(this.DAL.NodeId))
            {
                Alert("该管理员不存在");
                return(false);
            }
            if (string.IsNullOrEmpty(DAL.Email))
            {
                Alert("请输入邮箱");
                return(false);
            }
            if (DAL.SendType == SqlSendType.短信)
            {
                Alert("邮件通知为必选项");
                return(false);
            }
            return(true);
        }