Esempio n. 1
0
 public void requirementmanage(HttpContext context)
 {
     if (context.Session["userId"] != null)
     {
         int userId = Convert.ToInt32(context.Session["userId"].ToString());
         List <Requirement>          list       = requirementService.getMyRequirement(userId);
         StringBuilder               jsonString = new StringBuilder();
         Dictionary <String, Object> dictionary = new Dictionary <string, object>();
         //jsonString.Append("\"supply\":");
         jsonString.Append("[");
         int i = 1;
         foreach (Requirement requirement in list)
         {
             dictionary.Add("Id", requirement.Id);
             dictionary.Add("requirementName", requirement.RequirementName);
             dictionary.Add("priority", requirement.Priority);
             dictionary.Add("createTime", requirement.CreateTime);
             dictionary.Add("modifyTime", requirement.ModifyTime);
             dictionary.Add("requirementStatus", requirement.RequirementStatus);
             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());
     }
 }