GetWeblogs

/**//// <summary>
/// Returns all of the Weblogs for the current settingsID
/// </summary>
/// <returns></returns>
public override Hashtable GetWeblogs()
{
Hashtable weblogs = new Hashtable();
using( SqlConnection myConnection = GetSqlConnection() ) 
{
SqlCommand myCommand = new SqlCommand(databaseOwner + ".cs_weblog_Weblogs_Get", myConnection);
myCommand.CommandType = CommandType.StoredProcedure;

// Add Parameters to SPROC
myCommand.Parameters.Add(this.SettingsIDParameter());
// Execute the command
myConnection.Open();
SqlDataReader dr = myCommand.ExecuteReader(CommandBehavior.CloseConnection);
// Get the requested weblogs
//
Weblog w = null;
while (dr.Read()) 
{
w = new Weblog();
PopulateWeblogData(dr,w);
// add all weblogs into the Hashtable
//
weblogs.Add(w.ApplicationKey.ToLower(), w);
}
// Get the permissions
//
if (dr.NextResult()) 
{
while (dr.Read()) 
{
// Get the forum
//
string appKey = dr["ApplicationKey"] as string;
// Specific permissions
if (appKey != null)
{
w = weblogs[appKey.ToLower()] as Weblog;
if(w != null)
{
WeblogPermission bp = new WeblogPermission();
CommonDataProvider.PopulatePermissionFromIDataReader( bp, dr );
w.PermissionSet.Add(bp.Name, bp);
}
} else
{
// Global permissions
WeblogPermission bp = new WeblogPermission();
CommonDataProvider.PopulatePermissionFromIDataReader( bp, dr );

foreach (Weblog wb in weblogs.Values)
{
if(!wb.PermissionSet.ContainsKey(bp.Name))
wb.PermissionSet.Add(bp.Name,bp);
}
}
}

}
// Done with the reader and the connection
//
dr.Close();
myConnection.Close();
}
return weblogs;
}
浙公网安备 33010602011771号