Example #1
0
        public void addComment(string issueKey, string commentString)
        {
            RemoteComment comment = new RemoteComment();

            comment.body = commentString;
            checkCredentials();
            jira.addComment(credentials, issueKey, comment);
        }
        public void addComment(JiraIssue issue, string comment)
        {
#if PLVS_133_WORKAROUND
            object[] comments = service.getComments(Token, issue.Key);
            if (comments == null)
            {
                throw new Exception("Unable to retrieve information about the RemoteComment type");
            }
            Type            type          = comments.GetType();
            Type            commentType   = type.GetElementType();
            ConstructorInfo constructor   = commentType.GetConstructor(new Type[] {});
            object          commentObject = constructor.Invoke(new object[] {});
            setObjectProperty(commentObject, "body", comment);
            service.addComment(Token, issue.Key, commentObject);
#else
            service.addComment(Token, issue.Key, new RemoteComment {
                body = comment
            });
#endif
        }
Example #3
0
        internal void AddComment(JiraIssue issue, string comment)
        {
            if (String.IsNullOrEmpty(comment))
            {
                return;
            }

            RemoteComment rc = new RemoteComment();

            rc.author  = CurrentUser.Id;
            rc.body    = comment;
            rc.created = DateTime.Now;

            _service.addComment(_token, issue.DisplayId, rc);
        }
Example #4
0
        private void jiraUploadBySoapWithToken()
        {
            try {
                JiraSoapServiceService service = new JiraSoapServiceService {
                    Url = serverUrl + "/rpc/soap/jirasoapservice-v2"
                };

                string[] fileNames = new[] { name };
                byte[]   bytes     = File.ReadAllBytes(path);

                service.addBase64EncodedAttachmentsToIssue(token, issueKey, fileNames, new[] { Convert.ToBase64String(bytes) });
                if (!string.IsNullOrEmpty(comment) && comment.Trim().Length > 0)
                {
                    RemoteComment c = new RemoteComment {
                        body = comment
                    };
                    service.addComment(token, issueKey, c);
                }

                Invoke(new MethodInvoker(delegate
                {
                    uploadLog.Text += "Done. See " + serverUrl + "/browse/" + issueKey + "\r\n";
                }));
            } catch (Exception e) {
                Debug.Write(e.StackTrace);
                Invoke(new MethodInvoker(delegate
                {
                    uploadLog.Text += "Failed: " + e.Message + "\r\n";
                }));
            }

            done = true;

            Invoke(new MethodInvoker(delegate
            {
                saveLastUsed();
                buttonCancel.Enabled = true;
                buttonCancel.Text    = "Close";
            }));
        }
Example #5
0
 public void addComment(JiraIssue issue, string comment)
 {
     service.addComment(token, issue.Key, new RemoteComment {
         body = comment
     });
 }
Example #6
0
        private void jiraUploadByPost()
        {
            try {
                JiraSoapServiceService service = new JiraSoapServiceService {
                    Url = serverUrl + "/rpc/soap/jirasoapservice-v2"
                };
                string tok = null;

                if (issueId == null)
                {
                    tok = service.login(userLogin, userPassword);

                    RemoteIssue issue = service.getIssue(tok, issueKey);
                    issueId = issue.id;
                }

                FileStream fs   = new FileStream(path, FileMode.Open, FileAccess.Read);
                byte[]     data = new byte[fs.Length];
                fs.Read(data, 0, data.Length);
                fs.Close();

                Dictionary <string, object> postParameters = new Dictionary <string, object>
                {
                    { "filename.1", new FormUpload.FileParameter(data, name, getMimeType(name)) },
                };

                const string userAgent = "Mazio";

                string postUrl =
                    serverUrl + "/secure/AttachFile.jspa?id=" + issueId
                    + (jSessionId == null
                        ? ("&os_username="******"&os_password="******"");

                HttpWebResponse webResponse;
                if (jSessionId != null)
                {
                    Cookie cookie = new Cookie("JSESSIONID", jSessionId, "/jira", serverUrl.Substring(0, serverUrl.LastIndexOf("/")));
                    webResponse = FormUpload.MultipartFormDataPost(postUrl, userAgent, postParameters, cookie);
                }
                else
                {
                    webResponse = FormUpload.MultipartFormDataPost(postUrl, userAgent, postParameters);
                }

                StreamReader responseReader = new StreamReader(webResponse.GetResponseStream());
#pragma warning disable 168
                string result = responseReader.ReadToEnd();
#pragma warning restore 168
                webResponse.Close();

                if (token != null && !string.IsNullOrEmpty(comment))
                {
                    service.addComment(tok, issueKey, new RemoteComment {
                        body = comment
                    });
                }

                Invoke(new MethodInvoker(delegate { uploadLog.Text += "Done. See " + serverUrl + "/browse/" + issueKey + "\r\n"; }));
            } catch (Exception e) {
                Debug.Write(e.StackTrace);
                Invoke(new MethodInvoker(delegate { uploadLog.Text += "Failed: " + e.Message + "\r\n"; }));
            }
            done = true;

            Invoke(new MethodInvoker(delegate {
                saveLastUsed();
                buttonCancel.Enabled = true;
                buttonCancel.Text    = "Close";
            }));
        }