//----------修改联系方式----------------------- public ActionResult phone(String p) { if (String.IsNullOrWhiteSpace(p)) { return(Fail("error")); } String uid = Convert.ToString(Session["uid"]); T_UserDAO phonedao = new T_UserDAO(); T_User phone = phonedao.GetById(uid); phone.phone = p; phonedao.Update(phone); int result = phonedao.Update(phone); if (result > 0) { Session["phone"] = p; return(Success("已通过!", null)); } else { return(Success("已通过,但未记录", null)); } }
public JsonResult SaveOrUpdateUserInfo(String code, String nickName, String gender) { String openid = GetOpenid(code); if (openid == "-1") { return(Json("获取openid失败!")); } T_UserDAO dao = new T_UserDAO(); T_User user = dao.getByOpenid(openid); if (user == null) { user = new T_User(); user.name = nickName; user.sex = int.Parse(gender); user.openid = openid; dao.Add(user); user = dao.getByOpenid(openid); } else { user.name = nickName; user.sex = int.Parse(gender); dao.Update(user); } return(Json(user.id)); }
[ValidateInput(false)] //要加上这一句,否则会造成富文本里面的HTML代码危险警报 public JsonResult Update(T_User entity) { if (entityDao.Update(entity) > 0) { return(Success("更新成功!", null)); } else { return(Fail("更新失败!")); } }
//----------修改密码----------------------- public JsonResult changePass() { String uid = Convert.ToString(Session["uid"]); String pass = Request["pass"]; String oldpass = Request["old"]; T_UserDAO userdao = new T_UserDAO(); T_User entity = new T_User() { id = uid, password = oldpass }; entity = userdao.GetByModel(entity); if (entity == null) { return(Fail("密码错误,请重新输入")); } else { T_User q = userdao.GetByModel(new T_User() { id = uid }); q.password = pass; userdao.Update(q); pass = ""; // var tempEntity = new { roleid=entity.roleId }; // string json5 = JsonConvert.SerializeObject(tempEntity); return(Success("修改密码成功", entity)); // } }
public void Update(T_UserEntity pEntity, bool pIsUpdateNullField, IDbTransaction pTran) { _currentDAO.Update(pEntity, pIsUpdateNullField, pTran); }