private float? GetValue(YouTrack.Issue issue) { var stringValue = GetFieldValue(issue, "Estimation"); if (string.IsNullOrWhiteSpace(stringValue)) return null; var values = JsonConvert.DeserializeObject<int[]>(stringValue); if (values.Any()) return values.First(); return null; }
private string GetFieldValue(YouTrack.Issue issue, string fieldName) { var item = issue.Field.SingleOrDefault(i => string.Equals(i.Name, fieldName, StringComparison.InvariantCultureIgnoreCase)); return item != null ? item.Value : null; }
private DateTime? GetTimeStamp(YouTrack.Issue issue) { var stringValue = GetFieldValue(issue, "resolved"); if (string.IsNullOrWhiteSpace(stringValue)) return null; return Client.Convert(Convert.ToInt64(stringValue)); }
public Issue(string lineLabel, YouTrack.Issue issue) { if (lineLabel == null) throw new ArgumentNullException("lineLabel"); if (issue == null) throw new ArgumentNullException("issue"); LineLabel = lineLabel; Id = issue.Id; Summary = GetFieldValue(issue, "summary"); Value = GetValue(issue); Timestamp = GetTimeStamp(issue); var typeData = GetFieldValue(issue, "Type"); if (!string.IsNullOrWhiteSpace(typeData)) { var type = JsonConvert.DeserializeObject<string[]>(typeData); Type = type.First(); } }