예제 #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);
        }
예제 #2
0
 public CreateTaskSummaryItem(CreateTaskInfo taskInfo, string timeSpan, bool isExecuting, bool isPending, bool isSuccess, string errorMessage)
 {
     siteId            = taskInfo.SiteId;
     channelId         = taskInfo.ChannelId;
     contentId         = taskInfo.ContentId;
     templateId        = taskInfo.TemplateId;
     type              = ECreateTypeUtils.GetText(taskInfo.CreateType);
     name              = taskInfo.Name;
     this.timeSpan     = timeSpan;
     this.isExecuting  = isExecuting;
     this.isPending    = isPending;
     this.isSuccess    = isSuccess;
     this.errorMessage = errorMessage;
 }
예제 #3
0
 public CreateTaskSummaryItem(CreateTaskLogInfo logInfo)
 {
     siteId       = logInfo.SiteId;
     channelId    = logInfo.ChannelId;
     contentId    = logInfo.ContentId;
     templateId   = logInfo.TemplateId;
     type         = ECreateTypeUtils.GetText(logInfo.CreateType);
     name         = logInfo.TaskName;
     timeSpan     = logInfo.TimeSpan;
     isExecuting  = false;
     isPending    = false;
     isSuccess    = logInfo.IsSuccess;
     errorMessage = logInfo.ErrorMessage;
 }
예제 #4
0
        void rptContents_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                var publishmentSystemId = SqlUtils.EvalInt(e.Item.DataItem, "PublishmentSystemID");
                var taskName            = SqlUtils.EvalString(e.Item.DataItem, "TaskName");
                var createType          = ECreateTypeUtils.GetEnumType(SqlUtils.EvalString(e.Item.DataItem, "CreateType"));
                var timeSpan            = SqlUtils.EvalString(e.Item.DataItem, "TimeSpan");

                var publishmentSystemInfo = PublishmentSystemManager.GetPublishmentSystemInfo(publishmentSystemId);
                if (publishmentSystemInfo == null)
                {
                    e.Item.Visible = false;
                    return;
                }

                var addDate      = SqlUtils.EvalDateTime(e.Item.DataItem, "AddDate");
                var isSuccess    = SqlUtils.EvalString(e.Item.DataItem, "IsSuccess");
                var errorMessage = SqlUtils.EvalString(e.Item.DataItem, "ErrorMessage");

                var ltlPublishmentSystem = (Literal)e.Item.FindControl("ltlPublishmentSystem");
                var ltlTaskName          = (Literal)e.Item.FindControl("ltlTaskName");
                var ltlCreateType        = (Literal)e.Item.FindControl("ltlCreateType");
                var ltlTimeSpan          = (Literal)e.Item.FindControl("ltlTimeSpan");
                var ltlAddDate           = (Literal)e.Item.FindControl("ltlAddDate");
                var ltlIsSuccess         = (Literal)e.Item.FindControl("ltlIsSuccess");
                var ltlErrorMessage      = (Literal)e.Item.FindControl("ltlErrorMessage");

                ltlPublishmentSystem.Text = publishmentSystemInfo.PublishmentSystemName;
                ltlTaskName.Text          = taskName;
                ltlTimeSpan.Text          = timeSpan;
                ltlCreateType.Text        = ECreateTypeUtils.GetText(createType);

                ltlAddDate.Text      = DateUtils.GetDateAndTimeString(addDate);
                ltlIsSuccess.Text    = StringUtils.GetTrueOrFalseImageHtml(isSuccess);
                ltlErrorMessage.Text = errorMessage;
            }
        }
예제 #5
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);
        }