protected void Button1_Click(object sender, EventArgs e)
        {
            BusinessFacade.sys_RolePermission_Move(RoleID, ApplicationID);
            string TempPageCodeString = "";
            string[] ArrayInt;
            int PageCodeValue = 0;
            sys_RolePermissionTable s_Rt = new sys_RolePermissionTable();
            s_Rt.DB_Option_Action_ = "Insert";
            s_Rt.P_ApplicationID = ApplicationID;
            s_Rt.P_RoleID = RoleID;
            foreach (string var in Request.Form)
            {
                if (var.Length > 8)
                {

                    TempPageCodeString = var.Substring(0, 8);
                    if (TempPageCodeString == "PageCode")
                    {
                        PageCodeValue = 0;
                        TempPageCodeString = var.Substring(8, var.Length - 8);
                        ArrayInt = Request.Form[var].Split(',');
                        for (int i = 0; i < ArrayInt.Length; i++)
                        {
                            //判断当前用户是否享有当前权限
                            if (UserData.CheckPageCode(GetRoleUserID, ApplicationID, TempPageCodeString, Convert.ToInt32(ArrayInt[i])))
                            {
                                PageCodeValue = PageCodeValue + Convert.ToInt32(ArrayInt[i]);
                            }
                        }
                        s_Rt.P_PageCode = TempPageCodeString;
                        s_Rt.P_Value = PageCodeValue;
                        BusinessFacade.sys_RolePermissionInsertUpdate(s_Rt);
                        
                    }

                }
            }
            UserData.Move_RoleUserPermissionCache(RoleID);

            UpdateRolesUserToRulesPermission(RoleID, ApplicationID);

            EventMessage.MessageBox(1, "操作成功", string.Format("修改角色({0})应用({1})权限成功!", RoleID, ApplicationID), Icon_Type.OK, Common.GetHomeBaseUrl(string.Format("RolePermissionManager.aspx?RoleID={0}&ApplicationID={1}&CMD=Look",RoleID,ApplicationID)));

        }
Example #2
0
 /// <summary>
 /// 新增/删除/修改 sys_RolePermission
 /// </summary>
 /// <param name="fam">sys_RolePermissionTable实体类</param>
 /// <returns>返回0操正常</returns>
 public override int sys_RolePermissionInsertUpdate(sys_RolePermissionTable fam)
 {
     int rInt = 0;
     using (SqlConnection Conn = GetSqlConnection())
     {
         SqlCommand cmd = new SqlCommand("sys_RolePermissionInsertUpdateDelete", Conn);
         cmd.CommandType = CommandType.StoredProcedure;
         //设置参数
         cmd.Parameters.Add("@DB_Option_Action_", SqlDbType.NVarChar).Value = fam.DB_Option_Action_; //操作方法 Insert:增加 Update:修改 Delete:删除 Disp:显示单笔记录
         cmd.Parameters.Add("@PermissionID", SqlDbType.Int).Value = fam.PermissionID;  //角色应用权限自动ID
         cmd.Parameters.Add("@P_RoleID", SqlDbType.Int).Value = fam.P_RoleID;  //角色ID与sys_Roles表中RoleID相
         cmd.Parameters.Add("@P_ApplicationID", SqlDbType.Int).Value = fam.P_ApplicationID;  //角色所属应用ID与sys_Applicatio	
         cmd.Parameters.Add("@P_PageCode", SqlDbType.VarChar).Value = fam.P_PageCode;  //角色应用中页面权限代码
         cmd.Parameters.Add("@P_Value", SqlDbType.Int).Value = fam.P_Value;  //权限值
         Conn.Open();
         rInt = Convert.ToInt32(cmd.ExecuteScalar());
         cmd.Dispose();
         Conn.Dispose();
         Conn.Close();
     }
     return rInt;
 }
Example #3
0
        /// <summary>
        /// 将记录集转为sys_RolePermissionTable实体类
        /// </summary>
        /// <param name="dr">记录集</param>
        /// <returns>sys_RolePermissionTable</returns>
        protected object Populatesys_RolePermission(IDataReader dr)
        {
            sys_RolePermissionTable nc = new sys_RolePermissionTable();

            if (!Convert.IsDBNull(dr["PermissionID"])) nc.PermissionID = Convert.ToInt32(dr["PermissionID"]); // 角色应用权限自动ID
            if (!Convert.IsDBNull(dr["P_RoleID"])) nc.P_RoleID = Convert.ToInt32(dr["P_RoleID"]); // 角色ID与sys_Roles表中RoleID相
            if (!Convert.IsDBNull(dr["P_ApplicationID"])) nc.P_ApplicationID = Convert.ToInt32(dr["P_ApplicationID"]); // 角色所属应用ID与sys_Applicatio
            if (!Convert.IsDBNull(dr["P_PageCode"])) nc.P_PageCode = Convert.ToString(dr["P_PageCode"]).Trim(); // 角色应用中页面权限代码
            if (!Convert.IsDBNull(dr["P_Value"])) nc.P_Value = Convert.ToInt32(dr["P_Value"]); // 权限值
            return nc;
        }
Example #4
0
 /// <summary>
 /// 新增/删除/修改 sys_RolePermission
 /// </summary>
 /// <param name="fam">sys_RolePermissionTable实体类</param>
 /// <returns>返回0操正常</returns>
 public abstract int sys_RolePermissionInsertUpdate(sys_RolePermissionTable fam);
Example #5
0
 /// <summary>
 /// 获取角色应用权限资料
 /// </summary>
 /// <param name="RoleID">角色ID</param>
 /// <param name="ApplicationID">应用ID</param>
 /// <param name="PageCode">PageCode</param>
 /// <returns></returns>
 public static sys_RolePermissionTable sys_RolePermissionDisp(int RoleID, int ApplicationID, string PageCode)
 {
     sys_RolePermissionTable s_Rp = new sys_RolePermissionTable();
     PageCode = Common.inSQL(PageCode);
     QueryParam qp = new QueryParam();
     qp.Where = string.Format("Where P_RoleID= {0} and P_ApplicationID={1} and P_PageCode='{2}'", RoleID, ApplicationID, PageCode);
     int RecordCount = 0;
     ArrayList lst = sys_RolePermissionList(qp, out RecordCount);
     if (lst.Count > 0)
     {
         s_Rp = (sys_RolePermissionTable)lst[0];
     }
     return s_Rp;
 }
Example #6
0
 /// <summary>
 /// 根据ID返回 sys_RolePermissionTable实体类 单笔资料
 /// </summary>
 /// <param name="PermissionID">角色应用权限自动ID</param>
 /// <returns>返回sys_RolePermissionTable实体类 PermissionID为0则无记录</returns>
 public static sys_RolePermissionTable sys_RolePermissionDisp(int PermissionID)
 {
     sys_RolePermissionTable fam = new sys_RolePermissionTable();
     QueryParam qp = new QueryParam();
     qp.PageIndex = 1;
     qp.PageSize = 1;
     qp.Where = " Where sys_RolePermission.PermissionID = " + PermissionID;
     int RecordCount = 0;
     ArrayList lst = sys_RolePermissionList(qp, out RecordCount);
     if (RecordCount > 0)
     {
         fam = (sys_RolePermissionTable)lst[0];
     }
     return fam;
 }
Example #7
0
 /// <summary>
 /// 新增/删除/修改 sys_RolePermission
 /// </summary>
 /// <param name="fam">sys_RolePermissionTable实体类</param>
 /// <returns>返回0操正常</returns>
 public static int sys_RolePermissionInsertUpdate(sys_RolePermissionTable fam)
 {
     return DataProvider.Instance().sys_RolePermissionInsertUpdate(fam);
 }