Files
Umbraco-CMS/umbraco/cms/businesslogic/ContentItem/ContentItem.cs
T
Shandem 9f1b3636d5 DO NOT DOWNLOAD, STABLE RELEASE AVAILABLE ON THE DOWNLOADS TAB
More data layer performance improvements

[TFS Changeset #60013]
2009-10-13 15:00:49 +00:00

86 lines
2.0 KiB
C#

using System;
namespace umbraco.cms.businesslogic.contentitem
{
/// <summary>
/// Summary description for ContentItem.
/// </summary>
public class ContentItem : Content
{
private static Guid _objectType = new Guid("10e2b09f-c28b-476d-b77a-aa686435e44a");
public ContentItem(int id) : base(id)
{
//
// TODO: Add constructor logic here
//
}
public ContentItem(Guid id) : base(id)
{
//
// TODO: Add constructor logic here
//
}
/// <summary>
/// Used to persist object changes to the database. In Version3.0 it's just a stub for future compatibility
/// </summary>
public override void Save()
{
base.Save();
}
public static void DeleteFromType(ContentItemType cit)
{
var objs = Content.getContentOfContentType(cit);
foreach (Content c in objs)
{
// due to recursive structure document might already been deleted..
if (CMSNode.IsNode(c.UniqueId))
{
ContentItem tmp = new ContentItem(c.UniqueId);
tmp.delete();
}
}
}
public static ContentItem MakeNew(string Name, ContentItemType cit, BusinessLogic.User u, int ParentId)
{
Guid newId = Guid.NewGuid();
// Updated to match level from base node
CMSNode n = new CMSNode(ParentId);
int newLevel = n.Level;
newLevel++;
CMSNode.MakeNew(ParentId,_objectType, u.Id, newLevel, Name, newId);
ContentItem tmp = new ContentItem(newId);
tmp.CreateContent(cit);
return tmp;
}
new public void delete()
{
foreach (ContentItem d in this.Children)
{
d.delete();
}
base.delete();
}
new public ContentItem[] Children
{
get
{
BusinessLogic.console.IconI[] tmp = base.Children;
ContentItem[] retval = new ContentItem[tmp.Length];
for (int i = 0; i < tmp.Length; i++) retval[i] = new ContentItem(tmp[i].UniqueId);
return retval;
}
}
}
}