예제 #1
0
        /// <summary>
        /// 获取多个表返回Json
        /// </summary>
        /// <param name="json"></param>
        /// <param name="proc"></param>
        /// <param name="userId"></param>
        /// <param name="entid"></param>
        /// <returns></returns>
        protected string ReturnDataTableJson(string json, string proc, string userId, string entId)
        {
            string r_json;

            SqlParameter[] param = (JsonMethod.ListParameter(json, userId, entId)).ToArray();//动态解析json参数
            SqlRun         sql   = new SqlRun(SqlRun.sqlstr);
            DataTable      table = sql.RunProcedureDR(proc, param);

            if (table.Rows.Count > 0)
            {
                r_json = JsonMethod.DataTableToJson("0", table);
            }
            else
            {
                string error = "无数据";
                r_json = JsonMethod.GetError(1, error);
            }
            return(r_json);
        }
예제 #2
0
 /// <summary>
 /// 主题接口
 /// </summary>
 /// <returns></returns>
 public JsonResult GetTemplateList(string entId, string userId)
 {
     try {
         if (string.IsNullOrEmpty(userId))
         {
             return(Json(new { success = false, message = "用户未登录,请先登录" }));
         }
         SqlRun    sql = new SqlRun(SqlRun.sqlstr);
         DataTable dt  = sql.RunProcedureDR("Pc_TemplateRelation", new SqlParameter[]
         {
             new SqlParameter("@type", "CX_GetTemplateList"),
             new SqlParameter("@entId", entId)
         });
         return(Json(JsonMethod.DataTableToJson("1", dt)));
     }
     catch (Exception ex)
     {
         LogQueue.Write(LogType.Error, "Template/GetTemplateList", ex.Message.ToString());
         return(Json(new { success = false, message = "商城主题加载失败" }));
     }
 }