Ejemplo n.º 1
0
        /// <summary>
        /// 保存数据字典数据
        /// </summary>
        /// <returns></returns>
        public ActionResult Delete(string IDS)
        {
            JsonObject json = new JsonObject();

            if (string.IsNullOrEmpty(IDS))
            {
                json.Status      = JsonObject.STATUS_FAIL;
                json.ErroMessage = "请选择要删除的数据";
                return(Json(json));
            }
            String[]      IDArry = IDS.Trim(',').Split(',');
            StringBuilder IDlist = new StringBuilder();

            if (IDArry == null || IDArry.Length == 0)
            {
                json.Status      = JsonObject.STATUS_FAIL;
                json.ErroMessage = "请选择要删除的数据";
                return(Json(json));
            }

            for (int i = 0; i < IDArry.Length; i++)
            {
                if (CommonHelper.filterSql(IDArry[i]))
                {
                    IDlist.Append(",'");
                    IDlist.Append(IDArry[i]);
                    IDlist.Append("'");
                }
            }
            bool res = BLL.DeleteList(IDlist.ToString().Substring(1));

            if (res)
            {
                json.Status  = JsonObject.STATUS_SUCCESS;
                json.Message = "删除成功";
                return(Json(json));
            }
            else
            {
                json.Status      = JsonObject.STATUS_FAIL;
                json.ErroMessage = "删除失败";
                return(Json(json));
            }
        }