mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
106 lines
2.9 KiB
C#
106 lines
2.9 KiB
C#
using System;
|
|
using Orchard.ContentManagement;
|
|
using Orchard.ContentManagement.Aspects;
|
|
using Orchard.ContentManagement.Utilities;
|
|
using Orchard.Security;
|
|
|
|
namespace Orchard.Core.Common.Models
|
|
{
|
|
public class CommonPart : ContentPart<CommonPartRecord>, ICommonPart
|
|
{
|
|
public LazyField<IUser> OwnerField { get; } = new LazyField<IUser>();
|
|
|
|
public LazyField<IContent> ContainerField { get; } = new LazyField<IContent>();
|
|
|
|
public IUser Owner
|
|
{
|
|
get { return OwnerField.Value; }
|
|
set { OwnerField.Value = value; }
|
|
}
|
|
|
|
public IContent Container
|
|
{
|
|
get { return ContainerField.Value; }
|
|
set { ContainerField.Value = value; }
|
|
}
|
|
|
|
public DateTime? CreatedUtc
|
|
{
|
|
get { return Retrieve(x => x.CreatedUtc); }
|
|
set { Store(x => x.CreatedUtc, value); }
|
|
}
|
|
|
|
public DateTime? PublishedUtc
|
|
{
|
|
get { return Retrieve(x => x.PublishedUtc); }
|
|
set { Store(x => x.PublishedUtc, value); }
|
|
}
|
|
|
|
public DateTime? ModifiedUtc
|
|
{
|
|
get { return Retrieve(x => x.ModifiedUtc); }
|
|
set { Store(x => x.ModifiedUtc, value); }
|
|
}
|
|
|
|
CommonPartVersionRecord PartVersionRecord
|
|
{
|
|
get
|
|
{
|
|
var versionPart = this.As<ContentPart<CommonPartVersionRecord>>();
|
|
return versionPart == null ? null : versionPart.Record;
|
|
}
|
|
}
|
|
|
|
public DateTime? VersionCreatedUtc
|
|
{
|
|
get
|
|
{
|
|
return PartVersionRecord == null ? CreatedUtc : PartVersionRecord.CreatedUtc;
|
|
}
|
|
set
|
|
{
|
|
if (PartVersionRecord != null)
|
|
PartVersionRecord.CreatedUtc = value;
|
|
}
|
|
}
|
|
public string VersionModifiedBy
|
|
{
|
|
get
|
|
{
|
|
return PartVersionRecord == null ? null : PartVersionRecord.ModifiedBy;
|
|
}
|
|
set
|
|
{
|
|
if (PartVersionRecord != null)
|
|
PartVersionRecord.ModifiedBy = value;
|
|
}
|
|
}
|
|
|
|
public DateTime? VersionPublishedUtc
|
|
{
|
|
get
|
|
{
|
|
return PartVersionRecord == null ? PublishedUtc : PartVersionRecord.PublishedUtc;
|
|
}
|
|
set
|
|
{
|
|
if (PartVersionRecord != null)
|
|
PartVersionRecord.PublishedUtc = value;
|
|
}
|
|
}
|
|
|
|
public DateTime? VersionModifiedUtc
|
|
{
|
|
get
|
|
{
|
|
return PartVersionRecord == null ? ModifiedUtc : PartVersionRecord.ModifiedUtc;
|
|
}
|
|
set
|
|
{
|
|
if (PartVersionRecord != null)
|
|
PartVersionRecord.ModifiedUtc = value;
|
|
}
|
|
}
|
|
}
|
|
}
|