Exemple #1
0
        private void GetIssueInformation(object sender, EventArgs e)
        {
            string issueDetails = "Time spent by {0} for issue {1}: {2} hour(s)";

            Jira.SDK.Jira jira = new Jira.SDK.Jira();

            try
            {
                jira.Connect("http://ssu-jira.softserveinc.com", tbLogin.Text, tbPassword.Text);              
            }
            catch (System.Runtime.Serialization.SerializationException )
            {
                MessageBox.Show("Invalid credentials");
                return;
            }

            Project project = jira.GetProject("RVNETJAN");
            Issue issue = jira.GetIssue("RVNETJAN-9");          
            long hoursSpent = issue.TimeTracking.TimeSpentSeconds / 3600;

            MessageBox.Show(String.Format(issueDetails, issue.Assignee.DisplayName, issue.Summary, hoursSpent.ToString()));
        }
Exemple #2
0
		public void SetJira(Jira jira)
		{
			_jira = jira;
		}
Exemple #3
0
        public void Report(IUser user, DiscordSocketClient client, RestUserMessage message, InteractiveService interactive, string type)
        {
            IDMChannel dmChannel = user.GetOrCreateDMChannelAsync().Result;

            IUserMessage sent = dmChannel.SendMessageAsync($"What is the title of this {type}?\n{message.Content}").Result;

            SocketMessage reply = WaitForReply(client, sent, dmChannel.Id, user.Id).Result;

            string title = reply?.Content;

            if (!string.IsNullOrEmpty(title))
            {
                Jira.SDK.Jira jira = new Jira.SDK.Jira();

                try
                {
                    jira.Connect(settings.JiraUrl, settings.Username, settings.Password);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }

                Project project = jira.GetProject(settings.JiraProject);

                StringBuilder stringBuilder = new StringBuilder();

                foreach (Attachment attachment in message.Attachments)
                {
                    stringBuilder.AppendLine(attachment.Url);
                }

                if (stringBuilder.ToString() == "")
                {
                    stringBuilder.AppendLine("* No attachments.");
                }

                try
                {
                    Issue newIssue = project.CreateIssue(new IssueFields()
                    {
                        Summary = title + " (USER)",                                                                            //Set issue summary to the reply from the dev sent thru DMs.

                        IssueType = new IssueType(int.Parse(type == "Bug" ? settings.BugIssueType : settings.UserStory), type), //set issue-type

                        Description = "Issue reported by Discord user \"" + message.Author.Username + "\". " +
                                      $"*Reported bug*:\n{message.Content}\n*Attachments*:\n{stringBuilder.ToString()}", //Add bug description based on the reacted message

                        //    Labels = new List<string>()
                        //{
                        //    "User" //adds the "user" label
                        //},

                        //    CustomFields = new Dictionary<string, CustomField>()
                        //{
                        //    { "customfield_" + settings.CustomFieldId, new CustomField(int.Parse(settings.CustomFieldId), "Build")} //Adds custom field: build
                        //}
                    });
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }

                IUserMessage confirmation = dmChannel.SendMessageAsync("Bug reported!").Result;
            }
        }
Exemple #4
0
 public void Connect(string serverUrl, string username, string password)
 {
     Jira = new Jira();
     Jira.Connect(new JiraClient(serverUrl, username, password));
 }
Exemple #5
0
 public void SetJira(Jira jira)
 {
     _jira = jira;
 }