Beispiel #1
0
 public void supplyManage(HttpContext context)
 {
     if (context.Session["userId"] != null)
     {
         int           userId     = Convert.ToInt32(context.Session["userId"].ToString());
         List <Supply> list       = supplyService.getMySupply(userId);
         StringBuilder jsonString = new StringBuilder();
         Dictionary <String, Object> dictionary = new Dictionary <string, object>();
         //jsonString.Append("\"supply\":");
         jsonString.Append("[");
         int i = 1;
         foreach (Supply supply in list)
         {
             dictionary.Add("Id", supply.Id);
             dictionary.Add("supplyName", supply.SupplyName);
             dictionary.Add("priority", supply.Priority);
             dictionary.Add("createTime", supply.CreateTime);
             dictionary.Add("modifyTime", supply.ModifyTime);
             dictionary.Add("supplyStatus", supply.SupplyStatus);
             dictionary.Add("success", "true");
             jsonString.Append(JsonUtil.toJson(dictionary));
             if (i < list.Count)
             {
                 jsonString.Append(",");
             }
             i++;
             dictionary.Clear();
         }
         jsonString.Append("]");
         context.Response.Write(jsonString.ToString());
     }
 }