private void AssignUpdateDates(UpdateContentContext context, CoeveryCommonPart part) { var utcNow = _clock.UtcNow; part.ModifiedUtc = utcNow; part.VersionModifiedUtc = utcNow; }
protected void AssignCreatingOwner(CreateContentContext context, CoeveryCommonPart part) { // and use the current user as Owner if (part.Record.OwnerId == 0) { part.Owner = _authenticationService.GetAuthenticatedUser(); } }
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; }
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; }
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; } }
//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)); }
private void AssignUpdateUser(UpdateContentContext context, CoeveryCommonPart part) { part.Modifer = _authenticationService.GetAuthenticatedUser(); }
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; }
//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)); }