예제 #1
0
        internal TFSData getTFSDataFromCheckin(TFSDataDTO content)
        {
            if (content?.resource?.changesetId == null)
            {
                return(null);
            }
            if (content?.resource?.author == null)
            {
                return(null);
            }
            if (content?.resource?.comment == null)
            {
                return(null);
            }

            int?wrikeJobID = CommitMessageLogic.GetWrikeJobID(content.resource.comment);

            if (!wrikeJobID.HasValue)
            {
                return(null);
            }

            return(new TFSData
            {
                ChangesetID = content.resource.changesetId,
                CommitAuthor = content.resource.author.displayName,
                CommitMessage = content.resource.comment,
                FullMessageHtml = content.detailedMessage.html,
                WrikeJobID = wrikeJobID.Value,
            });
        }
예제 #2
0
        public HttpResponseMessage codeCheckinHook([FromBody] TFSDataDTO Content)
        {
            var tfsData = tfsLogic.getTFSDataFromCheckin(Content);

            if (tfsData != null)
            {
                wrikeClient.UpdateChangeSets(
                    tfsData.WrikeJobID, tfsData.ChangesetID, tfsData.CommitMessage, tfsData.FullMessageHtml, tfsData.CommitAuthor);
            }

            return(this.Request.CreateResponse(HttpStatusCode.OK));
        }
예제 #3
0
        internal TFSData getTFSDataFromPush(TFSDataDTO content)
        {
            if (content?.resource?.commits == null)
            {
                return(null);
            }
            if (content.resource.commits.Length == 0)
            {
                return(null);
            }
            if (content.resource.commits[0] == null)
            {
                return(null);
            }
            if (content.resource.commits[0].comment == null)
            {
                return(null);
            }

            var commit = content.resource.commits[0];

            if (!commit.comment.ToLower().Contains("wrike"))
            {
                return(null);
            }

            int?wrikeJobID = CommitMessageLogic.GetWrikeJobID(commit.comment);

            if (!wrikeJobID.HasValue)
            {
                return(null);
            }

            return(new TFSData
            {
                CommitID = commit.commitId,
                CommitAuthor = commit.author?.name,
                CommitMessage = commit.comment,
                FullMessageHtml = content.detailedMessage.html,
                WrikeJobID = wrikeJobID.Value,
            });
        }