public async Task UpdateWorkflowsChangedWithRevisionsAsync(int workflowId, int revisionId, IDbTransaction transaction = null)
        {
            if (workflowId < 1)
            {
                throw new ArgumentOutOfRangeException(nameof(workflowId));
            }

            if (revisionId <= 1)
            {
                throw new ArgumentOutOfRangeException(nameof(revisionId));
            }

            var parameters = new DynamicParameters();

            parameters.Add("@workflowId", workflowId);
            parameters.Add("@revisionId", revisionId);

            if (transaction == null)
            {
                await _connectionWrapper.ExecuteAsync
                (
                    "UpdateWorkflowsChangedWithRevisions",
                    parameters,
                    commandType : CommandType.StoredProcedure);
            }
            else
            {
                await transaction.Connection.ExecuteAsync
                (
                    "UpdateWorkflowsChangedWithRevisions",
                    parameters,
                    transaction,
                    commandType : CommandType.StoredProcedure);
            }
        }
Beispiel #2
0
        public async Task <Guid> PostFileHead(File file)
        {
            var prm = new DynamicParameters();

            prm.Add("@FileName", file.FileName);
            prm.Add("@FileType", file.FileType);
            prm.Add("@ExpiredTime", GetPostFileHeadExpirationTime(file.ExpiredTime));
            prm.Add("@ChunkCount", file.ChunkCount);
            prm.Add("@FileSize", file.FileSize);
            prm.Add("@FileId", dbType: DbType.Guid, direction: ParameterDirection.Output);
            await _connectionWrapper.ExecuteAsync("[FileStore].InsertFileHead", prm, commandTimeout : _commandTimeout, commandType : CommandType.StoredProcedure);

            return(file.FileId = prm.Get <Guid>("FileId"));
        }
        private async Task <bool> LockArtifactInternalAsync(int artifactId, int userId, IDbTransaction transaction = null)
        {
            var parameters = new DynamicParameters();

            parameters.Add("@userId", userId);
            parameters.Add("@artifactId", artifactId);

            try
            {
                if (transaction == null)
                {
                    await _connectionWrapper.ExecuteAsync("LockArtifact", parameters, commandType : CommandType.StoredProcedure);
                }
                else
                {
                    await transaction.Connection.ExecuteAsync("LockArtifact", parameters, transaction, commandType : CommandType.StoredProcedure);
                }
            }
            catch (SqlException e)
            {
                if (e.Number == 50000) // Default error generated from SQL by RAISERROR ('Artifact already locked',16,1)
                {
                    return(false);
                }

                throw;
            }

            return(true);
        }
        public async Task RemoveDeletedArtifactsFromCollectionAsync(
            int collectionId, int userId, IDbTransaction transaction = null)
        {
            var parameters = new DynamicParameters();

            parameters.Add("@UserId", userId);
            parameters.Add("@CollectionId", collectionId);

            if (transaction == null)
            {
                await _connectionWrapper.ExecuteAsync(
                    "RemoveDeletedArtifactsFromCollection", parameters, commandType : CommandType.StoredProcedure);
            }
            else
            {
                await transaction.Connection.ExecuteAsync(
                    "RemoveDeletedArtifactsFromCollection", parameters, transaction,
                    commandType : CommandType.StoredProcedure);
            }
        }