Exemplo n.º 1
0
 public ActionResult DeletePrinter(string id)
 {
     DBModel.Common.ComResult res = new DBModel.Common.ComResult();
     try
     {
         if (!Regex.IsMatch(id, @"^\d+$"))
         {
             res.Msg   = "ID只能是数字,且非负";
             res.State = 0;
             return(Json(res));
         }
         int isok = _service.DeletePrinter(Convert.ToInt32(id));
         if (isok == 0)
         {
             res.Msg   = "删除成功";
             res.URL   = "/Printer/Index";
             res.State = 1;
             return(Json(res));
         }
         else if (isok == 1)
         {
             res.Msg   = "删除失败";
             res.State = 0;
             return(Json(res));
         }
         else
         {
             res.Msg   = "此打印插件正在使用处于在线状态,请先关闭打印插件再进行删除";
             res.State = 2;
             return(Json(res));
         }
     }
     catch (Exception ex)
     {
         res.Msg   = ex.ToString();
         res.State = 0;
         return(Json(res));
     }
 }