示例#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();
        }
示例#2
0
        public ActionResult Delete()
        {
            int        id      = Request.Form["Id"].Safe().ToInt32();
            Tdms_Admin daAdmin = new Tdms_Admin();

            if (!daAdmin.Delete(id))
            {
                return(FailResult("删除失败!原因:" + daAdmin.PromptInfo.MessageStack));
            }

            return(SuccessResult());
        }
示例#3
0
文件: MAdmin.cs 项目: demon28/DMS
        public bool Add()
        {
            if (!SaveVerify())
            {
                return(false);
            }
            //验证该管理员是否已经具有这条SQL的权限
            Tdms_Admin daAdmin = new Tdms_Admin();

            if (daAdmin.ListByInfoAndNodeId(this.DAL.InfoId, this.DAL.NodeId))
            {
                Alert("该管理员已经具有该条sql的权限");
                return(false);
            }
            //添加插入此条SQL的管理员
            if (!DAL.Insert())
            {
                Alert("保存SQL管理信息失败", DAL.PromptInfo);
                return(false);
            }
            return(true);
        }
示例#4
0
        public ActionResult Delete()
        {
            int        id      = Request.Form["Id"].Safe().ToInt32();
            Tdms_Admin daAdmin = new Tdms_Admin();

            if (daAdmin.SelectByInfoId(id))
            {
                return(FailResult("该记录已有管理员监控无法删除!"));
            }
            Tdms_Info daInfo = new Tdms_Info();

            if (!daInfo.SelectByPK(id))
            {
                return(FailResult("此记录已不存在"));
            }

            if (!daInfo.Delete(id))
            {
                return(FailResult("删除失败!原因:" + daInfo.PromptInfo.MessageStack));
            }

            return(SuccessResult());
        }