Example #1
0
        public List <CreateTaskLogInfo> GetList(int publishmentSystemId, int totalNum)
        {
            var list = new List <CreateTaskLogInfo>();

            if (publishmentSystemId > 0)
            {
                //string sqlString =
                //    $"SELECT TOP {totalNum} ID, CreateType, PublishmentSystemID, TaskName, TimeSpan, IsSuccess, ErrorMessage, AddDate FROM siteserver_CreateTaskLog WHERE PublishmentSystemID = @PublishmentSystemID";
                string sqlString = SqlUtils.GetTopSqlString("siteserver_CreateTaskLog", "ID, CreateType, PublishmentSystemID, TaskName, TimeSpan, IsSuccess, ErrorMessage, AddDate", "WHERE PublishmentSystemID = @PublishmentSystemID", totalNum);

                var parms = new IDataParameter[]
                {
                    GetParameter(ParmPublishmentSystemId, EDataType.Integer, publishmentSystemId)
                };

                using (var rdr = ExecuteReader(sqlString, parms))
                {
                    while (rdr.Read())
                    {
                        var i    = 0;
                        var info = new CreateTaskLogInfo(GetInt(rdr, i++), ECreateTypeUtils.GetEnumType(GetString(rdr, i++)), GetInt(rdr, i++), GetString(rdr, i++), GetString(rdr, i++), GetBool(rdr, i++), GetString(rdr, i++), GetDateTime(rdr, i));
                        list.Add(info);
                    }
                    rdr.Close();
                }
            }
            else
            {
                //string sqlString =
                //    $"SELECT TOP {totalNum} ID, CreateType, PublishmentSystemID, TaskName, TimeSpan, IsSuccess, ErrorMessage, AddDate FROM siteserver_CreateTaskLog";
                var sqlString = SqlUtils.GetTopSqlString("siteserver_CreateTaskLog", "ID, CreateType, PublishmentSystemID, TaskName, TimeSpan, IsSuccess, ErrorMessage, AddDate", string.Empty, totalNum);

                using (var rdr = ExecuteReader(sqlString))
                {
                    while (rdr.Read())
                    {
                        var i    = 0;
                        var info = new CreateTaskLogInfo(GetInt(rdr, i++), ECreateTypeUtils.GetEnumType(GetString(rdr, i++)), GetInt(rdr, i++), GetString(rdr, i++), GetString(rdr, i++), GetBool(rdr, i++), GetString(rdr, i++), GetDateTime(rdr, i));
                        list.Add(info);
                    }
                    rdr.Close();
                }
            }

            return(list);
        }
Example #2
0
        public List <CreateTaskInfo> GetList(int publishmentSystemId, int totalNum)
        {
            var list = new List <CreateTaskInfo>();

            if (publishmentSystemId > 0)
            {
                //string sqlString =
                //    $"SELECT TOP {totalNum} ID, CreateType, PublishmentSystemID, ChannelID, ContentID, TemplateID FROM siteserver_CreateTask WHERE PublishmentSystemID = @PublishmentSystemID ORDER BY ID DESC";
                var sqlString = SqlUtils.GetTopSqlString("siteserver_CreateTask", "ID, CreateType, PublishmentSystemID, ChannelID, ContentID, TemplateID", "WHERE PublishmentSystemID = @PublishmentSystemID ORDER BY ID DESC", totalNum);

                var parms = new IDataParameter[]
                {
                    GetParameter(ParmPublishmentSystemId, EDataType.Integer, publishmentSystemId)
                };

                using (var rdr = ExecuteReader(sqlString, parms))
                {
                    while (rdr.Read())
                    {
                        var i    = 0;
                        var info = new CreateTaskInfo(GetInt(rdr, i++), ECreateTypeUtils.GetEnumType(GetString(rdr, i++)), GetInt(rdr, i++), GetInt(rdr, i++), GetInt(rdr, i++), GetInt(rdr, i));
                        list.Add(info);
                    }
                    rdr.Close();
                }
            }
            else
            {
                //string sqlString =
                //    $"SELECT TOP {totalNum} ID, CreateType, PublishmentSystemID, ChannelID, ContentID, TemplateID FROM siteserver_CreateTask ORDER BY ID DESC";
                var sqlString = SqlUtils.GetTopSqlString("siteserver_CreateTask", "ID, CreateType, PublishmentSystemID, ChannelID, ContentID, TemplateID", "ORDER BY ID DESC", totalNum);

                using (var rdr = ExecuteReader(sqlString))
                {
                    while (rdr.Read())
                    {
                        var i    = 0;
                        var info = new CreateTaskInfo(GetInt(rdr, i++), ECreateTypeUtils.GetEnumType(GetString(rdr, i++)), GetInt(rdr, i++), GetInt(rdr, i++), GetInt(rdr, i++), GetInt(rdr, i));
                        list.Add(info);
                    }
                    rdr.Close();
                }
            }

            return(list);
        }
Example #3
0
        public CreateTaskInfo GetLastPendingTask()
        {
            CreateTaskInfo info = null;

            //var sqlString = "SELECT TOP 1 ID, CreateType, PublishmentSystemID, ChannelID, ContentID, TemplateID FROM siteserver_CreateTask ORDER BY ID";
            var sqlString = SqlUtils.GetTopSqlString("siteserver_CreateTask", "ID, CreateType, PublishmentSystemID, ChannelID, ContentID, TemplateID", "ORDER BY ID", 1);

            using (var rdr = ExecuteReader(sqlString))
            {
                if (rdr.Read())
                {
                    var i = 0;
                    info = new CreateTaskInfo(GetInt(rdr, i++), ECreateTypeUtils.GetEnumType(GetString(rdr, i++)), GetInt(rdr, i++), GetInt(rdr, i++), GetInt(rdr, i++), GetInt(rdr, i));
                }
                rdr.Close();
            }
            return(info);
        }
Example #4
0
        /// <summary>
        /// 一次获取多个任务
        /// </summary>
        /// <param name="topNum"></param>
        /// <returns></returns>
        public List <CreateTaskInfo> GetLastPendingTasks(int topNum)
        {
            List <CreateTaskInfo> list = null;

            var sqlString = SqlUtils.GetTopSqlString("siteserver_CreateTask", "ID, CreateType, PublishmentSystemID, ChannelID, ContentID, TemplateID", "ORDER BY ID", topNum);

            using (var rdr = ExecuteReader(sqlString))
            {
                while (rdr.Read())
                {
                    var i    = 0;
                    var info = new CreateTaskInfo(GetInt(rdr, i++), ECreateTypeUtils.GetEnumType(GetString(rdr, i++)), GetInt(rdr, i++), GetInt(rdr, i++), GetInt(rdr, i++), GetInt(rdr, i));
                    list.Add(info);
                }
                rdr.Close();
            }
            return(list);
        }
Example #5
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;
            }
        }
Example #6
0
        public void GetCount(int publishmentSystemId, out int indexCount, out int channelsCount, out int contentsCount, out int filesCount)
        {
            indexCount    = 0;
            channelsCount = 0;
            contentsCount = 0;
            filesCount    = 0;

            if (publishmentSystemId > 0)
            {
                const string sqlString = "SELECT COUNT(*) AS TOTAL, CreateType FROM siteserver_CreateTask WHERE PublishmentSystemID = @PublishmentSystemID GROUP BY CreateType";

                var parms = new IDataParameter[]
                {
                    GetParameter(ParmPublishmentSystemId, EDataType.Integer, publishmentSystemId)
                };

                using (var rdr = ExecuteReader(sqlString, parms))
                {
                    while (rdr.Read())
                    {
                        var total      = GetInt(rdr, 0);
                        var createType = ECreateTypeUtils.GetEnumType(GetString(rdr, 1));

                        if (createType == ECreateType.Index)
                        {
                            indexCount += total;
                        }
                        else if (createType == ECreateType.Channel)
                        {
                            channelsCount += total;
                        }
                        else if (createType == ECreateType.Content)
                        {
                            contentsCount += total;
                        }
                        else if (createType == ECreateType.File)
                        {
                            filesCount += total;
                        }
                        else if (createType == ECreateType.AllContent)
                        {
                            contentsCount += total;
                        }
                    }
                    rdr.Close();
                }
            }
            else
            {
                const string sqlString = "SELECT COUNT(*) AS TOTAL, CreateType FROM siteserver_CreateTask GROUP BY CreateType";

                using (var rdr = ExecuteReader(sqlString))
                {
                    while (rdr.Read())
                    {
                        var total      = GetInt(rdr, 0);
                        var createType = ECreateTypeUtils.GetEnumType(GetString(rdr, 1));

                        if (createType == ECreateType.Index)
                        {
                            indexCount += total;
                        }
                        else if (createType == ECreateType.Channel)
                        {
                            channelsCount += total;
                        }
                        else if (createType == ECreateType.Content)
                        {
                            contentsCount += total;
                        }
                        else if (createType == ECreateType.File)
                        {
                            filesCount += total;
                        }
                        else if (createType == ECreateType.AllContent)
                        {
                            contentsCount += total;
                        }
                    }
                    rdr.Close();
                }
            }
        }