public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/html"; //UserInfo userInfo = new UserInfo(); //userInfo.UserName = context.Request.Form["UserName"]; //userInfo.UserPass = context.Request.Form["UserPass"]; //userInfo.RegTime = Convert.ToDateTime(context.Request.Form["RegTime"]); //userInfo.Email = context.Request.Form["Email"]; //userInfo.ID = Convert.ToInt32(context.Request.Form["txtID"]); int id = Convert.ToInt32(context.Request.Form["txtID"]); BLL.UserInfoService userInfoService = new BLL.UserInfoService(); UserInfo userInfo = userInfoService.GetModel(id); userInfo.UserName = context.Request.Form["UserName"]; userInfo.UserPass = context.Request.Form["UserPass"]; if (userInfoService.UpdateEntity(userInfo)) { context.Response.Redirect("UserInfoList.ashx"); } else { context.Response.Write("修改失败"); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/html"; int id; if (int.TryParse(context.Request.QueryString["id"], out id)) { BLL.UserInfoService userInfoService = new BLL.UserInfoService(); UserInfo userInfo = userInfoService.GetModel(id); string filePath = context.Request.MapPath("ShowDetail.html"); string fileContent = File.ReadAllText(filePath); fileContent = fileContent.Replace("$name", userInfo.UserName.ToString()).Replace("$pwd", userInfo.UserPass.ToString()); context.Response.Write(fileContent); } }