예제 #1
0
        public static string GetDescription(int siteId, ChannelInfo channelInfo)
        {
            var results = string.Empty;

            if (channelInfo != null)
            {
                results = ECrossSiteTransTypeUtils.GetText(channelInfo.Additional.TransType);

                if (channelInfo.Additional.TransType == ECrossSiteTransType.AllParentSite || channelInfo.Additional.TransType == ECrossSiteTransType.AllSite)
                {
                    if (!string.IsNullOrEmpty(channelInfo.Additional.TransChannelNames))
                    {
                        results += $"({channelInfo.Additional.TransChannelNames})";
                    }
                }
                else if (channelInfo.Additional.TransType == ECrossSiteTransType.SelfSite || channelInfo.Additional.TransType == ECrossSiteTransType.SpecifiedSite || channelInfo.Additional.TransType == ECrossSiteTransType.ParentSite)
                {
                    SiteInfo siteInfo = null;

                    if (channelInfo.Additional.TransType == ECrossSiteTransType.SelfSite)
                    {
                        siteInfo = SiteManager.GetSiteInfo(siteId);
                    }
                    else if (channelInfo.Additional.TransType == ECrossSiteTransType.SpecifiedSite)
                    {
                        siteInfo = SiteManager.GetSiteInfo(channelInfo.Additional.TransSiteId);
                    }
                    else
                    {
                        var parentSiteId = SiteManager.GetParentSiteId(siteId);
                        if (parentSiteId != 0)
                        {
                            siteInfo = SiteManager.GetSiteInfo(parentSiteId);
                        }
                    }

                    if (siteInfo != null && !string.IsNullOrEmpty(channelInfo.Additional.TransChannelIds))
                    {
                        var nodeNameBuilder    = new StringBuilder();
                        var channelIdArrayList = TranslateUtils.StringCollectionToIntList(channelInfo.Additional.TransChannelIds);
                        foreach (int channelId in channelIdArrayList)
                        {
                            var theNodeInfo = ChannelManager.GetChannelInfo(siteInfo.Id, channelId);
                            if (theNodeInfo != null)
                            {
                                nodeNameBuilder.Append(theNodeInfo.ChannelName).Append(",");
                            }
                        }
                        if (nodeNameBuilder.Length > 0)
                        {
                            nodeNameBuilder.Length--;
                            results += $"({siteInfo.SiteName}:{nodeNameBuilder})";
                        }
                    }
                }
            }
            return(results);
        }
예제 #2
0
        public static string GetDescription(int publishmentSystemID, NodeInfo nodeInfo)
        {
            var results = string.Empty;

            if (nodeInfo != null)
            {
                results = ECrossSiteTransTypeUtils.GetText(nodeInfo.Additional.TransType);

                if (nodeInfo.Additional.TransType == ECrossSiteTransType.AllParentSite || nodeInfo.Additional.TransType == ECrossSiteTransType.AllSite)
                {
                    if (!string.IsNullOrEmpty(nodeInfo.Additional.TransNodeNames))
                    {
                        results += $"({nodeInfo.Additional.TransNodeNames})";
                    }
                }
                else if (nodeInfo.Additional.TransType == ECrossSiteTransType.SelfSite || nodeInfo.Additional.TransType == ECrossSiteTransType.SpecifiedSite || nodeInfo.Additional.TransType == ECrossSiteTransType.ParentSite)
                {
                    PublishmentSystemInfo publishmentSystemInfo = null;

                    if (nodeInfo.Additional.TransType == ECrossSiteTransType.SelfSite)
                    {
                        publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemID);
                    }
                    else if (nodeInfo.Additional.TransType == ECrossSiteTransType.SpecifiedSite)
                    {
                        publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(nodeInfo.Additional.TransPublishmentSystemID);
                    }
                    else
                    {
                        var parentPublishmentSystemID = PublishmentSystemManager.GetParentPublishmentSystemId(publishmentSystemID);
                        if (parentPublishmentSystemID != 0)
                        {
                            publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(parentPublishmentSystemID);
                        }
                    }

                    if (publishmentSystemInfo != null && !string.IsNullOrEmpty(nodeInfo.Additional.TransNodeIDs))
                    {
                        var nodeNameBuilder = new StringBuilder();
                        var nodeIDArrayList = TranslateUtils.StringCollectionToIntList(nodeInfo.Additional.TransNodeIDs);
                        foreach (int nodeID in nodeIDArrayList)
                        {
                            var theNodeInfo = NodeManager.GetNodeInfo(publishmentSystemInfo.PublishmentSystemId, nodeID);
                            if (theNodeInfo != null)
                            {
                                nodeNameBuilder.Append(theNodeInfo.NodeName).Append(",");
                            }
                        }
                        if (nodeNameBuilder.Length > 0)
                        {
                            nodeNameBuilder.Length--;
                            results += $"({publishmentSystemInfo.PublishmentSystemName}:{nodeNameBuilder})";
                        }
                    }
                }
            }
            return(results);
        }