public ActionResult adduser() { string username = Request["username"]; string password = Request["password"]; string AgencyNo = Session["AgencyNo"].ToString(); if (BLL.UserInformation_BLL.GetUserInfoByName(username) != null) { var json = new { code = 1, msg = "用户已存在!" }; return(Json(json)); } else { UserInformation_Entity user = new UserInformation_Entity(); user.UserName = username; user.UserPassword = password; user.AgencyNo = AgencyNo; if (UserInformation_BLL.CreateUserInfo(user) > 0) { var json = new { code = 0, msg = "注册用户成功!" }; return(Json(json)); } else { var json = new { code = 2, msg = "注册失败!" }; return(Json(json)); } } }
public ActionResult passwordchange() { string old = Request["oldPassword"]; string newpassword = Request["password"]; string username = Session["UserName"].ToString(); if (BLL.UserInformation_BLL.UserLogin(username, old)) { UserInformation_Entity user = UserInformation_BLL.GetUserInfoByName(username); user.UserPassword = newpassword; user.AgencyNo = Session["AgencyNo"].ToString(); if (UserInformation_BLL.UpdateUserInfo(user) > 0) { var json = new { code = 0, msg = "密码修改成功!" }; return(Json(json)); } else { var json = new { code = 1, msg = "密码修改失败!" }; return(Json(json)); } } else { var json = new { code = 2, msg = "原密码错误!" }; return(Json(json)); } }