示例#1
0
        public void getRequirementDetail(HttpContext context)
        {
            Dictionary <String, Object> dictionary = new Dictionary <string, object>();
            Requirement requirement = requirementService.getRequirementById(Convert.ToInt32(context.Request["Id"]));
            User        user        = userService.getUserById(requirement.User.Id);
            string      imgPath     = "defaultImg.jpg";

            if (user.UserHeader != null)
            {
                imgPath = System.IO.Path.GetFileName(user.UserHeader);
            }
            dictionary.Add("Id", requirement.Id);
            dictionary.Add("Name", requirement.RequirementName);
            dictionary.Add("Desc", requirement.RequirementDesc);
            dictionary.Add("categoryName", requirementService.getCategoryName(requirement.RequirementCategory.Id));
            dictionary.Add("priority", requirement.Priority);
            dictionary.Add("userId", requirement.User.Id);
            dictionary.Add("userName", user.NickName);
            dictionary.Add("userTeleNum", user.TeleNumber);
            dictionary.Add("userEMail", user.Username);
            dictionary.Add("userHeader", imgPath);
            dictionary.Add("createTime", requirement.CreateTime);
            dictionary.Add("modifyTime", requirement.ModifyTime);
            dictionary.Add("Status", requirement.RequirementStatus);
            StringBuilder sb = new StringBuilder();

            sb.Append(JsonUtil.toJson(dictionary));
            dictionary.Clear();
            context.Response.Write(sb.ToString());
        }