public JsonResult Role_hasname(string strid, string newrolename) { string oldname = ""; if (strid != "") { int id = int.Parse(strid); oldname = dbDrive.FindRole(id).rolename; } if (oldname.Equals(newrolename)) { return(Json(true)); } List <Role> roleList = dbDrive.AccurateQueryRoles(newrolename); if (roleList != null && roleList.Count > 0) { return(Json(false)); } return(Json(true)); }
//管理员登录页面 public ActionResult AdminLogin(string name, string pass) { Admin admin = new Admin(); admin.name = name; admin.pass = pass; Admin loginadmin = dbDrive.AdminLogin(admin); if (loginadmin != null) { if (loginadmin.state.Equals("禁用")) { return(Json(false)); } int roleid = loginadmin.role; Role role = dbDrive.FindRole(roleid); Session["limit"] = role.limit; Session["Admin"] = loginadmin; LangleyPublic.adminId = loginadmin.id; return(Json(true)); } return(Json(false)); }