private void AddUser() { Model.UserInfo userinfo = new Model.UserInfo(); userinfo.UserName = Request.Form["txtName"]; userinfo.UserPwd = Request.Form["txtPwd"]; userinfo.Email = Request.Form["txtMail"]; userinfo.RegTime = DateTime.Now; Bll.UserInfoBll userInfoBll = new Bll.UserInfoBll(); if (userInfoBll.AddUserInfo(userinfo)) { Response.Redirect("UserInfoList.aspx"); } else { Response.Redirect("Error.html"); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; UserInfo userInfo = new UserInfo(); userInfo.UserName = context.Request["txtUserName"]; userInfo.UserPwd = context.Request["txtUserPwd"]; userInfo.Email = context.Request["txtUserMail"]; userInfo.RegTime = DateTime.Now; Bll.UserInfoBll userInfoBll = new Bll.UserInfoBll(); //这里没有涉及到校验信息是否符合要求,等以后来完善 if (userInfoBll.AddUserInfo(userInfo)) { context.Response.Write("ok"); } else { context.Response.Write("no"); } }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/html"; string userName = context.Request.Form["txtName"]; string userPwd = context.Request.Form["txtPwd"]; string userMail = context.Request.Form["txtMail"]; //DateTime userRegTime = DateTime.Now;直接在后面给uerinfo赋值就可以了 UserInfo userinfo = new UserInfo(); userinfo.UserName = userName; userinfo.UserPwd = userPwd; userinfo.Email = userMail; userinfo.RegTime = DateTime.Now; Bll.UserInfoBll userinfobll = new Bll.UserInfoBll(); if (userinfobll.AddUserInfo(userinfo)) { context.Response.Redirect("UserInfoList.ashx"); } else { context.Response.Redirect("Error.html"); } }