Beispiel #1
0
 public void GetLevel()
 {
     try
     {
         HttpContext.Current.Response.ContentType = "application/json;charset=utf-8";
         string jsonCallBackFunName = string.Empty;
         jsonCallBackFunName = HttpContext.Current.Request.Params["callback"].ToString();
         Chain.BLL.MemLevel          bll       = new Chain.BLL.MemLevel();
         List <Chain.Model.MemLevel> listLevel = bll.GetLevelList("");
         StringBuilder sb      = new StringBuilder();
         string[]      strList = new string[listLevel.Count];
         for (int i = 0; i < listLevel.Count; i++)
         {
             strList[i] = JsonPlus.ToJson(listLevel[i]);
             if (0 == i)
             {
                 sb.AppendFormat("{0}\":{1}", "{\"" + i, strList[i] + "}");
             }
             else
             {
                 sb.AppendFormat(",{0}\":{1}", "{\"" + i, strList[i] + "}");
             }
         }
         if (listLevel.Count > 1)
         {
             HttpContext.Current.Response.Write(jsonCallBackFunName + "([" + sb.ToString() + "])");
         }
         else
         {
             HttpContext.Current.Response.Write(jsonCallBackFunName + "(" + sb.ToString() + ")");
         }
     }
     catch
     {
     }
 }