Esempio n. 1
0
        public CreateTaskSummary GetTaskSummary(int publishmentSystemId)
        {
            int indexCount;
            int channelsCount;
            int contentsCount;
            int filesCount;

            DataProvider.CreateTaskDao.GetCount(publishmentSystemId, out indexCount, out channelsCount, out contentsCount, out filesCount);
            var pendingTasks = DataProvider.CreateTaskDao.GetList(publishmentSystemId, 10);
            var taskLogs     = DataProvider.CreateTaskLogDao.GetList(publishmentSystemId, 20);

            var list = new List <CreateTaskSummaryItem>();

            for (var i = pendingTasks.Count - 1; i >= 0; i--)
            {
                var taskInfo    = pendingTasks[i];
                var summaryItem = new CreateTaskSummaryItem(ECreateTypeUtils.GetText(taskInfo.CreateType), CreateTaskManager.GetTaskName(taskInfo), string.Empty, false, false, string.Empty);
                list.Add(summaryItem);
            }

            for (var i = taskLogs.Count - 1; i >= 0; i--)
            {
                var logInfo     = taskLogs[i];
                var summaryItem = new CreateTaskSummaryItem(ECreateTypeUtils.GetText(logInfo.CreateType), logInfo.TaskName, logInfo.TimeSpan, true, logInfo.IsSuccess, logInfo.ErrorMessage);
                list.Add(summaryItem);
            }

            var summary = new CreateTaskSummary(list, indexCount, channelsCount, contentsCount, filesCount);

            return(summary);
        }
Esempio n. 2
0
        public CreateTaskSummary GetTaskSummary(int siteId)
        {
            var executingTasks = GetExecutingTasks(siteId);
            var pendingTasks   = GetPendingTasks(siteId);
            var taskLogs       = GetTaskLogs(siteId);

            var list = new List <CreateTaskSummaryItem>();

            var channelsCount = 0;
            var contentsCount = 0;
            var filesCount    = 0;

            foreach (var taskInfo in pendingTasks)
            {
                if (taskInfo.CreateType == ECreateType.Channel)
                {
                    channelsCount += taskInfo.PageCount;
                }
                else if (taskInfo.CreateType == ECreateType.Content || taskInfo.CreateType == ECreateType.AllContent)
                {
                    contentsCount += taskInfo.PageCount;
                }
                else if (taskInfo.CreateType == ECreateType.File)
                {
                    filesCount += taskInfo.PageCount;
                }
            }

            if (executingTasks.Count > 0)
            {
                foreach (var taskInfo in executingTasks)
                {
                    var summaryItem = new CreateTaskSummaryItem(taskInfo, string.Empty, true, false, false, string.Empty);
                    list.Add(summaryItem);
                }
            }

            var count = pendingTasks.Count >= 10 ? 10 : pendingTasks.Count;

            if (count > 0)
            {
                var pendingTaskList = pendingTasks.ToList();
                for (var i = 0; i < count; i++)
                {
                    var taskInfo    = pendingTaskList[i];
                    var summaryItem = new CreateTaskSummaryItem(taskInfo, string.Empty, false, true, false, string.Empty);
                    list.Add(summaryItem);
                }
            }

            count = taskLogs.Count >= 20 ? 20 : taskLogs.Count;
            for (var i = 1; i <= count; i++)
            {
                var logInfo     = taskLogs[taskLogs.Count - i];
                var summaryItem = new CreateTaskSummaryItem(logInfo);
                list.Add(summaryItem);
            }

            var summary = new CreateTaskSummary(list, channelsCount, contentsCount, filesCount);

            return(summary);
        }
Esempio n. 3
0
        public CreateTaskSummary GetTaskSummary(int publishmentSystemId)
        {
            var pendingTasks = GetPendingTasks(publishmentSystemId);
            var taskLogs     = GetTaskLogs(publishmentSystemId);

            var list = new List <CreateTaskSummaryItem>();

            var indexCount    = 0;
            var channelsCount = 0;
            var contentsCount = 0;
            var filesCount    = 0;

            foreach (var taskInfo in pendingTasks)
            {
                if (taskInfo.CreateType == ECreateType.Index)
                {
                    indexCount++;
                }
                else if (taskInfo.CreateType == ECreateType.Channel)
                {
                    channelsCount++;
                }
                else if (taskInfo.CreateType == ECreateType.Content)
                {
                    contentsCount++;
                }
                else if (taskInfo.CreateType == ECreateType.File)
                {
                    filesCount++;
                }
                else if (taskInfo.CreateType == ECreateType.AllContent)
                {
                    contentsCount++;
                    //NodeInfo nodeInfo = NodeManager.GetNodeInfo(publishmentSystemID, taskInfo.ChannelID);
                    //contentsCount += nodeInfo.ContentNum;
                }
            }

            var count = 0;

            for (var i = pendingTasks.Count - 1; i >= 0; i--)
            {
                if (count > 10)
                {
                    break;
                }
                var taskInfo    = pendingTasks[i];
                var summaryItem = new CreateTaskSummaryItem(ECreateTypeUtils.GetText(taskInfo.CreateType), CreateTaskManager.GetTaskName(taskInfo), string.Empty, false, false, string.Empty);
                list.Add(summaryItem);
            }

            count = 0;
            for (var i = taskLogs.Count - 1; i >= 0; i--)
            {
                if (count > 20)
                {
                    break;
                }
                var logInfo     = taskLogs[i];
                var summaryItem = new CreateTaskSummaryItem(ECreateTypeUtils.GetText(logInfo.CreateType), logInfo.TaskName, logInfo.TimeSpan, true, logInfo.IsSuccess, logInfo.ErrorMessage);
                list.Add(summaryItem);
            }

            var summary = new CreateTaskSummary(list, indexCount, channelsCount, contentsCount, filesCount);

            return(summary);
        }
Esempio n. 4
0
        public static CreateTaskSummary GetTaskSummary(int siteId)
        {
            var list = new List <CreateTaskSummaryItem>();

            var channelsCount = 0;
            var contentsCount = 0;
            var filesCount    = 0;
            var specialsCount = 0;

            foreach (var taskInfo in PendingTasks)
            {
                if (taskInfo.SiteId != siteId)
                {
                    continue;
                }

                if (taskInfo.CreateType == ECreateType.Channel)
                {
                    channelsCount += taskInfo.PageCount;
                }
                else if (taskInfo.CreateType == ECreateType.Content || taskInfo.CreateType == ECreateType.AllContent)
                {
                    contentsCount += taskInfo.PageCount;
                }
                else if (taskInfo.CreateType == ECreateType.File)
                {
                    filesCount += taskInfo.PageCount;
                }
                else if (taskInfo.CreateType == ECreateType.Special)
                {
                    specialsCount += taskInfo.PageCount;
                }

                var summaryItem = new CreateTaskSummaryItem(taskInfo, string.Empty, true, false, string.Empty);
                list.Add(summaryItem);
            }

            //var count = _pendingTasks.Count;
            //if (count > 0)
            //{
            //    foreach (var taskInfo in _pendingTasks)
            //    {
            //        var summaryItem = new CreateTaskSummaryItem(taskInfo, string.Empty, true, false, string.Empty);
            //        list.Add(summaryItem);
            //    }
            //    //var pendingTaskList = _pendingTasks.ToList();
            //    //for (var i = 0; i < count; i++)
            //    //{
            //    //    var taskInfo = pendingTaskList[i];
            //    //    var summaryItem = new CreateTaskSummaryItem(taskInfo, string.Empty, true, false, string.Empty);
            //    //    list.Add(summaryItem);
            //    //}
            //}

            foreach (var logInfo in TaskLogs)
            {
                var summaryItem = new CreateTaskSummaryItem(logInfo);
                list.Add(summaryItem);
            }

            var summary = new CreateTaskSummary(list, channelsCount, contentsCount, filesCount, specialsCount);

            return(summary);
        }