Add method to ContentType to get the Content nodes that are of this type
This commit is contained in:
@@ -14,6 +14,7 @@ using umbraco.cms.businesslogic.web;
|
||||
using umbraco.DataLayer;
|
||||
using Tuple = System.Tuple;
|
||||
using umbraco.BusinessLogic;
|
||||
using umbraco.DataLayer.SqlHelpers.MySql;
|
||||
|
||||
[assembly: InternalsVisibleTo("Umbraco.Test")]
|
||||
|
||||
@@ -852,6 +853,30 @@ namespace umbraco.cms.businesslogic
|
||||
base.delete();
|
||||
}
|
||||
|
||||
public IEnumerable<System.Tuple<int, string>> GetContent()
|
||||
{
|
||||
List<System.Tuple<int, string>> list = new List<System.Tuple<int, string>>();
|
||||
bool mySQL = (SqlHelper.GetType() == typeof(MySqlHelper));
|
||||
string sql = string.Empty;
|
||||
if (!mySQL)
|
||||
{
|
||||
sql = "Select top (100) cmsContent.nodeid, cmsDocument.text from cmsContent join cmsDocument on cmsDocument.nodeId = cmsContent.nodeid where cmsdocument.published = 1 and cmscontent.contentType = " + this.Id;
|
||||
}
|
||||
else
|
||||
{
|
||||
sql = "Select cmsContent.nodeid, cmsDocument.text from cmsContent join cmsDocument on cmsDocument.nodeId = cmsContent.nodeid where cmsdocument.published = 1 and cmscontent.contentType = " + this.Id + " limit 0,100";
|
||||
}
|
||||
using (IRecordsReader dr = SqlHelper.ExecuteReader(sql))
|
||||
{
|
||||
while (dr.Read())
|
||||
{
|
||||
list.Add(new System.Tuple<int, string>(dr.GetInt("nodeid"), dr.GetString("text")));
|
||||
}
|
||||
dr.Close();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Protected Methods
|
||||
|
||||
Reference in New Issue
Block a user