private string GetWorkingTime() { var queryresult = GetConnectionHandler().GetAssignedIssuesForUser(UsernameTextBox.Text, ProjectKeyTextBox.Text); cConsole.WriteOutput("Parsing Response, please wait..."); if (queryresult != null) { IssuesRoot decoderesult = jsonConv.DecodeJsonToIssuesRoot(queryresult); int timeinseconds = CalculateWorkingTimeInSeconds(decoderesult); return(TimeSpan.FromSeconds(timeinseconds).TotalHours.ToString()); } else { return(null); } }
private int CalculateWorkingTimeInSeconds(IssuesRoot root) { int result = 0; for (int i = 0; i < root.issues.Count; i++) { if (root.issues[i].fields.assignee == null) { continue; } if (root.issues[i].fields.timespent != null && root.issues[i].fields.assignee.name == UsernameTextBox.Text) { result += (int)root.issues[i].fields.timespent; } } return(result); }