public ActionResult UserEdit() { string u_gid = Request["u_gid"] ?? string.Empty; string u_username = Request["u_username"] ?? string.Empty; string u_nickName = Request["u_nickName"] ?? string.Empty; string u_password = Request["u_password"] ?? string.Empty; int u_status = Request["u_status"].ToInt32(0); SiteFrame.Model.User info = null; if (string.IsNullOrEmpty(u_gid)) { info = SystemSeviceClass.User_SelectByu_name(u_username); if (info != null) { return(Json(new { success = false, errors = new { text = "已经存在相同用户名" } })); } info = new SiteFrame.Model.User(); info.u_gid = Guid.NewGuid().ToString().Substring(0, 8); info.u_createUser = SiteHelp.CurrentUserName; info.u_password = Entity.Str2Md5(u_password); info.u_status = u_status; info.u_username = u_username; info.u_nickName = u_nickName; info.u_createTime = DateTime.Now; int result = SystemSeviceClass.User_Insert(info); if (result > 0) { return(Json(new { success = true, errors = new { text = "新增成功" } })); } else { return(Json(new { success = false, errors = new { text = "新增失败" } })); } } else { info = SystemSeviceClass.User_SelectByu_gid(u_gid); info.u_status = u_status; info.u_username = u_username; info.u_nickName = u_nickName; int result = SystemSeviceClass.User_UpdateByu_gid(info); if (result > 0) { return(Json(new { success = true, errors = new { text = "修改成功" } })); } else { return(Json(new { success = false, errors = new { text = "修改失败" } })); } } }
//重置密码 public ActionResult UserEditPwd(string u_gid, string u_password) { SiteFrame.Model.User info = SystemSeviceClass.User_SelectByu_gid(u_gid); info.u_password = Entity.Str2Md5(u_password); int result = SystemSeviceClass.User_UpdateByu_gid(info); if (result > 0) { return(Json(new { success = true, errors = new { text = "重置密码成功" } })); } else { return(Json(new { success = false, errors = new { text = "重置密码失败" } })); } }
public ActionResult UserEditView() { string gid = Request["gid"] ?? string.Empty; string window = Request["window"] ?? string.Empty; SiteFrame.Model.User info = null; if (!string.IsNullOrEmpty(gid)) { info = SystemSeviceClass.User_SelectByu_gid(gid); } else { info = new User(); } ViewBag.uInfo = info; ViewData["window"] = window; return(View()); }