Ejemplo n.º 1
0
        private static string GetTaskName(ECreateType createType, int siteId, int channelId, int contentId,
                                          int fileTemplateId, int specialId, out int pageCount)
        {
            pageCount = 0;
            var name = string.Empty;

            if (createType == ECreateType.Channel)
            {
                name = channelId == siteId ? "首页" : ChannelManager.GetChannelName(siteId, channelId);
                if (!string.IsNullOrEmpty(name))
                {
                    pageCount = 1;
                }
            }
            else if (createType == ECreateType.AllContent)
            {
                var siteInfo    = SiteManager.GetSiteInfo(siteId);
                var channelInfo = ChannelManager.GetChannelInfo(siteId, channelId);

                if (channelInfo != null)
                {
                    var count = ContentManager.GetCount(siteInfo, channelInfo, true);
                    if (count > 0)
                    {
                        pageCount = count;
                        name      = $"{channelInfo.ChannelName}下所有内容页,共 {pageCount} 项";
                    }
                }
            }
            else if (createType == ECreateType.Content)
            {
                var tuple = DataProvider.ContentDao.GetValue(ChannelManager.GetTableName(
                                                                 SiteManager.GetSiteInfo(siteId), channelId), contentId, ContentAttribute.Title);
                if (tuple != null)
                {
                    name      = tuple.Item2;
                    pageCount = 1;
                }
            }
            else if (createType == ECreateType.File)
            {
                name = TemplateManager.GetTemplateName(siteId, fileTemplateId);
                if (!string.IsNullOrEmpty(name))
                {
                    pageCount = 1;
                }
            }
            else if (createType == ECreateType.Special)
            {
                name = SpecialManager.GetTitle(siteId, specialId);
                if (!string.IsNullOrEmpty(name))
                {
                    pageCount = 1;
                }
            }
            return(name);
        }