public static List<EffortLogEntry> GetEffortLog(List<string> issueList, List<string> resourceList, DateTime fromDate, DateTime toDate, BackgroundWorker worker) { var effortlogList = new List<EffortLogEntry>(); JiraSoapServiceService service = null; try { service = new JiraSoapServiceService(); var count = 0; var total = issueList.Count; foreach (var sd in issueList) { if (!worker.CancellationPending) { //var errorMsg = string.Empty; try { var response = service.getWorklogs(_token, sd); var sdData = service.getIssue(_token, sd); foreach (var log in response) { var updateDate = log.startDate.Value.ToLocalTime().Date; if (resourceList.Contains(log.author) && DateTime.Compare(fromDate, updateDate) <= 0 && DateTime.Compare(toDate, updateDate) >= 0) { effortlogList.Add(new EffortLogEntry() { Date = updateDate.ToShortDateString(), ResourceName = log.updateAuthor, SDNumber = sd, EffortInSeconds = log.timeSpentInSeconds, Comment = string.IsNullOrEmpty(log.comment) ? "No Comments" : log.comment, IssueType = sdData.type.Equals("42") ? IssueType.OPEX : IssueType.CAPEX }); } } } catch (SoapException ex) { MessageBox.Show(String.Format("Unable to get the work log for following SD Number:\n\n{0}", sd), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } count++; worker.ReportProgress(count * 100 / total); } } } catch (Exception ex) { } finally { if (service != null) service.Dispose(); } return effortlogList; }
public static void GetInvalidIssues(List<string> sdList, out List<string> invalidIssueList) { invalidIssueList = new List<string>(); if (sdList != null && sdList.Count > 0) { using (JiraSoapServiceService jiraService = new JiraSoapServiceService()) { foreach (var sd in sdList.Distinct()) { try { jiraService.getIssue(_token, sd); } catch (SoapException ex) { invalidIssueList.Add(sd); } } } } }
private static string GetUsersFullname() { string fullname = string.Empty; try { using (JiraSoapServiceService jiraService = new JiraSoapServiceService()) { var userDetail = jiraService.getUser(_token, _username); if (userDetail != null) { fullname = userDetail.fullname; } } } catch (Exception ex) { } return fullname; }
public static ResultModel VerifySD(string issueNumber, string userName, string password) { ResultModel result = new ResultModel(); try { using (JiraSoapServiceService jiraService = new JiraSoapServiceService()) { var token = jiraService.login(userName, password); result.Success = true; } } catch (Exception) { result.Success = false; result.Message = "This SD does not Exist"; } return result; }
public static void Logout() { try { if (IsInSession()) { using (JiraSoapServiceService jiraService = new JiraSoapServiceService()) { jiraService.logout(_token); _username = string.Empty; _token = string.Empty; } } else { _token = string.Empty; } } catch (Exception ex) { throw ex; } }
public static ResultModel LogWork(List<ExcelEntryModel> entries) { ResultModel result = new ResultModel(); try { using (JiraSoapServiceService jiraService = new JiraSoapServiceService()) { foreach (var entry in entries) { if (!entry.IssueNumber.Equals("SD-00001")) { try { jiraService.addWorklogAndAutoAdjustRemainingEstimate(_token, entry.IssueNumber, new RemoteWorklog() { startDate = entry.Date, timeSpent = entry.BilledMinutes + "m", comment = entry.ActivitiesPerformed, }); } catch (Exception Ex) { } } } } result.Success = true; } catch (InvalidCastException ex) { } catch (Exception ex) { result.Success = false; result.Message = ex.Message; } return result; }
public static bool Login(string username, string password) { bool isSuccess = false; try { using (JiraSoapServiceService jiraService = new JiraSoapServiceService()) { _token = jiraService.login(username, password); if (!string.IsNullOrEmpty(_token)) { isSuccess = true; _username = username; } } } catch (Exception ex) { } return isSuccess; }
public static List<RemoteIssueType> GetTypes() { List<RemoteIssueType> issueTypeList = new List<RemoteIssueType>(); bool initializedService = false; JiraSoapServiceService service = null; try { service = new JiraSoapServiceService(); initializedService = true; issueTypeList = service.getIssueTypes(_token).ToList(); } catch { } finally { if (initializedService) { service.Dispose(); } } return issueTypeList; }
public static List<Filter> GetSavedFilters() { var filters = new List<Filter>(); JiraSoapServiceService service = null; try { service = new JiraSoapServiceService(); var response = service.getSavedFilters(_token); foreach (var filter in response) { filters.Add(new Filter() { Id = filter.id, Name = filter.name }); } } catch (Exception ex) { } finally { if (service != null) service.Dispose(); } return filters; }
public static List<string> GetIssuesFromFilter(string filterId) { var issues = new List<string>(); JiraSoapServiceService service = null; try { service = new JiraSoapServiceService(); var response = service.getIssuesFromFilter(_token, filterId); foreach (var issue in response) { issues.Add(issue.key); } } catch (Exception ex) { } finally { if (service != null) service.Dispose(); } return issues; }
public static IssueData GetIssueData(string issueId, List<RemoteIssueType> typeList) { string issueNumber = issueId; if (Regex.IsMatch(issueId, @"^[0-9\s]{1,6}$")) { issueNumber = "SD-" + issueId.Replace(" ", ""); } else { issueNumber = issueId; } IssueData data = new IssueData() { IssueId = issueId }; bool initializedService = false; JiraSoapServiceService service = null; try { service = new JiraSoapServiceService(); initializedService = true; RemoteIssue issue = service.getIssue(_token, issueNumber); data.IssueType = typeList.Where(m => m.id == issue.type).Select(m => m.name).FirstOrDefault(); data.SubSystem = issue.customFieldValues.Where(m => m.customfieldId.Equals("customfield_11162")).Select(m => m.values.FirstOrDefault()).FirstOrDefault(); if (data.SubSystem.Equals("Undefined")) { data.SubSystem = string.Empty; } } catch (Exception ex) { data.IsInvalid = true; } finally { if (initializedService) { service.Dispose(); } } return data; }