Пример #1
0
        private static void UpdateIssue(JiraSoapServiceService jiraSoapService, string token, RemoteProject project, JiraIssue jiraIssue)
        {
            string updateMessage = "--- This is an automated message --- " + Environment.NewLine
                + "This issue and the following fields have been updated: " + Environment.NewLine;

            string searchTerms = AreDuplicateIssues(jiraSoapService, token, project, jiraIssue);
            string[] keys = {project.key};

            RemoteComment updateComment = new RemoteComment();
            var existingDuplicateIssue = jiraSoapService.getIssuesFromTextSearchWithProject(token, keys, searchTerms, 1);

            if (jiraIssue.Summary.Replace("\r", string.Empty) != existingDuplicateIssue[0].summary)
            {
                updateMessage += ("-----------------------------------" + Environment.NewLine
                                    +"Summary: " + Environment.NewLine
                                    + jiraIssue.Summary + Environment.NewLine);
            }

            if (jiraIssue.Description.Replace("\r", string.Empty) != existingDuplicateIssue[0].description.Trim())
            {
                int length = jiraIssue.Description.Length;
                for (int i = 0; i < length; i++)
                {
                    if (jiraIssue.Description[i] != existingDuplicateIssue[0].description[i])
                        break;
                }

                int len = existingDuplicateIssue[0].description.Length;
                updateMessage += ("-----------------------------------" + Environment.NewLine
                                    +"Description: " + Environment.NewLine
                                    + jiraIssue.Description + Environment.NewLine);
            }

            else
            {
                updateMessage = "--- This is an automated message --- " + Environment.NewLine
                                + "Identical issue with no updated fields was attempted to be imported";
            }

            updateComment.body = updateMessage;
            jiraSoapService.addComment(token, existingDuplicateIssue[0].key, updateComment);

            System.Diagnostics.Debug.WriteLine("Successfully updated issue http://pm.iqmetrix.com/browse/" + existingDuplicateIssue[0].key);
            Console.WriteLine("Successfully updated issue http://pm.iqmetrix.com/browse/" + existingDuplicateIssue[0].key + Environment.NewLine);
        }
Пример #2
0
        private static List<string> GetListOfSprintIDs(RemoteProject project, JiraSoapServiceService jiraSoapService, string token, string searchTerms)
        {
            string[] keys = {project.key};
            string[] s = keys;
            var listOfIssues = jiraSoapService.getIssuesFromTextSearchWithProject(token, keys, searchTerms, 500);
            var n = listOfIssues.Length;

            var listOfSprintIDs = new List<string>();
            foreach (var oneissue in listOfIssues)
            {
                RemoteCustomFieldValue[] customfields = oneissue.customFieldValues;

                for (int i = customfields.Length - 1; i >= 0; i--)
                {
                    var temp = 0;
                    string[] fieldvalues = customfields[i].values;

                    for (int j = 0; j < fieldvalues.Length; j++)
                    {
                        if (int.TryParse(fieldvalues[j], out temp) && fieldvalues[j].ToString().Length == 6)
                        {
                            listOfSprintIDs.Add(fieldvalues[j]);
                        }

                    }
                }
            }
            return listOfSprintIDs;
        }