protected void Button1_Click(object sender, EventArgs e) { pmodel.ID = DataConverter.CLng(txtID.Value); pmodel.Info = txtInfo.Text; pmodel.IsTrue = DataConverter.CBool(txtIsTrue.SelectedValue); pmodel.Precedence = DataConverter.CLng(txtPrecedence.Text); pmodel.RoleName = Server.HtmlEncode(txtRoleName.Text); pmodel.RoleImg = ""; pmodel.UserGroup = pll.GetSelect(DataConverter.CLng(this.txtID.Value)) == null ? "" : pll.GetSelect(DataConverter.CLng(this.txtID.Value)).UserGroup; StringBuilder sb = new StringBuilder(); //sb.Append("<SiteList>" + Request.Form["SiteList"] + "</SiteList>");//子站 //sb.Append("<Nodelist>" + Request.Form["Nodelist"] + "</Nodelist>");//节点 //sb.Append("<DataList>" + Request.Form["DataList"] + "</DataList>");//模型表 //sb.Append("<Fieldlist>" + Request.Form["Fieldlist"] + "</Fieldlist>");//模型字段 //sb.Append("<Time>" + Request.Form["rblTime"] + "</Time>");//浏览时间 //sb.Append("<Month>" + check(cblMonth) + "</Month>");//设置月 //sb.Append("<Day>" + check(cblDay) + "</Day>");//设置日 //sb.Append("<Hour>" + check(cblHour) + "</Hour>");//设置小时 //sb.Append("<Weeks>" + check(cblWeeks) + "</Weeks>");//设置星期 //sb.Append("<ViewContent>" + Request.Form["ViewContent"] + "</ViewContent>");//允许内容浏览 //sb.Append("<ListContent>" + Request.Form["ListContent"] + "</ListContent>");//允许列表浏览 //sb.Append("<AddContent>" + Request.Form["AddContent"] + "</AddContent>");//允许新增发布 //sb.Append("<ModefiyContent>" + Request.Form["ModefiyContent"] + "</ModefiyContent>");//允许编辑修改 //sb.Append("<DeleteContent>" + Request.Form["DeleteContent"] + "</DeleteContent>");//允许删除内容 //sb.Append("<AddComm>" + Request.Form["AddComm"] + "</AddComm>");//允许评论权限 pmodel.Perlist = sb.ToString(); if (pmodel.ID == 0) { DataTable dt = pll.SelByRole(pmodel.RoleName); if (dt != null && dt.Rows.Count > 0) { function.WriteErrMsg("已经存在此角色,不能添加同名的角色!"); } else { pll.GetInsert(pmodel); function.WriteSuccessMsg("添加成功", "PermissionInfo.aspx"); } if (dt != null) { dt.Dispose(); } } else { pll.InsertUpdate(pmodel); function.WriteSuccessMsg("修改成功", "PermissionInfo.aspx"); } }
public IActionResult UserRoleAdd_Submit(M_Permission model) { M_Permission urMod = new M_Permission(); if (Mid > 0) { urMod = urBll.SelReturnModel(Mid); } urMod.RoleName = model.RoleName; urMod.Info = model.Info; if (urMod.ID > 0) { urBll.GetUpdate(urMod); } else { urBll.GetInsert(urMod); } return(WriteOK("操作成功", "UserRole")); }