Exemplo n.º 1
0
        public bool IsExists(CreateTaskInfo info)
        {
            if (info == null)
            {
                return(false);
            }

            var exists = false;

            const string sqlString = @"SELECT ID FROM siteserver_CreateTask WHERE CreateType = @CreateType AND PublishmentSystemID = @PublishmentSystemID AND ChannelID = @ChannelID AND ContentID = @ContentID AND TemplateID = @TemplateID";

            var parms = new IDataParameter[]
            {
                GetParameter(ParmCreateType, EDataType.NVarChar, 50, ECreateTypeUtils.GetValue(info.CreateType)),
                GetParameter(ParmPublishmentSystemId, EDataType.Integer, info.PublishmentSystemID),
                GetParameter(ParmChannelId, EDataType.Integer, info.ChannelID),
                GetParameter(ParmContentId, EDataType.Integer, info.ContentID),
                GetParameter(ParmTemplateId, EDataType.Integer, info.TemplateID),
            };

            using (var rdr = ExecuteReader(sqlString, parms))
            {
                if (rdr.Read() && !rdr.IsDBNull(0))
                {
                    exists = true;
                }
                rdr.Close();
            }

            return(exists);
        }
Exemplo n.º 2
0
        public void Insert(CreateTaskInfo info)
        {
            const string sqlString = "INSERT INTO siteserver_CreateTask (CreateType, PublishmentSystemID, ChannelID, ContentID, TemplateID) VALUES (@CreateType, @PublishmentSystemID, @ChannelID, @ContentID, @TemplateID)";

            var parms = new IDataParameter[]
            {
                GetParameter(ParmCreateType, EDataType.NVarChar, 50, ECreateTypeUtils.GetValue(info.CreateType)),
                GetParameter(ParmPublishmentSystemId, EDataType.Integer, info.PublishmentSystemID),
                GetParameter(ParmChannelId, EDataType.Integer, info.ChannelID),
                GetParameter(ParmContentId, EDataType.Integer, info.ContentID),
                GetParameter(ParmTemplateId, EDataType.Integer, info.TemplateID),
            };

            ExecuteNonQuery(sqlString, parms);
            ServiceManager.ClearIsPendingCreateCache();
        }
Exemplo n.º 3
0
        public static bool Execute(TaskInfo taskInfo)
        {
            var taskCreateInfo = new TaskCreateInfo(taskInfo.ServiceParameters);

            if (!string.IsNullOrEmpty(taskCreateInfo.CreateTypes))
            {
                var createTypeArrayList = TranslateUtils.StringCollectionToStringList(taskCreateInfo.CreateTypes);
                var createChannel       = createTypeArrayList.Contains(ECreateTypeUtils.GetValue(ECreateType.Channel));
                var createContent       = createTypeArrayList.Contains(ECreateTypeUtils.GetValue(ECreateType.Content));
                var createFile          = createTypeArrayList.Contains(ECreateTypeUtils.GetValue(ECreateType.File));
                if (taskInfo.PublishmentSystemID != 0)
                {
                    List <int> nodeIdList;
                    if (taskCreateInfo.IsCreateAll)
                    {
                        nodeIdList = DataProvider.NodeDao.GetNodeIdListByPublishmentSystemId(taskInfo.PublishmentSystemID);
                    }
                    else
                    {
                        nodeIdList = TranslateUtils.StringCollectionToIntList(taskCreateInfo.ChannelIDCollection);
                    }

                    Create(createChannel, createContent, createFile, taskInfo, taskInfo.PublishmentSystemID, nodeIdList);
                }
                else
                {
                    List <int> publishmentSystemIdArrayList;
                    if (taskCreateInfo.IsCreateAll)
                    {
                        publishmentSystemIdArrayList = PublishmentSystemManager.GetPublishmentSystemIdList();
                    }
                    else
                    {
                        publishmentSystemIdArrayList = TranslateUtils.StringCollectionToIntList(taskCreateInfo.ChannelIDCollection);
                    }
                    foreach (var publishmentSystemId in publishmentSystemIdArrayList)
                    {
                        var nodeIdList = DataProvider.NodeDao.GetNodeIdListByPublishmentSystemId(publishmentSystemId);
                        Create(createChannel, createContent, createFile, taskInfo, publishmentSystemId, nodeIdList);
                    }
                }
            }

            return(true);
        }
Exemplo n.º 4
0
        public void Insert(CreateTaskLogInfo log)
        {
            DeleteExcess90Days();

            var sqlString = "INSERT INTO siteserver_CreateTaskLog(CreateType, PublishmentSystemID, TaskName, TimeSpan, IsSuccess, ErrorMessage, AddDate) VALUES (@CreateType, @PublishmentSystemID, @TaskName, @TimeSpan, @IsSuccess, @ErrorMessage, @AddDate)";

            var parms = new IDataParameter[]
            {
                GetParameter(ParmCreateType, EDataType.NVarChar, 50, ECreateTypeUtils.GetValue(log.CreateType)),
                GetParameter(ParmPublishmentSystemId, EDataType.Integer, log.PublishmentSystemID),
                GetParameter(ParmTaskName, EDataType.NVarChar, 50, log.TaskName),
                GetParameter(ParmTimeSpan, EDataType.NVarChar, 50, log.TimeSpan),
                GetParameter(ParmIsSuccess, EDataType.VarChar, 18, log.IsSuccess.ToString()),
                GetParameter(ParmErrorMessage, EDataType.NVarChar, 255, log.ErrorMessage),
                GetParameter(ParmAddDate, EDataType.DateTime, log.AddDate)
            };

            ExecuteNonQuery(sqlString, parms);
        }