添加链接权限的字段:

                //权限管理
n.Target = "MainFrame";
//折叠
TreeView1.Nodes.Add(n);
n.Expanded = false;

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAAd0AAACvCAIAAAA3wpNHAAAV5klEQVR4nO2d32scR4LH9y9pCVtKBkl+MhxsyEtYGPxm7uHIm9/8dm+BNquws6y1IJn0OmosRavIkmesNVmbcaSIjfxTGnCSGxzCjo+LxwF7AvGsd2nvmSbZxnjJHbUPZXfK9aurZ6arezzfD1+M1arurqrp/nRNTffoZwQAAECR+FneFQAAAPAS8DIAABQLeBkAAIoFvAwAAMUCXgYAgGIBLwMAQLGAlwEAoFjAywAAUCx0Xg7DsFKplMvlSqXSarXCMFSVDIKg3W5rCuRO3JZWq5V3XTIkiqJut5vpC9Fqtcrlsu/7RX65ARhqdF5uNBrllHQ6HWtVTwW1CWWAat7d3S2Xy/V6vdVqtVqter1OL2PNZjOKIlomiqJOpxMEgWojYRi2221NASntdrter3e7XXYhvfZkd/npdDpxN1YqlSx2AQDQeZl1GcX3/UajwTqIg9OEniAIfN83NH6lUtnd3aW7TrUXsS31ej3t6lKolPVXqSiKDBtYTnNVY/0YXwAIIWIbwzBstVrNZrP1Mpo+jKIoCAJ2szHcISGtcBAEGEoD0A86L7Mnv34rcTHzQV8Pg3GOdrtt2sqUXo6iqN1uV6vVcrncbDYTW62iXq8HQWDeIsPrTRiG7Frs0JjWOW6jfu/ValXcuPRy2xtSswMAEtF5mTur43frmvGyoZc5s/RGo9FI3Es8P6DysvieQGR3d1e6fW5d6kf2YkadHrtS+sa/2WzG5U1Exm6/XC77vs+uFb8otI3tdlvfNG7jqa4iibzaU/kAZEe6eYxEDN/AisaPPzbkfpV21jWm2+0m1jY2ph6Vl7naUg2x7wNoGda87Xab1WgQBPGMcDnpTQkRBrN0GkF/kYu37/s+VxnxwsZ1fg/zRWy3w8sA9IbOy1EU0fnfarWquR8jCIJWq5X2fowwDKXlB+Vlk5lr3/dpMXFKhJOpai+cl9nBbNy6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设计:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UserRightManger.aspx.cs" Inherits="BioErpWeb.HRSystem.UserRightManger" %>

<%@ Register Assembly="AspNetPager" Namespace="Wuqi.Webdiyer" TagPrefix="webdiyer" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="../Styles/ERPBaseStyle.css" rel="stylesheet" type="text/css" />
<link href="../Styles/AspNetPagerStyle.css" rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<div>
<asp:UpdatePanel id="up_all" runat="server">
<contenttemplate> <cc1:ModalPopupExtender ID="modal_Add" TargetControlID="btnNew" PopupControlID="Panel_Add" runat="server">
</cc1:ModalPopupExtender> <asp:ImageButton ID="imgEditBtn" Width="1" Height="1" runat="server" />
<cc1:ModalPopupExtender ID="Modal_Update" TargetControlID="imgEditBtn" PopupControlID="Panel_Update" runat="server">
</cc1:ModalPopupExtender>
<div>
<asp:Panel ID="Panel_Add" runat="server" CssClass="pLogo">
<table class="tb_mess">
<thead class="name"><caption>权限信息添加</caption></thead>
<tr>
<td>权限名</td><td>
<asp:TextBox ID="txtRightName0" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
ControlToValidate="txtRightName0" ErrorMessage="*必须填写"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td>备注</td><td>
<asp:TextBox ID="txtReMark0" runat="server"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
ControlToValidate="txtReMark0" ErrorMessage="*必须填写"></asp:RequiredFieldValidator>
</td>
</tr>
<tr><td colspan="2"></td></tr>
<tr><td colspan="2"></td></tr>
<tr><td colspan="2"></td></tr>
<tr>
<td colspan="2" class="bottomtd">
<asp:Button ID="btnAdd" runat="server" Text="提交" onclick="btnAdd_Click" />
<asp:Button ID="Button1" runat="server" Text="关闭" CausesValidation="False"
UseSubmitBehavior="False" /></td>
</tr>
</table>
</asp:Panel>
</div>
<div>
<asp:Panel ID="Panel_Update" runat="server" CssClass="pLogo">
<table class="tb_mess">
<thead class="name"><caption>权限信息编辑</caption></thead>
<tr>
<td>权限名</td><td>
<asp:TextBox ID="txtRightName1" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>备注</td><td>
<asp:TextBox ID="txtReMark1" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td colspan="2" class="bottomtd">
<asp:Button ID="btnUpdate" runat="server" CausesValidation="false" Text="提交" onclick="btnUpdate_Click" /><asp:Button ID="btnClose" CausesValidation="false" runat="server" Text="关闭" /></td>
</tr>
</table>
</asp:Panel>
</div> <table class="maintable">
<tr>
<td class="titlebar">
权限管理系统
</td>
</tr>
<tr>
<td style=" text-align:right; padding-right:10px; ">
<asp:Button ID="btnNew" runat="server" Text="添加" BackColor="#CDEAFB" Width="80px" Height="30px" />
</td>
</tr>
<tr>
<td>
<asp:GridView ID="GridView1" Width="100%" AutoGenerateColumns="False"
runat="server" onrowcommand="GridView1_RowCommand" ShowFooter="True" DataKeyNames="ID">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="check_all" Width="50px" runat="server" />
</ItemTemplate>
<FooterTemplate>
<asp:LinkButton ID="lb_checkall" CausesValidation="false" runat="server" Text="全选" CommandName="allcheck"></asp:LinkButton>
<asp:LinkButton ID="lb_recheckall" CausesValidation="false" CommandName="recheck" runat="server" Text="反选"></asp:LinkButton>
</FooterTemplate>
<FooterStyle HorizontalAlign="Center" Width="60px" />
<ItemStyle HorizontalAlign="Center" Width="50px"/>
</asp:TemplateField> <asp:TemplateField HeaderText="编号">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# Eval("ID") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="权限名">
<ItemTemplate>
<asp:Label ID="Label2" runat="server" Text='<%# Eval("RightName") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="备注">
<ItemTemplate>
<asp:Label ID="Label3" runat="server" Text='<%# Eval("ReMark") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
<asp:TemplateField HeaderText="操作">
<ItemTemplate>
<asp:ImageButton ID="imgEditBtn" Width="50" Height="20" CommandName="imgEdit" CommandArgument='<%#Eval("ID") %>' CausesValidation="false" ImageUrl="~/Web/images/Edit.gif" runat="server" />
<asp:ImageButton ID="imgDeleteBtn" Width="50" Height="20" CommandName="imgDelete" OnClientClick="return confirm('是否确定删除?');" CommandArgument='<%#Eval("ID") %>' ImageUrl="~/Web/images/Delete.gif" runat="server" /> </ItemTemplate>
<FooterTemplate>
<asp:LinkButton ID="lb_delete" runat="server" CommandName="DeleteChecked" Text="删除选中" OnClientClick="return confirm('是否确定删除?');"></asp:LinkButton>
</FooterTemplate>
<FooterStyle Width="150px" HorizontalAlign="Center" />
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
</Columns>
</asp:GridView>
</td>
</tr>
<tr>
<td>
<webdiyer:AspNetPager ID="AspNetPager1" CssClass="paginator"
CurrentPageButtonClass="cpb" runat="server"
onpagechanged="AspNetPager1_PageChanged">
</webdiyer:AspNetPager>
</td>
</tr>
</table> </contenttemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>

权限的添加和修改的存储过程:

ALTER PROCEDURE [dbo].[tbRight_ADD]
@RightName nvarchar(50),
@ReMark nvarchar(50) AS
INSERT INTO [tbRight](
[RightName],[ReMark]
)VALUES(
@RightName,@ReMark
) --------修改-----
ALTER PROCEDURE [dbo].[tbRight_Update]
@ID int,
@RightName nvarchar(50),
@ReMark nvarchar(50)
AS
UPDATE [tbRight] SET
[RightName] = @RightName,[ReMark] = @ReMark
WHERE ID=@ID
-- Description:	根据权限id获取权限信息
-- =============================================
ALTER PROCEDURE [dbo].[getRightById]
@id int
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
SELECT
ID,
RightName,
ReMark
FROM
tbRight
WHERE ID=@id
END

权限查询:

所需组件:Gridview,AspNetPager

调用分页业务方法实现分页查询

权限添加和修改:

使用Ajax组件

ModalPopupExtender

相关属性:

TargetControlID:设置触发事件的控件(如按钮)

PopupControlID:设置要显示的面板

BLL层的代码:

 public class UserManagerBLL
{
/// <summary>
/// 添加员工信息
/// </summary>
/// <param name="user">user</param>
public int UserMangerAdd(UserManager user)
{
SqlParameter[] pars = new SqlParameter[]{
new SqlParameter("@LoginName",user.LoginName),
new SqlParameter("@UserName",user.UserName),
new SqlParameter("@Password",user.Password),
new SqlParameter("@DepartmentId",user.DepartmentId),
new SqlParameter("@RoleId",user.RoleId),
new SqlParameter("@Birthday",user.Birthday),
new SqlParameter("@Mobile",user.Mobile),
new SqlParameter("@Email",user.Email),
new SqlParameter("@Photo",user.Photo),
new SqlParameter("@Address",user.Address),
new SqlParameter("@LastLoginDate",user.LastLoginDate),
new SqlParameter("@Sex",user.Sex),
new SqlParameter("@DisplayOrder",user.DisplayOrder),
new SqlParameter("@Sate",user.Sate)
}; return DataBaseHelper.ExcuteSqlReturnInt("UserManager_ADD", CommandType.StoredProcedure, pars);
} /// <summary>
/// 员工修改
/// </summary>
/// <param name="user">员工对象</param>
/// <returns>int</returns>
public int UserManagerUpdate(UserManager user)
{
SqlParameter[] pars = new SqlParameter[]{
new SqlParameter("@UserId",user.UserId),
new SqlParameter("@LoginName",user.LoginName),
new SqlParameter("@UserName",user.UserName),
new SqlParameter("@Password",user.Password),
new SqlParameter("@DepartmentId",user.DepartmentId),
new SqlParameter("@RoleId",user.RoleId),
new SqlParameter("@Birthday",user.Birthday),
new SqlParameter("@Mobile",user.Mobile),
new SqlParameter("@Email",user.Email),
new SqlParameter("@Photo",user.Photo),
new SqlParameter("@Address",user.Address),
new SqlParameter("@LastLoginDate",user.LastLoginDate),
new SqlParameter("@Sex",user.Sex),
new SqlParameter("@DisplayOrder",user.DisplayOrder),
new SqlParameter("@Sate",user.Sate)
}; return DataBaseHelper.ExcuteSqlReturnInt("UserManager_Update", CommandType.StoredProcedure, pars); } /// <summary>
/// 根据指定ID返回其对象
/// </summary>
/// <param name="id">userid</param>
/// <returns>UserManager</returns>
public UserManager getuserbyId(string id)
{
UserManager user = new UserManager();
SqlParameter[] pars = new SqlParameter[]{
new SqlParameter("@userid",id)
};
SqlDataReader reader = DataBaseHelper.SelectSQLReturnReader("getUserByid", CommandType.StoredProcedure, pars);
while (reader.Read())
{
user.LoginName = reader["LoginName"].ToString();
user.UserName = reader["UserName"].ToString();
user.DepartmentId =int.Parse(reader["DepartmentId"].ToString());
user.RoleId = int.Parse(reader["RoleId"].ToString());
user.Birthday =Convert.ToDateTime(reader["Birthday"].ToString());
user.Mobile = reader["Mobile"].ToString();
user.Email = reader["Email"].ToString();
user.Photo = reader["Photo"].ToString();
user.Address = reader["Address"].ToString();
user.LastLoginDate = Convert.ToDateTime(reader["LastLoginDate"].ToString());
user.Sex = reader["Sex"].ToString() == "True" ? true : false;
user.DisplayOrder =int.Parse( reader["DisplayOrder"].ToString());
user.Sate = reader["Sate"].ToString() == "True" ? true : false;
}
reader.Close(); return user; }
}

后台代码的实现:

protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
pagebind();
}
} public static int pageindex = 0;
public static int pagesize = 10;
public static string condition = "";
protected void pagebind()
{
this.AspNetPager1.RecordCount = SqlComm.getDataCountByCondition("tbRight", condition);
this.AspNetPager1.PageSize = pagesize;
this.GridView1.DataSource = SqlComm.getDataByPageIndex("tbRight", "*", "ID", condition, pageindex, pagesize);
this.GridView1.DataBind();
}
protected void btnAdd_Click(object sender, EventArgs e)
{
tbRight right = new tbRight();
UserRightMangerBLL rightbll = new UserRightMangerBLL();
right.RightName = this.txtRightName0.Text;
right.ReMark = this.txtReMark0.Text;
if (rightbll.UserRightAdd(right) == 0)
{
ScriptManager.RegisterStartupScript(this, this.GetType(), "test", "alert('提交失败')", true);
}
else
{
pagebind(); } } protected void AspNetPager1_PageChanged(object sender, EventArgs e)
{
pageindex = this.AspNetPager1.CurrentPageIndex - 1;
pagebind();
}
public static tbRight right1;
public static UserRightMangerBLL userrightbll;
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
if (e.CommandName == "imgEdit")//编辑
{
string id = e.CommandArgument.ToString();
userrightbll = new UserRightMangerBLL();
right1 = new tbRight();
right1= userrightbll.getUserRightByID(id);
this.txtRightName1.Text = right1.RightName;
this.txtReMark1.Text = right1.ReMark;
this.Modal_Update.Show();
} if (e.CommandName == "imgDelete")//删除单条记录
{
if (SqlComm.DeleteTableByCondition("dbo.tbRight", " where id='" + e.CommandArgument.ToString() + "'"))
{
pagebind();
}
} if (e.CommandName == "allcheck") //全选
{
for (int i = 0; i < this.GridView1.Rows.Count; i++)
{
((CheckBox)this.GridView1.Rows[i].FindControl("check_all")).Checked = true;
}
} if (e.CommandName == "recheck") //反选
{
for (int i = 0; i < this.GridView1.Rows.Count; i++)
{
if (((CheckBox)this.GridView1.Rows[i].FindControl("check_all")).Checked == true)
{
((CheckBox)this.GridView1.Rows[i].FindControl("check_all")).Checked = false;
}
else
{
((CheckBox)this.GridView1.Rows[i].FindControl("check_all")).Checked = true;
} }
} if (e.CommandName == "DeleteChecked")//删除选中的
{ for (int i = 0; i < this.GridView1.Rows.Count; i++)
{
if (((CheckBox)this.GridView1.Rows[i].FindControl("check_all")).Checked == true)
{
SqlComm.DeleteTableByCondition("tbRight", "where ID=" + this.GridView1.DataKeys[i].Value.ToString());
}
} pagebind(); }
} protected void btnUpdate_Click(object sender, EventArgs e)
{
right1.RightName = this.txtRightName1.Text;
right1.ReMark = this.txtReMark1.Text; if (userrightbll.UserRightUpdate(right1) != 0)
{
pagebind();
//ScriptManager.RegisterStartupScript(this, this.GetType(), "test", "alert('提交成功')", true);
} }

权限的设置:

界面的代码:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UserRightSet.aspx.cs" Inherits="BioErpWeb.HRSystem.UserRightSet" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<link href="../Styles/ERPBaseStyle.css" rel="stylesheet" type="text/css" />
<style type="text/css">
input{ width:60px; }
</style>
<script src="../JS/CheckUserName.js" type="text/javascript"></script>
</head>
<body>
<form id="form1" runat="server">
<div>
<table class="maintable">
<tr>
<td class="titlebar"><span>员工权限设置</span></td>
</tr>
<tr>
<td >
<asp:Label ID="lbUser" runat="server" Text="员工姓名"></asp:Label>
<asp:TextBox ID="txtUserName"
runat="server" ontextchanged="txtUserName_TextChanged"></asp:TextBox><asp:Button ID="btnCheckUser" Width="50px" runat="server" Text="选择" OnClientClick="showDialog()" />
</td>
</tr>
<tr>
<td>
<asp:CheckBoxList ID="cblRightList" RepeatLayout="Flow" RepeatDirection="Horizontal" runat="server">
</asp:CheckBoxList>
</td>
</tr>
<tr>
<td class="bottomtd">
<asp:Button ID="btnSave" Width="150" runat="server" Text="保存员工权限信息"
onclick="btnSave_Click" />
</td>
</tr> </table>
</div>
</form>
</body>
</html>

BLL层的代码:

      /// <summary>
/// 根据编号获取权限信息
/// </summary>
/// <param name="id">id</param>
/// <returns>tbRight</returns>
public tbRight getUserRightByID(string id)
{
SqlParameter[] pars = new SqlParameter[]{
new SqlParameter("@id",int.Parse(id))
}; tbRight right = new tbRight();
SqlDataReader reader= DataBaseHelper.SelectSQLReturnReader("getRightById", CommandType.StoredProcedure, pars);
if (reader.Read())
{
right.ID = int.Parse(id);
right.RightName = reader["RightName"].ToString();
right.ReMark = reader["ReMark"].ToString(); }
reader.Close();
return right; } /// <summary>
/// 给用户添加权限
/// </summary>
/// <param name="tbuserright">权限值</param>
/// <returns>int</returns>
public int addtbUserRight(tbUserRight tbuserright)
{
SqlParameter[] pars = new SqlParameter[]{
new SqlParameter("@RightID",tbuserright.RightID),
new SqlParameter("@UserID",tbuserright.UserID)
};
return DataBaseHelper.ExcuteSqlReturnInt("tbUserRight_Add", CommandType.StoredProcedure, pars);
}

UI层的代码:

 public partial class UserRightSet : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
RightListBind();
}
} public void RightListBind()
{
this.cblRightList.DataSource= SqlComm.GetDataByTableName("tbRight").Tables[0];
this.cblRightList.DataTextField = "RightName";
this.cblRightList.DataValueField = "ID";
this.cblRightList.DataBind();
} protected void txtUserName_TextChanged(object sender, EventArgs e)
{
if (txtUserName.Text != "请选择")
{
DataTable dt = SqlComm.GetDataByCondition("tbUserRight", "ID,UserID,RightID", " userid=" + this.txtUserName.Text.Trim()).Tables[0]; //每次重新选择用户后复选框列表中的数据重新设为Flase
CheckBoxListReset(); //重新绑定选中员工的权限至列表
for (int j = 0; j < dt.Rows.Count; j++)
{
for (int i = 0; i < cblRightList.Items.Count; i++)
{ if (cblRightList.Items[i].Value == dt.Rows[j]["RightID"].ToString())
{ cblRightList.Items[i].Selected = true; } }
}
}
}
/// <summary>
/// 重置复选框列表
/// </summary>
private void CheckBoxListReset()
{
for (int i = 0; i < cblRightList.Items.Count; i++)
{ cblRightList.Items[i].Selected = false;
}
} protected void btnSave_Click(object sender, EventArgs e)
{
if (this.txtUserName.Text.Trim() == "" || this.txtUserName.Text.Trim().Length == 0)
{
ClientScript.RegisterStartupScript(this.GetType(), "test", "<script>alert('请先选择要设置权限的用户')</script>");
return; } //删除指定用户的所有权限
DeleteUserRight(this.txtUserName.Text.Trim()); //通过循环遍历给指定用户添加相应权限值
for (int i = 0; i < cblRightList.Items.Count; i++)
{
if (cblRightList.Items[i].Selected)
{
AddUserRight(int.Parse(cblRightList.Items[i].Value.ToString()),int.Parse(this.txtUserName.Text.Trim()));
}
}
CheckBoxListReset();
//清空值
this.txtUserName.Text = ""; }
/// <summary>
/// 根据ID删除指定员工权限信息
/// </summary>
/// <param name="userid"></param>
/// <returns></returns>
private bool DeleteUserRight(string userid)
{
return SqlComm.DeleteTableByCondition("tbUserRight", " where UserID=" + userid); } /// <summary>
/// 给用户添加一个权限信息
/// </summary>
/// <param name="tbuserright">权限信息对象</param>
/// <returns></returns>
private int AddUserRight(int rightid,int userid)
{
UserRightMangerBLL userightbll = new UserRightMangerBLL();
//给用户权限对象赋值
tbUserRight tbuserright = new tbUserRight();
tbuserright.RightID = rightid;
tbuserright.UserID = userid;
//调用相应的业务方法实现给用户添加权限
return userightbll.addtbUserRight(tbuserright);
} }

添加权限的存储过程:

-- Description:	给用户添加一条权限信息
-- =============================================
ALTER PROCEDURE [dbo].[tbUserRight_Add]
@UserID int,
@RightID int
AS
BEGIN SET NOCOUNT ON;
INSERT tbUserRight
(
UserID,
RightID
)
VALUES
(
@UserID,
@RightID
) END

效果:

aaarticlea/png;base64,iVBORw0KGgoAAAANSUhEUgAAA1gAAACRCAIAAABR8o4eAAAPrElEQVR4nO3dwYsj150HcDHJ4qwdNmHxbHxcnNMuwTiEveWwezAmGMxedy+5eU8hJ9+GQAi55LI4EIMvuYTGPT05uWkL920yHXoIHQcnzpjMRgMOEx9E8jdkD21rpKr3fvVULbWq9D6PD4NUeipV/X5V0pdSd8/kxo2n+/ncjS9syRe+/NWnb/7rF7/ywjPPvfDMcy88/ey/PPUP//x3f//c55/6xxuf+9KNG1/svc12BwAYoH4f90899eVnnvmnq5j8zTAMwzAMw6hyCIKGYRiGYRiVjsns8Xwb/vfOXQAANmjjgU0QBAAYB0EQAKBSgiAAQKUEQQCASgmCAACVEgQBAColCAIAVEoQBAColCAIAFApQRDYS2++MgnGa9+96pqvsobea4t36uq7BlRHEAT2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Odbc/ssanlQxAEAPrbSBCctK60te8Gy8uvt/UOgo3olnxKY0IQBDu3pPG66yba8iEIAgD9bfyr4Tj0FF4z68xqwQbkHmpnwdyWJHck91quCDYIggAwGtv4GcHk3dlq/OrMi523Ozcg+bq5JbNUEGwvLNyS5Wm5UfL0ziEIAgD9bSkIBnFnJ1cES143CIK9rwiWb16/IQgCAP1t77eGOyNU8m5ycuEltPIgmLsiuPxCuWuB8aPJu4Xr7DEEQQCgv238jODy3VlZVEquLRnUOjeg89HCy43JUJhcW3BFMJc4O7e2cAiCAEB/1/kzgu3lyWxX/gVrO4Stm8lmfQNrybOCTU1uSY8hCAIA/W32v5gzrnkIggBAf4LgqIcgCAD0JwiOegiCAEB/F8bIx1W6LwgCAFRqZEEQAIANGk0QBABg4ARBAIBKCYIAAJUSBAEAKiUIAgBUShAEAKiUIAgAUClBEACgUoIgAEClBEEAgEoJggAAlRIEAQAqJQgCAFRKEAQAqJQgCABQKUEQAKBSgiAAQKUEQQCASgmCAACVEgQBAColCAIAVEoQBAColCAIAFCp/weqasBzs9Jp+AAAAABJRU5ErkJggg==" alt="" />

ERP权限系统(七)的更多相关文章

  1. ASP.NET通用权限系统快速开发框架

    系统在线演示地址: http://120.90.2.126:8051 登录账户:system,密码:system### DEMO下载地址: http://download.csdn.net/detai ...

  2. phpcms中的RBAC权限系统

    PHPCMS中的RBAC权限系统主要用到了4张数据表:管理员表,角色表,菜单表,菜单权限表.先来看看数据库的数据表结构: admin 管理员表 ID 字段 类型 Null 默认 索引 额外 注释 1 ...

  3. 基于资源的权限系统-API设计

    概述 权限系统需要和别的系统集成,因此,良好的API是易用性的保证. 这里只设计一些权限相关的核心 API,关于用户,组织,导入导出之类的后续再逐步补充 API 设计 围绕权限有以下 4 类 API: ...

  4. 高校手机签到系统——第一部分Authority权限系统(下)

    很抱歉,之前寝室光纤断了,所以到现在才更新这个系列的第二篇博客.点击访问高校手机签到系统——第一部分Authority权限系统(上) 这几天我反思了一下上一篇写博上的方式,一味的贴代码式的,是否应该更 ...

  5. ubuntu chmod 无法更改 文件夹权限 系统提示“不允许的操作 2、linux 如何修改只读文件 3、ubuntu安装

    1.ubuntu chmod 无法更改 文件夹权限 系统提示“不允许的操作 答案:需要超级用户权限 sudo 2.linux 如何修改只读文件 答案:可以使用chmod命令,为改文件提供其他的权限.u ...

  6. 以一个权限系统来告别WebForm —(一)项目整休架构设计与数据库设计

    在本节我想与大家与分享一下,我所将要做的权限系统的架构和数据库的表的设计.请各位大神们对我项目中设计的不足之处进行指导,让我得以更好的写完它,留给需要它的人. 我的项目架构如下图所示: 如上图所示,在 ...

  7. S2SH商用后台权限系统第二讲

    各位博友: 您好!我们今天接着上一讲继续学习S2SH商用后台权限系统,本讲我们重点设计下整个系统所需要的表结构. 用户表:记录用户信息. 角色表:标记用户归属的角色信息. 菜单表:或者叫模块表,记录整 ...

  8. S2SH商用后台权限系统第一讲

    各位博友: 您好!从今天开始我们做一套商用的权限系统.功能包含用户管理.角色管理.模块管理.权限管理.大家知道每个商用系统肯定会拥有一套后台系统,我们所讲的权限系统是整个系统核心部分.本套系统技术有s ...

  9. 权限系统与RBAC模型概述

    为了防止无良网站的爬虫抓取文章,特此标识,转载请注明文章出处.LaplaceDemon/SJQ. http://www.cnblogs.com/shijiaqi1066/p/3793894.html ...

随机推荐

  1. ZOJ 3826

    Hierarchical Notation Time Limit: 2 Seconds      Memory Limit: 131072 KB In Marjar University, stude ...

  2. js ——算法

    1.使用js 数组去重复: 方法①: var arr=[1,2,1,5,2,3,5,1,6,9]; function deRepeat(){ var newArray=[]; var obj={}; ...

  3. 7月13日微软MVP社区夏日巡讲北京站活动现场图集

    1.活动签到 2.活动准备工作,到场同学很多. 3.讲师讲桌 全体合影,由于我在楼下签到所以里面没有我:(  

  4. ruby在线学习

    http://tryruby.org/ [Heroku空间] 免费ruby空间

  5. The bundle does not contain an app icon for iPhone / iPod Touch of exactly '57x57' pixels

    遇到这个问题问题,搜索了一圈要么不知道,要么喊改deploymenet target, 最后我是在项目属性-info-icon files(ios5)-下面添加了一个icon,然后弄了个icon.pn ...

  6. ARM安装ROS- indigo

    Ubuntu ARM install of ROS Indigo 溪西创客小屋 There are currently builds of ROS for Ubuntu Trusty armhf. T ...

  7. bzoj 3687 bitset的运用

    题目大意: 小呆开始研究集合论了,他提出了关于一个数集四个问题:1. 子集的异或和的算术和.2. 子集的异或和的异或和.3. 子集的算术和的算术和.4. 子集的算术和的异或和.目前为止,小呆已经解决了 ...

  8. POJ3624

    题目大意: 给出珠宝的重量Wi和珠宝的价值Di,并给定一个重量范围M,在不超过M的情况下求取到的珠宝的最大值,N为列出珠宝的重量. #include <iostream> #include ...

  9. android之DOM生成与解析

    DOM解析不适合于进行大数据文件的操作,DOM解析适合于对文件进行修改和随机存取的操作. DOM生成 //判断一下是否存在sdcard if(!Environment.getExternalStora ...

  10. linux命令每日一练习-ls

    ls列出目录下所有文件 ls -l列出具体信息. drwxr-xr-x  9 root root      4096 2011-11-01 tomcat6.0.32 第一个d表示是目录,如果是-表示普 ...