Rock.Model.HistoryService.SaveChanges C# (CSharp) Method

SaveChanges() public static method

Saves a list of history messages.
public static SaveChanges ( RockContext rockContext, Type modelType, System.Guid categoryGuid, int entityId, List changes, bool commitSave = true, int modifiedByPersonAliasId = null ) : void
rockContext Rock.Data.RockContext The rock context.
modelType System.Type Type of the model.
categoryGuid System.Guid The category unique identifier.
entityId int The entity identifier.
changes List The changes.
commitSave bool if set to true [commit save].
modifiedByPersonAliasId int The modified by person alias identifier.
return void
        public static void SaveChanges( RockContext rockContext, Type modelType, Guid categoryGuid, int entityId, List<string> changes, bool commitSave = true, int? modifiedByPersonAliasId = null )
        {
            SaveChanges( rockContext, modelType, categoryGuid, entityId, changes, null, null, null, commitSave, modifiedByPersonAliasId );
        }

Same methods

HistoryService::SaveChanges ( RockContext rockContext, Type modelType, System.Guid categoryGuid, int entityId, List changes, string caption, Type relatedModelType, int relatedEntityId, bool commitSave = true, int modifiedByPersonAliasId = null ) : void

Usage Example

Ejemplo n.º 1
0
        /// <summary>
        /// Posts the save changes.
        /// </summary>
        /// <param name="dbContext">The database context.</param>
        public override void PostSaveChanges(Data.DbContext dbContext)
        {
            var rockContext = dbContext as RockContext;

            if (GroupHistoryChanges != null && GroupHistoryChanges.Any())
            {
                HistoryService.SaveChanges(rockContext, typeof(Group), Rock.SystemGuid.Category.HISTORY_GROUP_CHANGES.AsGuid(), GroupId, GroupHistoryChanges, true, this.ModifiedByPersonAliasId);
            }

            // If this is a Group of type Family, update the ModifiedDateTime on the Persons that are members of this family (since one of their Addresses changed)
            int groupTypeIdFamily = GroupTypeCache.GetFamilyGroupType().Id;
            var groupService      = new GroupService(rockContext);

            int groupTypeId = groupService.GetSelect(this.GroupId, s => s.GroupTypeId);

            if (groupTypeId == groupTypeIdFamily)
            {
                var currentDateTime    = RockDateTime.Now;
                var qryPersonsToUpdate = new GroupMemberService(rockContext).Queryable().Where(a => a.GroupId == this.GroupId).Select(a => a.Person);
                rockContext.BulkUpdate(qryPersonsToUpdate, p => new Person {
                    ModifiedDateTime = currentDateTime, ModifiedByPersonAliasId = this.ModifiedByPersonAliasId
                });
            }

            base.PostSaveChanges(dbContext);
        }
All Usage Examples Of Rock.Model.HistoryService::SaveChanges