/// <summary> /// Copies the properties from another StreakTypeAchievementType object to this StreakTypeAchievementType object /// </summary> /// <param name="target">The target.</param> /// <param name="source">The source.</param> public static void CopyPropertiesFrom(this StreakTypeAchievementType target, StreakTypeAchievementType source) { target.Id = source.Id; target.AchievementEntityTypeId = source.AchievementEntityTypeId; target.AchievementFailureWorkflowTypeId = source.AchievementFailureWorkflowTypeId; target.AchievementIconCssClass = source.AchievementIconCssClass; target.AchievementStartWorkflowTypeId = source.AchievementStartWorkflowTypeId; target.AchievementStepStatusId = source.AchievementStepStatusId; target.AchievementStepTypeId = source.AchievementStepTypeId; target.AchievementSuccessWorkflowTypeId = source.AchievementSuccessWorkflowTypeId; target.AllowOverAchievement = source.AllowOverAchievement; target.BadgeLavaTemplate = source.BadgeLavaTemplate; target.CategoryId = source.CategoryId; target.Description = source.Description; target.ForeignGuid = source.ForeignGuid; target.ForeignKey = source.ForeignKey; target.IsActive = source.IsActive; target.MaxAccomplishmentsAllowed = source.MaxAccomplishmentsAllowed; target.Name = source.Name; target.ResultsLavaTemplate = source.ResultsLavaTemplate; target.StreakTypeId = source.StreakTypeId; target.CreatedDateTime = source.CreatedDateTime; target.ModifiedDateTime = source.ModifiedDateTime; target.CreatedByPersonAliasId = source.CreatedByPersonAliasId; target.ModifiedByPersonAliasId = source.ModifiedByPersonAliasId; target.Guid = source.Guid; target.ForeignId = source.ForeignId; }
/// <summary> /// Deletes the specified item. /// </summary> /// <param name="item">The item.</param> /// <returns></returns> public override bool Delete(StreakTypeAchievementType item) { // Since Entity Framework cannot cascade delete dependent prerequisites because of a possible circular reference, // we need to delete them here var prerequisiteService = new StreakTypeAchievementTypePrerequisiteService(Context as RockContext); var dependencyQuery = prerequisiteService.Queryable().Where(statp => statp.PrerequisiteStreakTypeAchievementTypeId == item.Id); prerequisiteService.DeleteRange(dependencyQuery); // Now we can delete the item as normal return(base.Delete(item)); }
/// <summary> /// Clones this StreakTypeAchievementType object to a new StreakTypeAchievementType object /// </summary> /// <param name="source">The source.</param> /// <param name="deepCopy">if set to <c>true</c> a deep copy is made. If false, only the basic entity properties are copied.</param> /// <returns></returns> public static StreakTypeAchievementType Clone(this StreakTypeAchievementType source, bool deepCopy) { if (deepCopy) { return(source.Clone() as StreakTypeAchievementType); } else { var target = new StreakTypeAchievementType(); target.CopyPropertiesFrom(source); return(target); } }