private static string GetDcElementContent(ScopedElementCollection additionalElements, string name, string defaultContent = "") { var localName = Prefix + name; var element = additionalElements.FindScopedElementByLocalName(localName); return(element != null ? element.Content : defaultContent); }
public static ScopedElement GetDcElement(ScopedElementCollection additionalElements, string name) { var localName = Prefix + name; var element = additionalElements.FindScopedElementByLocalName(localName); return(element); }
private static void AddDcElement(ScopedElementCollection collection, string name, string content) { if (!string.IsNullOrEmpty(content)) { collection.Add(new DcElement(Prefix + name, ToXmlContent(content))); } }
public void ImportNodeInfo(ChannelInfo nodeInfo, ScopedElementCollection additionalElements, int parentId, IList indexNameList) { nodeInfo.ChannelName = AtomUtility.GetDcElementContent(additionalElements, new List <string> { ChannelAttribute.ChannelName, "NodeName" }); nodeInfo.SiteId = _siteInfo.Id; var contentModelPluginId = AtomUtility.GetDcElementContent(additionalElements, ChannelAttribute.ContentModelPluginId); if (!string.IsNullOrEmpty(contentModelPluginId)) { nodeInfo.ContentModelPluginId = contentModelPluginId; } var contentRelatedPluginIds = AtomUtility.GetDcElementContent(additionalElements, ChannelAttribute.ContentRelatedPluginIds); if (!string.IsNullOrEmpty(contentRelatedPluginIds)) { nodeInfo.ContentRelatedPluginIds = contentRelatedPluginIds; } nodeInfo.ParentId = parentId; var indexName = AtomUtility.GetDcElementContent(additionalElements, new List <string> { ChannelAttribute.IndexName, "NodeIndexName" }); if (!string.IsNullOrEmpty(indexName) && indexNameList.IndexOf(indexName) == -1) { nodeInfo.IndexName = indexName; indexNameList.Add(indexName); } nodeInfo.GroupNameCollection = AtomUtility.GetDcElementContent(additionalElements, new List <string> { ChannelAttribute.GroupNameCollection, "NodeGroupNameCollection" }); nodeInfo.AddDate = DateTime.Now; nodeInfo.ImageUrl = AtomUtility.GetDcElementContent(additionalElements, ChannelAttribute.ImageUrl); nodeInfo.Content = AtomUtility.Decrypt(AtomUtility.GetDcElementContent(additionalElements, ChannelAttribute.Content)); nodeInfo.FilePath = AtomUtility.GetDcElementContent(additionalElements, ChannelAttribute.FilePath); nodeInfo.ChannelFilePathRule = AtomUtility.GetDcElementContent(additionalElements, ChannelAttribute.ChannelFilePathRule); nodeInfo.ContentFilePathRule = AtomUtility.GetDcElementContent(additionalElements, ChannelAttribute.ContentFilePathRule); nodeInfo.LinkUrl = AtomUtility.GetDcElementContent(additionalElements, ChannelAttribute.LinkUrl); nodeInfo.LinkType = AtomUtility.GetDcElementContent(additionalElements, ChannelAttribute.LinkType); var channelTemplateName = AtomUtility.GetDcElementContent(additionalElements, ChannelTemplateName); if (!string.IsNullOrEmpty(channelTemplateName)) { nodeInfo.ChannelTemplateId = TemplateManager.GetTemplateIdByTemplateName(_siteInfo.Id, TemplateType.ChannelTemplate, channelTemplateName); } var contentTemplateName = AtomUtility.GetDcElementContent(additionalElements, ContentTemplateName); if (!string.IsNullOrEmpty(contentTemplateName)) { nodeInfo.ContentTemplateId = TemplateManager.GetTemplateIdByTemplateName(_siteInfo.Id, TemplateType.ContentTemplate, contentTemplateName); } nodeInfo.Keywords = AtomUtility.GetDcElementContent(additionalElements, ChannelAttribute.Keywords); nodeInfo.Description = AtomUtility.GetDcElementContent(additionalElements, ChannelAttribute.Description); nodeInfo.SetExtendValues(AtomUtility.GetDcElementContent(additionalElements, ChannelAttribute.ExtendValues)); }
private static void SetValue(ScopedElementCollection additionalElements, TableColumn tableColumn, Entity entity) { var value = entity.Get(tableColumn.AttributeName)?.ToString(); if (tableColumn.DataType == DataType.Text) { value = Encrypt(value); } AddDcElement(additionalElements, tableColumn.AttributeName, value); }
public static void AddDcElement(ScopedElementCollection collection, List <string> nameList, string content) { if (!string.IsNullOrEmpty(content)) { foreach (var name in nameList) { collection.Add(new DcElement(Prefix + name, ToXmlContent(content))); } } }
public static string GetDcElementContent(ScopedElementCollection additionalElements, List<string> nameList, string defaultContent) { foreach (var name in nameList) { var localName = Prefix + name; var element = additionalElements.FindScopedElementByLocalName(localName); if (element == null) continue; return element.Content; } return defaultContent; }
public async Task ImportChannelAsync(Channel channel, ScopedElementCollection additionalElements, int parentId, IList indexNameList) { channel.LoadExtend(AtomUtility.GetDcElementContent(additionalElements, "ExtendValues")); channel.ChannelName = AtomUtility.GetDcElementContent(additionalElements, new List <string> { nameof(Channel.ChannelName), "NodeName" }); channel.SiteId = _site.Id; var contentModelPluginId = AtomUtility.GetDcElementContent(additionalElements, nameof(Channel.ContentModelPluginId)); if (!string.IsNullOrEmpty(contentModelPluginId)) { channel.ContentModelPluginId = contentModelPluginId; } channel.ParentId = parentId; var indexName = AtomUtility.GetDcElementContent(additionalElements, new List <string> { nameof(Channel.IndexName), "NodeIndexName" }); if (!string.IsNullOrEmpty(indexName) && indexNameList.IndexOf(indexName) == -1) { channel.IndexName = indexName; indexNameList.Add(indexName); } channel.GroupNames = ListUtils.GetStringList(AtomUtility.GetDcElementContent(additionalElements, new List <string> { nameof(Channel.GroupNames), "NodeGroupNameCollection" })); channel.AddDate = DateTime.Now; channel.ImageUrl = AtomUtility.GetDcElementContent(additionalElements, nameof(Channel.ImageUrl)); channel.Content = AtomUtility.Decrypt(AtomUtility.GetDcElementContent(additionalElements, nameof(Channel.Content))); channel.FilePath = AtomUtility.GetDcElementContent(additionalElements, nameof(Channel.FilePath)); channel.ChannelFilePathRule = AtomUtility.GetDcElementContent(additionalElements, nameof(Channel.ChannelFilePathRule)); channel.ContentFilePathRule = AtomUtility.GetDcElementContent(additionalElements, nameof(Channel.ContentFilePathRule)); channel.LinkUrl = AtomUtility.GetDcElementContent(additionalElements, nameof(Channel.LinkUrl)); channel.LinkType = TranslateUtils.ToEnum(AtomUtility.GetDcElementContent(additionalElements, nameof(Channel.LinkType)), LinkType.None); var channelTemplateName = AtomUtility.GetDcElementContent(additionalElements, ChannelTemplateName); if (!string.IsNullOrEmpty(channelTemplateName)) { channel.ChannelTemplateId = await _databaseManager.TemplateRepository.GetTemplateIdByTemplateNameAsync(_site.Id, TemplateType.ChannelTemplate, channelTemplateName); } var contentTemplateName = AtomUtility.GetDcElementContent(additionalElements, ContentTemplateName); if (!string.IsNullOrEmpty(contentTemplateName)) { channel.ContentTemplateId = await _databaseManager.TemplateRepository.GetTemplateIdByTemplateNameAsync(_site.Id, TemplateType.ContentTemplate, contentTemplateName); } channel.Keywords = AtomUtility.GetDcElementContent(additionalElements, nameof(Channel.Keywords)); channel.Description = AtomUtility.GetDcElementContent(additionalElements, nameof(Channel.Description)); }
public static string GetDcElementContent(ScopedElementCollection additionalElements, string name, string defaultContent) { var content = defaultContent; var localName = Prefix + name; var element = additionalElements.FindScopedElementByLocalName(localName); if (element != null) { content = element.Content; } return(content); }
public static void AddDcElement(ScopedElementCollection collection, string name, string content) { if (string.IsNullOrEmpty(content)) { return; } var element = GetDcElement(collection, name); if (element != null) { collection.Remove(element); } collection.Add(new DcElement(Prefix + name, StringUtils.ToXmlContent(content))); }
private void ImportNodeInfo(NodeInfo nodeInfo, ScopedElementCollection additionalElements, int parentId, IList nodeIndexNameArrayList) { nodeInfo.NodeName = AtomUtility.GetDcElementContent(additionalElements, NodeAttribute.NodeName); nodeInfo.NodeType = ENodeTypeUtils.GetEnumType(AtomUtility.GetDcElementContent(additionalElements, NodeAttribute.NodeType)); nodeInfo.PublishmentSystemId = _publishmentSystemInfo.PublishmentSystemId; var contentModelId = AtomUtility.GetDcElementContent(additionalElements, NodeAttribute.ContentModelId); if (!string.IsNullOrEmpty(contentModelId)) { nodeInfo.ContentModelId = contentModelId; } nodeInfo.ParentId = parentId; var nodeIndexName = AtomUtility.GetDcElementContent(additionalElements, NodeAttribute.NodeIndexName); if (!string.IsNullOrEmpty(nodeIndexName) && nodeIndexNameArrayList.IndexOf(nodeIndexName) == -1) { nodeInfo.NodeIndexName = nodeIndexName; nodeIndexNameArrayList.Add(nodeIndexName); } nodeInfo.NodeGroupNameCollection = AtomUtility.GetDcElementContent(additionalElements, NodeAttribute.NodeGroupNameCollection); nodeInfo.AddDate = DateTime.Now; nodeInfo.ImageUrl = AtomUtility.GetDcElementContent(additionalElements, NodeAttribute.ImageUrl); nodeInfo.Content = AtomUtility.Decrypt(AtomUtility.GetDcElementContent(additionalElements, NodeAttribute.Content)); nodeInfo.FilePath = AtomUtility.GetDcElementContent(additionalElements, NodeAttribute.FilePath); nodeInfo.ChannelFilePathRule = AtomUtility.GetDcElementContent(additionalElements, NodeAttribute.ChannelFilePathRule); nodeInfo.ContentFilePathRule = AtomUtility.GetDcElementContent(additionalElements, NodeAttribute.ContentFilePathRule); nodeInfo.LinkUrl = AtomUtility.GetDcElementContent(additionalElements, NodeAttribute.LinkUrl); nodeInfo.LinkType = ELinkTypeUtils.GetEnumType(AtomUtility.GetDcElementContent(additionalElements, NodeAttribute.LinkType)); var channelTemplateName = AtomUtility.GetDcElementContent(additionalElements, ChannelTemplateName); if (!string.IsNullOrEmpty(channelTemplateName)) { nodeInfo.ChannelTemplateId = TemplateManager.GetTemplateIDByTemplateName(_publishmentSystemInfo.PublishmentSystemId, ETemplateType.ChannelTemplate, channelTemplateName); } var contentTemplateName = AtomUtility.GetDcElementContent(additionalElements, ContentTemplateName); if (!string.IsNullOrEmpty(contentTemplateName)) { nodeInfo.ContentTemplateId = TemplateManager.GetTemplateIDByTemplateName(_publishmentSystemInfo.PublishmentSystemId, ETemplateType.ContentTemplate, contentTemplateName); } nodeInfo.Keywords = AtomUtility.GetDcElementContent(additionalElements, NodeAttribute.Keywords); nodeInfo.Description = AtomUtility.GetDcElementContent(additionalElements, NodeAttribute.Description); nodeInfo.SetExtendValues(AtomUtility.GetDcElementContent(additionalElements, NodeAttribute.ExtendValues)); }
private static object GetValue(ScopedElementCollection additionalElements, TableColumn tableColumn) { if (tableColumn.DataType == DataType.Boolean) { return(FormUtils.ToBool(GetDcElementContent(additionalElements, tableColumn.AttributeName), false)); } if (tableColumn.DataType == DataType.DateTime) { return(FormUtils.ToDateTime(GetDcElementContent(additionalElements, tableColumn.AttributeName))); } if (tableColumn.DataType == DataType.Decimal) { return(FormUtils.ToDecimalWithNegative(GetDcElementContent(additionalElements, tableColumn.AttributeName), 0)); } if (tableColumn.DataType == DataType.Integer) { return(FormUtils.ToIntWithNegative(GetDcElementContent(additionalElements, tableColumn.AttributeName), 0)); } if (tableColumn.DataType == DataType.Text) { return(Decrypt(GetDcElementContent(additionalElements, tableColumn.AttributeName))); } return(GetDcElementContent(additionalElements, tableColumn.AttributeName)); }
private static NameValueCollection GetDcElementNameValueCollection(ScopedElementCollection additionalElements) { return(additionalElements.GetNameValueCollection(Prefix)); }
public static string GetDcElementContent(ScopedElementCollection additionalElements, List <string> nameList) { return(GetDcElementContent(additionalElements, nameList, "")); }
public static string GetDcElementContent(ScopedElementCollection additionalElements, string name) { return(GetDcElementContent(additionalElements, name, "")); }
public static NameValueCollection GetDcElementNameValueCollection(ScopedElementCollection additionalElements) { return additionalElements.GetNameValueCollection(Prefix); }