Exemplo n.º 1
0
        private void AssignUpdateDates(UpdateContentContext context, CoeveryCommonPart part)
        {
            var utcNow = _clock.UtcNow;

            part.ModifiedUtc        = utcNow;
            part.VersionModifiedUtc = utcNow;
        }
Exemplo n.º 2
0
 protected void AssignCreatingOwner(CreateContentContext context, CoeveryCommonPart part)
 {
     // and use the current user as Owner
     if (part.Record.OwnerId == 0)
     {
         part.Owner = _authenticationService.GetAuthenticatedUser();
     }
 }
Exemplo n.º 3
0
        protected void AssignCreatingDates(CreateContentContext context, CoeveryCommonPart part)
        {
            // assign default create/modified dates
            part.Container = context.ContentItem;

            var utcNow = _clock.UtcNow;

            part.CreatedUtc         = utcNow;
            part.ModifiedUtc        = utcNow;
            part.VersionCreatedUtc  = utcNow;
            part.VersionModifiedUtc = utcNow;
        }
Exemplo n.º 4
0
        protected void AssignVersioningDates(VersionContentContext context, CoeveryCommonPart existing, CoeveryCommonPart building)
        {
            var utcNow = _clock.UtcNow;

            // assign the created date
            building.VersionCreatedUtc = utcNow;
            // assign modified date for the new version
            building.VersionModifiedUtc = utcNow;
            // publish date should be null until publish method called
            //building.VersionPublishedUtc = null;

            // assign the created
            building.CreatedUtc = existing.CreatedUtc ?? _clock.UtcNow;
            // persist any published dates
            //building.PublishedUtc = existing.PublishedUtc;
            // assign modified date for the new version
            building.ModifiedUtc = _clock.UtcNow;
        }
Exemplo n.º 5
0
        protected static void PropertySetHandlers(ActivatedContentContext context, CoeveryCommonPart part)
        {
            // add handlers that will update records when part properties are set

            part.OwnerField.Setter(user => {
                part.Record.OwnerId = user == null
                                          ? 0
                                          : user.ContentItem.Id;
                return(user);
            });

            // Force call to setter if we had already set a value
            if (part.OwnerField.Value != null)
            {
                part.OwnerField.Value = part.OwnerField.Value;
            }

            part.ModifierField.Setter(user => {
                part.Record.ModifierId = user == null
                                             ? 0 : user.ContentItem.Id;
                return(user);
            });
            // Force call to setter if we had already set a value
            if (part.ModifierField.Value != null)
            {
                part.ModifierField.Value = part.ModifierField.Value;
            }

            part.ContainerField.Setter(container => {
                part.Record.Container = container == null
                                            ? null : container.ContentItem.Record;
                return(container);
            });

            // Force call to setter if we had already set a value
            if (part.ContainerField.Value != null)
            {
                part.ContainerField.Value = part.ContainerField.Value;
            }
        }
Exemplo n.º 6
0
        //protected void AssignPublishingDates(PublishContentContext context, CommonPart part) {
        //    var utcNow = _clock.UtcNow;
        //    part.PublishedUtc = utcNow;
        //    part.VersionPublishedUtc = utcNow;
        //}

        protected void LazyLoadHandlers(CoeveryCommonPart part)
        {
            // add handlers that will load content for id's just-in-time
            part.OwnerField.Loader(() => _contentManager.Get <IUser>(part.Record.OwnerId));
            part.ContainerField.Loader(() => part.Record.Container == null ? null : _contentManager.Get(part.Record.Container.Id));
        }
Exemplo n.º 7
0
 private void AssignUpdateUser(UpdateContentContext context, CoeveryCommonPart part)
 {
     part.Modifer = _authenticationService.GetAuthenticatedUser();
 }
Exemplo n.º 8
0
 protected void AssignCreatingOwner(CreateContentContext context, CoeveryCommonPart part) {
     // and use the current user as Owner
     if (part.Record.OwnerId == 0) {
         part.Owner = _authenticationService.GetAuthenticatedUser();
     }
 }
Exemplo n.º 9
0
        protected void AssignCreatingDates(CreateContentContext context, CoeveryCommonPart part) {
            // assign default create/modified dates
            part.Container = context.ContentItem;

            var utcNow = _clock.UtcNow;
            part.CreatedUtc = utcNow;
            part.ModifiedUtc = utcNow;
            part.VersionCreatedUtc = utcNow;
            part.VersionModifiedUtc = utcNow;
        }
Exemplo n.º 10
0
        protected static void PropertySetHandlers(ActivatedContentContext context, CoeveryCommonPart part) {
            // add handlers that will update records when part properties are set

            part.OwnerField.Setter(user => {
                part.Record.OwnerId = user == null
                                          ? 0
                                          : user.ContentItem.Id;
                return user;
            });

            // Force call to setter if we had already set a value
            if (part.OwnerField.Value != null)
                part.OwnerField.Value = part.OwnerField.Value;

            part.ModifierField.Setter(user => {
                part.Record.ModifierId = user == null
                                             ? 0 : user.ContentItem.Id;
                return user;
            });
            // Force call to setter if we had already set a value
            if (part.ModifierField.Value != null)
                part.ModifierField.Value = part.ModifierField.Value;

            part.ContainerField.Setter(container => {
                part.Record.Container = container == null
                                            ? null : container.ContentItem.Record;
                return container;
            });

            // Force call to setter if we had already set a value
            if (part.ContainerField.Value != null)
                part.ContainerField.Value = part.ContainerField.Value;
        }
Exemplo n.º 11
0
        //protected void AssignPublishingDates(PublishContentContext context, CommonPart part) {
        //    var utcNow = _clock.UtcNow;
        //    part.PublishedUtc = utcNow;
        //    part.VersionPublishedUtc = utcNow;
        //}

        protected void LazyLoadHandlers(CoeveryCommonPart part) {
            // add handlers that will load content for id's just-in-time
            part.OwnerField.Loader(() => _contentManager.Get<IUser>(part.Record.OwnerId));
            part.ContainerField.Loader(() => part.Record.Container == null ? null : _contentManager.Get(part.Record.Container.Id));
        }
Exemplo n.º 12
0
        protected void AssignVersioningDates(VersionContentContext context, CoeveryCommonPart existing, CoeveryCommonPart building) {
            var utcNow = _clock.UtcNow;

            // assign the created date
            building.VersionCreatedUtc = utcNow;
            // assign modified date for the new version
            building.VersionModifiedUtc = utcNow;
            // publish date should be null until publish method called
            //building.VersionPublishedUtc = null;

            // assign the created
            building.CreatedUtc = existing.CreatedUtc ?? _clock.UtcNow;
            // persist any published dates
            //building.PublishedUtc = existing.PublishedUtc;
            // assign modified date for the new version
            building.ModifiedUtc = _clock.UtcNow;
        }
Exemplo n.º 13
0
 private void AssignUpdateDates(UpdateContentContext context, CoeveryCommonPart part) {
     var utcNow = _clock.UtcNow;
     part.ModifiedUtc = utcNow;
     part.VersionModifiedUtc = utcNow;
 }
Exemplo n.º 14
0
 private void AssignUpdateUser(UpdateContentContext context, CoeveryCommonPart part) {
     part.Modifer = _authenticationService.GetAuthenticatedUser();
 }