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++)
                        {
                            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);
            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)));
        }
Exemplo n.º 2
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;
        }
Exemplo n.º 3
0
 /// <summary>
 /// 新增/删除/修改 sys_RolePermission
 /// </summary>
 /// <param name="fam">sys_RolePermissionTable实体类</param>
 /// <returns>返回0操正常</returns>
 public abstract int sys_RolePermissionInsertUpdate(sys_RolePermissionTable fam);
Exemplo n.º 4
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 (OracleConnection Conn = GetSqlConnection())
            {
                string CommTxt;
                OracleCommand cmd = new OracleCommand();
                cmd.Connection = Conn;
                if (fam.DB_Option_Action_ == "Insert")
                {
                    CommTxt = "Insert into 	sys_RolePermission(PermissionID,P_RoleID,P_ApplicationID,P_PageCode,P_Value)VALUES(SEQ_sys_RolePermission_ID.NEXTVAL,:P_RoleID,:P_ApplicationID,:P_PageCode,:P_Value)";
                    cmd.CommandText = CommTxt;

                    cmd.Parameters.Add("P_RoleID", OracleType.Int32).Value = fam.P_RoleID; //��ɫID��sys_Roles����RoleID��
                    cmd.Parameters.Add("P_ApplicationID", OracleType.Int32).Value = fam.P_ApplicationID; //��ɫ����Ӧ��ID��sys_Applicatio
                    cmd.Parameters.Add("P_PageCode", OracleType.VarChar).Value = fam.P_PageCode + ""; //��ɫӦ����ҳ��Ȩ�޴���
                    cmd.Parameters.Add("P_Value", OracleType.Int32).Value = fam.P_Value; //Ȩ��ֵ
                }
                else if (fam.DB_Option_Action_ == "Update")
                {

                    CommTxt = "UPDATE sys_RolePermission SET	P_RoleID = :P_RoleID,P_ApplicationID = :P_ApplicationID,P_PageCode = :P_PageCode,P_Value = :P_Value WHERE (PermissionID = :PermissionID)";
                    cmd.CommandText = CommTxt;

                    cmd.Parameters.Add("P_RoleID", OracleType.Int32).Value = fam.P_RoleID; //��ɫID��sys_Roles����RoleID��
                    cmd.Parameters.Add("P_ApplicationID", OracleType.Int32).Value = fam.P_ApplicationID; //��ɫ����Ӧ��ID��sys_Applicatio
                    cmd.Parameters.Add("P_PageCode", OracleType.VarChar).Value = fam.P_PageCode + ""; //��ɫӦ����ҳ��Ȩ�޴���
                    cmd.Parameters.Add("P_Value", OracleType.Int32).Value = fam.P_Value; //Ȩ��ֵ
                    cmd.Parameters.Add("PermissionID", OracleType.Int32).Value = fam.PermissionID;
                }
                else if (fam.DB_Option_Action_ == "Delete")
                {
                    CommTxt = "Delete from  sys_RolePermission  WHERE (PermissionID = :PermissionID)";
                    cmd.CommandText = CommTxt;
                    cmd.Parameters.Add("PermissionID", OracleType.Int32).Value = fam.PermissionID;
                }
                else
                    throw new ApplicationException("�޷�ʶ��IJ�������!");
                Conn.Open();
                OracleTransaction Tran = Conn.BeginTransaction();
                cmd.Transaction = Tran;
                try
                {
                    rInt = cmd.ExecuteNonQuery();
                    cmd.Parameters.Clear();
                    if (fam.DB_Option_Action_ == "Insert")
                    {
                        cmd.CommandText = "select SEQ_sys_RolePermission_ID.CURRVAL from  dual";
                        rInt = Convert.ToInt32(cmd.ExecuteScalar());
                    }
                    Tran.Commit();
                }
                catch (Exception ex)
                {
                    Tran.Rollback();
                    throw new ApplicationException(ex.ToString());
                }
                finally
                {
                    Tran.Dispose();
                    cmd.Dispose();
                    Conn.Dispose();
                    Conn.Close();
                }
            }
            return rInt;
        }
        /// <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 (OleDbConnection Conn = GetSqlConnection())
            {
                string CommTxt;
                OleDbCommand cmd = new OleDbCommand();
                cmd.Connection = Conn;
                if (fam.DB_Option_Action_ == "Insert")
                {
                    CommTxt = "Insert into 	sys_RolePermission(P_RoleID,P_ApplicationID,P_PageCode,P_Value)VALUES(@P_RoleID,@P_ApplicationID,@P_PageCode,@P_Value)";
                    cmd.CommandText = CommTxt;

                    cmd.Parameters.Add("@P_RoleID", OleDbType.Integer).Value = fam.P_RoleID; //角色ID与sys_Roles表中RoleID相	
                    cmd.Parameters.Add("@P_ApplicationID", OleDbType.Integer).Value = fam.P_ApplicationID; //角色所属应用ID与sys_Applicatio	
                    cmd.Parameters.Add("@P_PageCode", OleDbType.VarWChar).Value = fam.P_PageCode + ""; //角色应用中页面权限代码	
                    cmd.Parameters.Add("@P_Value", OleDbType.Integer).Value = fam.P_Value; //权限值
                }
                else if (fam.DB_Option_Action_ == "Update")
                {

                    CommTxt = "UPDATE sys_RolePermission SET	P_RoleID = @P_RoleID,P_ApplicationID = @P_ApplicationID,P_PageCode = @P_PageCode,P_Value = @P_Value WHERE (PermissionID = @PermissionID)";
                    cmd.CommandText = CommTxt;

                    cmd.Parameters.Add("@P_RoleID", OleDbType.Integer).Value = fam.P_RoleID; //角色ID与sys_Roles表中RoleID相	
                    cmd.Parameters.Add("@P_ApplicationID", OleDbType.Integer).Value = fam.P_ApplicationID; //角色所属应用ID与sys_Applicatio	
                    cmd.Parameters.Add("@P_PageCode", OleDbType.VarWChar).Value = fam.P_PageCode + ""; //角色应用中页面权限代码	
                    cmd.Parameters.Add("@P_Value", OleDbType.Integer).Value = fam.P_Value; //权限值
                    cmd.Parameters.Add("@PermissionID", OleDbType.Integer).Value = fam.PermissionID;
                }
                else if (fam.DB_Option_Action_ == "Delete")
                {
                    CommTxt = "Delete from  sys_RolePermission  WHERE (PermissionID = @PermissionID)";
                    cmd.CommandText = CommTxt;
                    cmd.Parameters.Add("@PermissionID", OleDbType.Integer).Value = fam.PermissionID;
                }
                else
                    throw new ApplicationException("无法识别的操作命令!");
                Conn.Open();
                rInt = cmd.ExecuteNonQuery();
                if (fam.DB_Option_Action_ == "Insert")
                {
                    cmd.CommandText = "SELECT @@identity";
                    rInt = Convert.ToInt32(cmd.ExecuteScalar());
                }
                cmd.Dispose();
                Conn.Dispose();
                Conn.Close();
            }
            return rInt;
        }
Exemplo n.º 6
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);
 }
Exemplo n.º 7
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;
 }
Exemplo n.º 8
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;
 }
Exemplo n.º 9
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;
 }