public IList<Core.Business.RolePermissions> GetRolePermissionsByPID(int permissionID)
        {
            IList<Core.Business.RolePermissions> rolePermissionslist = new List<Core.Business.RolePermissions>();
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@PermissionsID", SqlDbType.Int, permissionID);
            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetRolePermissionsByPID);

            if (reader != null)
            {
                while (reader.Read())
                {
                    Core.Business.RolePermissions rolePermissions = new Core.Business.RolePermissions();

                    if (!reader.IsDBNull(0)) rolePermissions.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) rolePermissions.RoleID = reader.GetInt32(1);
                    if (!reader.IsDBNull(2)) rolePermissions.PermissionsID = reader.GetInt32(2);

                    rolePermissions.MarkOld();
                    rolePermissionslist.Add(rolePermissions);
                }
                reader.Close();
            }
            return rolePermissionslist;
        }
Beispiel #2
0
        public IList<Core.Business.RolePermissions> GetAllRolePermissions()
        {
            IList<Core.Business.RolePermissions> rolePermissionslist = new List<Core.Business.RolePermissions>();
            SqlServerUtility sql = new SqlServerUtility();

            SqlDataReader reader = sql.ExecuteSqlReader(SqlGetAllRolePermissions);

            if(reader != null)
            {
                while(reader.Read())
                {
                    Core.Business.RolePermissions rolePermissions = new Core.Business.RolePermissions();

                    if (!reader.IsDBNull(0)) rolePermissions.Id = reader.GetInt32(0);
                    if (!reader.IsDBNull(1)) rolePermissions.RoleKey = reader.GetInt32(1);
                    if (!reader.IsDBNull(2)) rolePermissions.PermissionsKey = reader.GetInt32(2);

                    rolePermissions.MarkOld();
                    rolePermissionslist.Add(rolePermissions);
                }
                reader.Close();
            }
            return rolePermissionslist;
        }
Beispiel #3
0
        public Core.Business.RolePermissions Select(int id)
        {
            SqlServerUtility sql = new SqlServerUtility();

            sql.AddParameter("@Id", SqlDbType.Int, id);
            SqlDataReader reader = sql.ExecuteSqlReader(SqlSelectRolePermissions);

            if (reader != null && !reader.IsClosed && reader.Read())
            {
                Core.Business.RolePermissions rolePermissions = new Core.Business.RolePermissions();

                if (!reader.IsDBNull(0)) rolePermissions.Id = reader.GetInt32(0);
                if (!reader.IsDBNull(1)) rolePermissions.RoleKey = reader.GetInt32(1);
                if (!reader.IsDBNull(2)) rolePermissions.PermissionsKey = reader.GetInt32(2);
                reader.Close();
                return rolePermissions;
            }
            else
            {
                if (reader != null && !reader.IsClosed)
                    reader.Close();

                return null;
            }
        }