public virtual ChannelSettings Copy(TemplateDefinitionVersion version, litePerson person, String ipAddrees, String ipProxyAddress) { ChannelSettings n = new ChannelSettings(); n.CreateMetaInfo(person, ipAddrees, ipProxyAddress); n.Version = version; n.Channel = Channel; n.MailSettings = MailSettings; n.IsEnabled = IsEnabled; return(n); }
public virtual TemplateDefinitionVersion Copy(TemplateDefinition template, litePerson person, String ipAddrees, String ipProxyAddress, String namePrefix = "") { TemplateDefinitionVersion tv = new TemplateDefinitionVersion(); tv.CreateMetaInfo(person, ipAddrees, ipProxyAddress); tv.Template = template; tv.DefaultTranslation = DefaultTranslation.Copy(); if (!string.IsNullOrEmpty(namePrefix)) { tv.DefaultTranslation.Name = namePrefix + tv.DefaultTranslation.Name; } tv.Status = Status; tv.Owner = person; tv.HasShortText = HasShortText; tv.OnlyShortText = OnlyShortText; if (Translations != null) { foreach (TemplateTranslation tt in Translations.Where(t => t.Deleted == BaseStatusDeleted.None).ToList()) { tv.Translations.Add(tt.Copy(tv, person, ipAddrees, ipProxyAddress, namePrefix)); } } if (ModulesForContent != null) { foreach (TemplateModuleContent mc in ModulesForContent.Where(t => t.Deleted == BaseStatusDeleted.None && t.IsActive).ToList()) { tv.ModulesForContent.Add(mc.Copy(tv, mc.IsActive)); } } if (ChannelSettings != null) { foreach (ChannelSettings ns in ChannelSettings.Where(t => t.Deleted == BaseStatusDeleted.None).ToList()) { tv.ChannelSettings.Add(ns.Copy(tv, person, ipAddrees, ipProxyAddress)); } } if (Permissions != null) { foreach (VersionPermission ns in Permissions.Where(t => t.Deleted == BaseStatusDeleted.None).ToList()) { switch (ns.Type) { case PermissionType.Community: tv.Permissions.Add(((VersionCommunityPermission)ns).Copy(template, tv, person, ipAddrees, ipProxyAddress)); break; case PermissionType.Module: break; case PermissionType.Owner: tv.Permissions.Add(((VersionOwnerPermission)ns).Copy(template, tv, person, ipAddrees, ipProxyAddress)); break; case PermissionType.Person: tv.Permissions.Add(((VersionPersonPermission)ns).Copy(template, tv, person, ipAddrees, ipProxyAddress)); break; case PermissionType.ProfileType: tv.Permissions.Add(((VersionProfileTypePermission)ns).Copy(template, tv, person, ipAddrees, ipProxyAddress)); break; case PermissionType.Role: tv.Permissions.Add(((VersionRolePermission)ns).Copy(template, tv, person, ipAddrees, ipProxyAddress)); break; } } } return(tv); }