/// <summary> /// 显示指定权限的信息 /// </summary> /// <param name="id"></param> private void showRoles(string id) { try { HiddenField_ID.Value = id; mUserrole = bUserrole.GetModel(int.Parse(id)); TextBox_NAME2.Text = mUserrole.NAME.ToString(); TextBox_roles2.Text = mUserrole.Roles.ToString(); DropDownList_roles2.SelectedValue = mUserrole.Types.ToString(); if (mUserrole.Types.ToString() == "按钮权限") { Tr1.Visible = true; DropDownList_upid2.SelectedValue = mUserrole.UpID.ToString(); } } catch { } }
/// <summary> /// 提交修改 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Button1_Click(object sender, EventArgs e) { try { if (TextBox_NAME2.Text.ToString().Length > 0) { int id = int.Parse(HiddenField_ID.Value.ToString()); mUserrole = bUserrole.GetModel(id); mUserrole.DELFLAG = 0; mUserrole.NAME = TextBox_NAME2.Text.ToString(); mUserrole.Roles = TextBox_roles2.Text.ToString(); mUserrole.Types = DropDownList_roles2.SelectedItem.Value.ToString(); if (DropDownList_roles2.SelectedItem.Value == "按钮权限") { mUserrole.UpID = int.Parse(DropDownList_upid2.SelectedItem.Value.ToString()); } else { mUserrole.UpID = 0; } bUserrole.Update(mUserrole); ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('修改完成!')", true); Editrole.Visible = false; //设置模板页中的管理值 (Master.FindControl("Label_navigation") as Label).Text = "管理 > 权限管理 > 权限列表"; //设置模板页中的管理值 showlist(DropDownList_roles2.SelectedItem.Value.ToString()); } else { ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('权限名称不能为空!')", true); } } catch { ScriptManager.RegisterStartupScript(this.UpdatePanel1, this.GetType(), "updateScript", "alert('操作失败,请重试!')", true); } }