public ActionResult Login(string loginName, string passWord) { ViewBag.LoginName = loginName; ViewBag.PassWord = passWord; ViewBag.ErrorMessage = ""; string md5PassWord = Library.Tools.Text.StringMd5.Md5Hash32Salt(passWord); AdminUserDb user = AdminUserBll.Instance.GetModel(loginName); if (user != null) { if (user.pass_word.ToUpper() == md5PassWord.ToUpper()) { user.last_lgoin_date = DateTime.Now; user.last_login_ip = Request.UserHostAddress; AdminUserBll.Instance.IniLogin(user); return(RedirectToAction("Index", "Home")); } else { ViewBag.errorMessage = "用户密码错误"; } } else { ViewBag.errorMessage = "用户密码错误"; } return(View()); }
public ActionResult Add(AdminUserWebM model) { if (ModelState.IsValid && model != null) { AdminUserDb adminUserDb = new AdminUserDb(); model.user_name = model.user_name.Trim(); ModelCopier.CopyModel(model, adminUserDb); AdminUserBll.Instance.Add(adminUserDb, model.role_ids); return(Content("<script>alert('添加用户成功!');parent.layer.closeAll('iframe');</script>")); } return(View(model)); }
public ActionResult Update(AdminUserWebMUpdate model) { AdminUserDb dbModel = AdminUserBll.Instance.GetModel(model.user_name); if (ModelState.IsValid && model != null) { dbModel.user_status = model.user_status; dbModel.user_full_name = model.user_full_name; dbModel.modifi_name = LoginUser.user_name; dbModel.modifi_date = DateTime.Now; AdminUserBll.Instance.Update(dbModel, model.role_ids); return(Content("<script>alert('修改用户成功!');parent.layer.closeAll('iframe');</script>")); } return(View(model)); }
public ActionResult Update(string userName = "") { if (string.IsNullOrEmpty(userName)) { return(Redirect("list")); } AdminUserWebMUpdate webModel = new AdminUserWebMUpdate(); AdminUserDb dbModel = AdminUserBll.Instance.GetModel(userName); if (dbModel != null) { ModelCopier.CopyModel(dbModel, webModel); if (dbModel.AdminUserRoleRelations != null && dbModel.AdminUserRoleRelations.Count > 0) { webModel.role_ids = string.Join(",", dbModel.AdminUserRoleRelations.Select(c => c.role_id).ToArray()); webModel.role_names = string.Join(",", dbModel.AdminUserRoleRelations.Select(c => c.RoleDb.role_name).ToArray()); } } return(View(webModel)); }