Exemple #1
0
        /// <summary>
        /// Get all the roles form the database.
        /// </summary>
        /// <returns>List of Rles</returns>
        public List <RBACD.DatalayerDef.sRole> GetAllRoles()
        {
            List <RBACD.DatalayerDef.sRole> sRoleList = new List <RBACD.DatalayerDef.sRole>();
            DataSet ds  = new DataSet();
            string  sql = string.Empty;

            try
            {
                sql = "Select securitygroupid,name,displayname from securitygroups order by name";
                IDbConnection con       = this.DbConnection;
                IDbCommand    dbCommand = DbConnection.CreateCommand();
                dbCommand.CommandText = sql;
                IDataReader DataReader = dbCommand.ExecuteReader();

                while (DataReader.Read())
                {
                    RBACD.DatalayerDef.sRole srole = new RBACD.DatalayerDef.sRole();
                    srole.RoleId         = DataReader[0].ToString();
                    srole.RoleName       = DataReader[1].ToString();
                    srole.RoleDescrition = DataReader[2].ToString();
                    sRoleList.Add(srole);
                }
                return(sRoleList);
            }
            catch
            {
                return(sRoleList);
            }
        }
Exemple #2
0
        /// <summary>
        /// Get all the roles form the database.
        /// </summary>
        /// <returns>List of Rles</returns>
        public List<RBACD.DatalayerDef.sRole> GetAllRoles()
        {
            List<RBACD.DatalayerDef.sRole> sRoleList = new List<RBACD.DatalayerDef.sRole>();
            DataSet ds = new DataSet();
            string sql = string.Empty;
            try
            {
                sql = "Select securitygroupid,name,displayname from securitygroups order by name";
                IDbConnection con = this.DbConnection;
                IDbCommand dbCommand = DbConnection.CreateCommand();
                dbCommand.CommandText = sql;
                IDataReader DataReader = dbCommand.ExecuteReader();

                while (DataReader.Read())
                {
                    RBACD.DatalayerDef.sRole srole = new RBACD.DatalayerDef.sRole();
                    srole.RoleId = DataReader[0].ToString();
                    srole.RoleName = DataReader[1].ToString();
                    srole.RoleDescrition = DataReader[2].ToString();
                    sRoleList.Add(srole);
                }
                return sRoleList;
            }
            catch
            {
                return sRoleList;
            }
        }