internal void ProcessWorklog(JiraIssue issue, string timeSpent, TimeEstimateRecalcualationMethod method, string newTimeEstimate) { var remoteWorklog = new RemoteWorklog(); remoteWorklog.comment = "Time logged"; remoteWorklog.timeSpent = timeSpent; remoteWorklog.startDate = new DateTime(); switch (method) { case TimeEstimateRecalcualationMethod.AdjustAutomatically: _service.addWorklogAndAutoAdjustRemainingEstimateFixed(_token, issue.DisplayId, remoteWorklog); break; case TimeEstimateRecalcualationMethod.DoNotChange: _service.addWorklogAndRetainRemainingEstimateFixed(_token, issue.DisplayId, remoteWorklog); break; case TimeEstimateRecalcualationMethod.SetToNewValue: _service.addWorklogWithNewRemainingEstimateFixed(_token, issue.DisplayId, remoteWorklog, newTimeEstimate); break; default: throw new ArgumentOutOfRangeException("ProcessWorklog"); } }
internal void ViewIssue(JiraIssue issue) { string url = String.Format("{0}/browse/{1}", _rootUrl, issue.DisplayId); try { System.Diagnostics.Process.Start(url); } catch (Exception e) { Log.Error(e, "Failed to view issue at uri = {0}.", url); } }
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); }
internal JiraAction[] GetActions(JiraIssue issue) { List <JiraAction> results = new List <JiraAction>(); try { RemoteNamedObject[] actionsAvailable = _service.getAvailableActions(_token, issue.DisplayId); if (actionsAvailable != null) //dumbasses { foreach (RemoteNamedObject item in actionsAvailable) { results.Add(new JiraAction(item)); } } } catch { } return(results.ToArray()); }
internal void ProcessAction(JiraIssue issue, IIssueAction action, IIssueUser assignTo) { List <RemoteFieldValue> actionParams = new List <RemoteFieldValue>(); RemoteField[] fields = _service.getFieldsForAction(_token, issue.DisplayId, action.Id); foreach (RemoteField field in fields) { RemoteFieldValue param = new RemoteFieldValue(); string paramName = param.id = field.id; if (StringComparer.OrdinalIgnoreCase.Equals("Resolution", field.name)) { param.values = new string[] { FindFixResolution() } } ; else if (StringComparer.OrdinalIgnoreCase.Equals("Assignee", field.name)) { param.values = new string[] { assignTo.Id } } ; else if (StringComparer.OrdinalIgnoreCase.Equals("Worklog", paramName)) // JIRA 4.1 - worklogs are required! { continue; } else { param.values = issue.GetFieldValue(paramName); if (param.values == null || param.values.Length == 0 || (param.values.Length == 1 && param.values[0] == null)) { string setting = _settings(String.Format("{0}:{1}", action.Name, field.name)); if (setting != null) { param.values = new string[] { setting } } ; } } actionParams.Add(param); } RemoteIssue newIssue = _service.progressWorkflowAction(_token, issue.DisplayId, action.Id, actionParams.ToArray()); }