TurtleZenTaoLib.IssuesForm.queryTaskById C# (CSharp) Method

queryTaskById() public method

public queryTaskById ( string taskId ) : TaskInfo
taskId string
return TaskInfo
        public TaskInfo queryTaskById(string taskId)
        {
            foreach (TaskInfo task in tasks)
            {
                if (task.id.Equals(taskId))
                {
                    return task;
                }
            }

            return null;
        }

Usage Example

コード例 #1
0
        public string OnCommitFinished(
            IntPtr hParentWnd,
            string commonRoot,
            string[] pathList,
            string logMessage,
            int revision)
        {
            SVNLog log = new SVNLog();

            log.files    = pathList;
            log.repoRoot = repoRoot;
            log.repoUrl  = repoUrl;
            log.revision = Convert.ToString(revision);
            log.message  = logMessage;
            bool isMatched = false;

            string          bugReg  = "(Fix\\s+)?[Bb]ug#(\\d+)";
            MatchCollection matches = Regex.Matches(logMessage, bugReg);
            string          resText = "";

            foreach (Match match in matches)
            {
                string operate = match.Groups[1].Value;
                string bugId   = match.Groups[2].Value;

                //任务完成
                if (match.Groups[1].Success)
                {
                    resText += "Bug#" + bugId + "已解决\r\n";
                    zenTaoManage.updateBug(bugId, "");

                    isMatched = true;
                }
            }

            string taskReg = "(Finish\\s+)?[Tt]ask#(\\d+).*?,\\s*[Cc]ost:(\\d+)\\s*left:(\\d+)";

            matches = Regex.Matches(logMessage, taskReg);
            foreach (Match match in matches)
            {
                string operate  = match.Groups[1].Value;
                string taskId   = match.Groups[2].Value;
                string consumed = match.Groups[3].Value;
                string left     = match.Groups[4].Value;

                TaskInfo task = issForm.queryTaskById(taskId);

                zenTaoManage.updateTask(task);
                isMatched = true;
                if (match.Groups[1].Success)
                {
                    resText += "Task#" + taskId + "," + taskId + ", " + consumed + ", " + left + "已完成\r\n";
                }
            }

            if (isMatched)
            {
                zenTaoManage.saveSVNLog(log);
            }


            return(resText);
        }