public IActionResult Delete(Role model) { var bll = new RoleBll(); var rst = bll.Delete(model); return(Json(rst)); }
/// <summary> /// 删除角色及角色,功能关系 /// </summary> protected void delete() { int count = Convert.ToInt32(Request["rows"]); int roleId = Convert.ToInt32(Request["roleId"]); //批量删除 if (userBll.IsDelete("T_User", "roleId", roleId.ToString()) == Result.关联引用) { Response.Write("该数据在其他表中被引用,不可删除"); Response.End(); } else { Result del = roleBll.Delete(roleId); if (del == Result.除成功) { Response.Write("删除成功"); Response.End(); } else { Response.Write("删除失败"); Response.End(); } } }
public RoleModule() : base("Role") { this.RequiresAuthentication(); Get["RoleManage"] = _ => ValidPermission("RoleManage") ? View["RoleManage", RoleBll.GetData()] : View["NoPermissions"]; Post["QueryRole"] = p => { string name = Request.Form["RoleName"]; var roleList = RoleBll.RoleLikeQuery(name); return(View["RoleManage", roleList]); }; Post["CheckRoleName/{Name}"] = p => RoleBll.GetDataByName(p.Name) != null; Get["RoleAdd"] = _ => ValidPermission("RoleAdd") ? View["RoleAdd"] : View["NoPermissions"]; Post["RoleAdd"] = p => { var roleModel = new RoleModel { Name = Request.Form["RoleName"].ToString(), CreateTime = DateTime.Now.ToString(), CreateUer = Context.CurrentUser.UserName, Permission = $"{Request.Form["Node"]},{Request.Form["group"]}", Status = Request.Form["Status"].ToString(), ManageHospital = string.IsNullOrEmpty(Request.Form["HospitalText"]) ? ConstFile.ALL : Request.Form["HospitalText"].ToString() }; RoleBll.Insert(roleModel); return(Response.AsRedirect("RoleManage")); }; Get["RoleEdit/{Name}"] = p => { var model = RoleBll.GetDataByName(p.Name); return(this.ValidPermission("RoleEdit") ? View["RoleEdit", model] : View["NoPermissions"]); }; Post["RoleEdit"] = _ => { var roleModel = new RoleModel { Name = Request.Form["Name"].ToString(), CreateTime = DateTime.Now.ToString(), CreateUer = Context.CurrentUser.UserName, Permission = $"{Request.Form["Node"]},{Request.Form["group"]}", Status = Request.Form["Status"].ToString(), ManageHospital = string.IsNullOrEmpty(Request.Form["HospitalText"]) ? ConstFile.ALL : Request.Form["HospitalText"].ToString() }; RoleBll.Update(roleModel); return(Response.AsRedirect("RoleManage")); }; Post["RoleDelete/{Name}"] = p => { return(RoleBll.Delete(p.Name)); }; Get["GetRolesToJson"] = _ => { return(Response.AsJson(RoleBll.GetBuiCheckBoxJson())); }; }
protected override bool DeletingItem(object item) { RoleBll bll = new RoleBll(AppSettings.CurrentSetting.ParkConnect); RoleInfo info = (RoleInfo)item; CommandResult result = bll.Delete(info); if (result.Result != ResultCode.Successful) { MessageBox.Show(result.Message, Resources.Resource1.Form_Alert, MessageBoxButtons.OK, MessageBoxIcon.Warning); } return result.Result == ResultCode.Successful; }
protected override bool DeletingItem(object item) { RoleBll bll = new RoleBll(AppSettings.CurrentSetting.ConnectUri); Role info = (Role)item; CommandResult result = bll.Delete(info); if (result.Result != ResultCode.Successful) { MessageBox.Show(result.Message, LJH.Attendance.UI.Properties.Resources.Form_Alert, MessageBoxButtons.OK, MessageBoxIcon.Warning); } return(result.Result == ResultCode.Successful); }
public ActionResult DeleteRole(string id) { var i = roleBll.Delete(id); return(Json(1 == i ? new RetJson() { Code = 200, Flag = true, Msg = "操作成功" } : new RetJson() { Code = 200, Flag = false, Msg = "操作失败" }, JsonRequestBehavior.AllowGet)); }
/// <summary> /// 删除角色 /// </summary> /// <param name="id">角色ID</param> /// <returns>删除结果</returns> public ActionResult Delete(int?id) { string result = "ok"; if (!string.IsNullOrEmpty(id.ToString())) { RoleBll roleBll = new RoleBll(); try { roleBll.Delete(int.Parse(id.ToString())); } catch (Exception e) { result = null; } } else { result = null; } return(Json(result)); }