예제 #1
0
 public ActionResult Execute(int Id)
 {
     try
     {
         Tdms_Info daInfo = new Tdms_Info();
         if (!daInfo.SelectByPK(Id))
         {
             return(FailResult("该记录不存在"));
         }
         string SqlContext = daInfo.SqlContext;
         if (string.IsNullOrEmpty(SqlContext))
         {
             return(FailResult("sql语句为空,无法执行"));
         }
         MSQL sqlFacade = new MSQL();
         int  count;
         if (!sqlFacade.ExecuteSQL(SqlContext, out count))
         {
             return(FailResult(sqlFacade.PromptInfo.MessageStack));
         }
         if (count > 0 || count == 0)
         {
             return(FailResult("监控到" + count + "条非法数据!"));
         }
         return(SuccessResult());
     }
     catch (Exception ex)
     {
         return(FailResult("执行SQL出现异常:" + ex.Message));
     }
 }
예제 #2
0
        /// <summary>
        /// 验证数据
        /// </summary>
        /// <returns></returns>
        private bool SaveVerify()
        {
            Tdms_Info daIndo = new Tdms_Info();

            if (!daIndo.SelectByPK(this.DAL.Id))
            {
                Alert("此条SQL语句不存在!");
                return(false);
            }
            return(true);
        }
예제 #3
0
        public ActionResult Delete(int Id)
        {
            Tdms_Info daInfo = new Tdms_Info();

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

            ViewBag.Id = Id;
            return(View());
        }
예제 #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());
        }