Esempio n. 1
0
        public static string GetText(ECreateType createType)
        {
            if (createType == ECreateType.Index)
            {
                return("首页");
            }
            else if (createType == ECreateType.Channel)
            {
                return("栏目页");
            }
            else if (createType == ECreateType.Content)
            {
                return("内容页");
            }
            else if (createType == ECreateType.File)
            {
                return("文件页");
            }
            else if (createType == ECreateType.AllContent)
            {
                return("栏目下所有内容页");
            }

            return(string.Empty);
        }
Esempio n. 2
0
 public static async Task ExecuteAsync(int siteId, ECreateType createType, int channelId, int contentId,
                                       int fileTemplatId, int specialId)
 {
     if (createType == ECreateType.Channel)
     {
         await CreateChannelAsync(siteId, channelId);
     }
     else if (createType == ECreateType.Content)
     {
         var siteInfo    = SiteManager.GetSiteInfo(siteId);
         var channelInfo = ChannelManager.GetChannelInfo(siteId, channelId);
         await CreateContentAsync(siteInfo, channelInfo, contentId);
     }
     else if (createType == ECreateType.AllContent)
     {
         await CreateContentsAsync(siteId, channelId);
     }
     else if (createType == ECreateType.File)
     {
         await CreateFileAsync(siteId, fileTemplatId);
     }
     else if (createType == ECreateType.Special)
     {
         await CreateSpecialAsync(siteId, specialId);
     }
 }
Esempio n. 3
0
        public static string GetText(ECreateType createType)
        {
            if (createType == ECreateType.Channel)
            {
                return("栏目页");
            }
            if (createType == ECreateType.Content)
            {
                return("内容页");
            }
            if (createType == ECreateType.File)
            {
                return("文件页");
            }
            if (createType == ECreateType.Special)
            {
                return("专题页");
            }
            if (createType == ECreateType.AllContent)
            {
                return("栏目下所有内容页");
            }

            return(string.Empty);
        }
Esempio n. 4
0
 public CreateTaskInfo(int id, ECreateType createType, int publishmentSystemID, int channelID, int contentID, int templateID)
 {
     ID                  = id;
     CreateType          = createType;
     PublishmentSystemID = publishmentSystemID;
     ChannelID           = channelID;
     ContentID           = contentID;
     TemplateID          = templateID;
 }
Esempio n. 5
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);
        }
Esempio n. 6
0
        public static ListItem GetListItem(ECreateType type, bool selected)
        {
            var item = new ListItem(GetText(type), GetValue(type));

            if (selected)
            {
                item.Selected = true;
            }
            return(item);
        }
Esempio n. 7
0
 public CreateTaskInfo(int id, string name, ECreateType createType, int siteId, int channelId, int contentId, int templateId, int pageCount)
 {
     Id         = id;
     Name       = name;
     CreateType = createType;
     SiteId     = siteId;
     ChannelId  = channelId;
     ContentId  = contentId;
     TemplateId = templateId;
     PageCount  = pageCount;
 }
Esempio n. 8
0
 public CreateTaskLogInfo(int id, ECreateType createType, int publishmentSystemID, string taskName, string timeSpan, bool isSuccess, string errorMessage, DateTime addDate)
 {
     ID                  = id;
     CreateType          = createType;
     PublishmentSystemID = publishmentSystemID;
     TaskName            = taskName;
     TimeSpan            = timeSpan;
     IsSuccess           = isSuccess;
     ErrorMessage        = errorMessage;
     AddDate             = addDate;
 }
Esempio n. 9
0
 public static bool Equals(ECreateType type, string typeStr)
 {
     if (string.IsNullOrEmpty(typeStr))
     {
         return(false);
     }
     if (string.Equals(GetValue(type).ToLower(), typeStr.ToLower()))
     {
         return(true);
     }
     return(false);
 }
Esempio n. 10
0
 public CreateTaskInfo(int id, string name, ECreateType createType, int siteId, int channelId, int contentId, int fileTemplateId, int specialId, int pageCount)
 {
     Id             = id;
     Name           = name;
     CreateType     = createType;
     SiteId         = siteId;
     ChannelId      = channelId;
     ContentId      = contentId;
     FileTemplateId = fileTemplateId;
     SpecialId      = specialId;
     PageCount      = pageCount;
     Executing      = false;
 }
Esempio n. 11
0
 public CreateTaskLogInfo(int id, ECreateType createType, int siteId, int channelId, int contentId, int templateId, string taskName, string timeSpan, bool isSuccess, string errorMessage, DateTime addDate)
 {
     Id           = id;
     CreateType   = createType;
     SiteId       = siteId;
     ChannelId    = channelId;
     ContentId    = contentId;
     TemplateId   = templateId;
     TaskName     = taskName;
     TimeSpan     = timeSpan;
     IsSuccess    = isSuccess;
     ErrorMessage = errorMessage;
     AddDate      = addDate;
 }
Esempio n. 12
0
        public static string GetTaskName(ECreateType createType, int siteId, int channelId, int contentId,
                                         int templateId, 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 nodeInfo = ChannelManager.GetChannelInfo(siteId, channelId);
                if (nodeInfo != null && nodeInfo.ContentNum > 0)
                {
                    pageCount = nodeInfo.ContentNum;
                    name      = $"{nodeInfo.ChannelName}下所有内容页,共{pageCount}项";
                }
            }
            else if (createType == ECreateType.Content)
            {
                name =
                    DataProvider.ContentDao.GetValue(
                        ChannelManager.GetTableName(
                            SiteManager.GetSiteInfo(siteId), channelId),
                        contentId, ContentAttribute.Title);
                if (!string.IsNullOrEmpty(name))
                {
                    pageCount = 1;
                }
            }
            else if (createType == ECreateType.File)
            {
                name = TemplateManager.GetTemplateName(siteId, templateId);
                if (!string.IsNullOrEmpty(name))
                {
                    pageCount = 1;
                }
            }
            return(name);
        }
Esempio n. 13
0
 public static string GetValue(ECreateType type)
 {
     if (type == ECreateType.Channel)
     {
         return("Channel");
     }
     if (type == ECreateType.Content)
     {
         return("Content");
     }
     if (type == ECreateType.File)
     {
         return("File");
     }
     if (type == ECreateType.AllContent)
     {
         return("AllContent");
     }
     return(string.Empty);
 }
Esempio n. 14
0
        //public FileSystemObject(int siteId)
        //{
        //    SiteInfo = SiteManager.GetSiteInfo(siteId);
        //    if (SiteInfo == null)
        //    {
        //        throw new ArgumentException(siteId + " 不是正确的发布系统ID!");
        //    }
        //    SiteId = siteInfo.Id;
        //    SiteDir = SiteInfo.SiteDir;
        //    SitePath = PathUtils.Combine(WebConfigUtils.PhysicalApplicationPath, SiteInfo.SiteDir);
        //    IsRoot = SiteInfo.IsRoot;
        //    DirectoryUtils.CreateDirectoryIfNotExists(SitePath);
        //}

        public static async Task ExecuteAsync(int siteId, ECreateType createType, int channelId, int contentId, int templateId)
        {
            if (createType == ECreateType.Channel)
            {
                await CreateChannelAsync(siteId, channelId);
            }
            else if (createType == ECreateType.Content)
            {
                var siteInfo  = SiteManager.GetSiteInfo(siteId);
                var nodeInfo  = ChannelManager.GetChannelInfo(siteId, channelId);
                var tableName = ChannelManager.GetTableName(siteInfo, nodeInfo);
                await CreateContentAsync(siteInfo, tableName, channelId, contentId);
            }
            else if (createType == ECreateType.AllContent)
            {
                await CreateContentsAsync(siteId, channelId);
            }
            else if (createType == ECreateType.File)
            {
                await CreateFileAsync(siteId, templateId);
            }
        }
Esempio n. 15
0
 public static bool Equals(string typeStr, ECreateType type)
 {
     return(Equals(type, typeStr));
 }