public void getSupplyDetail(HttpContext context) { Dictionary <String, Object> dictionary = new Dictionary <string, object>(); Supply supply = supplyService.getSupplyById(Convert.ToInt32(context.Request["Id"])); User user = userService.getUserById(supply.User.Id); string imgPath = "defaultImg.jpg"; if (user.UserHeader != null) { imgPath = System.IO.Path.GetFileName(user.UserHeader); } dictionary.Add("Id", supply.Id); dictionary.Add("Name", supply.SupplyName); dictionary.Add("Desc", supply.SupplyDesc); dictionary.Add("categoryName", supplyService.getCategoryName(supply.SupplyCategory.Id)); dictionary.Add("priority", supply.Priority); dictionary.Add("userId", supply.User.Id); dictionary.Add("userName", user.NickName); dictionary.Add("userTeleNum", user.TeleNumber); dictionary.Add("userEMail", user.Username); dictionary.Add("userHeader", imgPath); dictionary.Add("createTime", supply.CreateTime); dictionary.Add("modifyTime", supply.ModifyTime); dictionary.Add("Status", supply.SupplyStatus); StringBuilder sb = new StringBuilder(); sb.Append(JsonUtil.toJson(dictionary)); dictionary.Clear(); context.Response.Write(sb.ToString()); }