private bool GetJobId(JsonItem details, out string jobId) { var jobIdJson = details.GetProperty(JobId); if (jobIdJson == null || jobIdJson.IsNullOrMissing || jobIdJson.IsError) { var id = details.GetProperty(ParentId); return(id.TryGetValue(out jobId)); } return(jobIdJson.TryGetValue(out jobId)); }
private string GetJsonPropertyStringValue(JsonItem item, string property) { var value = string.Empty; var prop = item.GetProperty(property); prop.TryGetValue(out value); return(value); }
private long GetJsonPropertyLongValue(JsonItem item, string property) { long value; var prop = item.GetProperty(property); prop.TryGetValue(out value); return(value); }
private JsonObject GetJsonObject(JsonItem item, string property) { var prop = item.GetProperty(property); if (prop == null || !prop.IsValidObject()) { return(null); } return((JsonObject)prop); }
private long?GetJsonPropertyNullableLongValue(JsonItem item, string property) { long value; var prop = item.GetProperty(property); if (prop.TryGetValue(out value)) { return(value); } return(null); }
private JobStatusCode GetJobStatusCodeValue(JsonItem item, string property) { var jobStatus = JobStatusCode.Unknown; var value = string.Empty; var prop = item.GetProperty(property); prop.TryGetValue(out value); if (value.IsNotNullOrEmpty()) { if (!Enum.TryParse(value, true, out jobStatus)) { jobStatus = JobStatusCode.Unknown; } } return(jobStatus); }
private IEnumerable <string> GetJsonArray(JsonItem item, string property) { var prop = item.GetProperty(property); if (prop == null || !prop.IsValidArray()) { return(null); } var ret = new List <string>(); var array = (JsonArray)prop; for (var i = 0; i < array.Count(); i++) { var value = this.GetJsonStringValue(array.GetIndex(i)); if (!string.IsNullOrEmpty(value)) { ret.Add(value); } } return(ret); }
private IEnumerable<string> GetJsonArray(JsonItem item, string property) { var prop = item.GetProperty(property); if (prop == null || !prop.IsValidArray()) { return null; } var ret = new List<string>(); var array = (JsonArray)prop; for (var i = 0; i < array.Count(); i++) { var value = this.GetJsonStringValue(array.GetIndex(i)); if (!string.IsNullOrEmpty(value)) { ret.Add(value); } } return ret; }
private JsonObject GetJsonObject(JsonItem item, string property) { var prop = item.GetProperty(property); if (prop == null || !prop.IsValidObject()) { return null; } return (JsonObject)prop; }
private string GetJsonPropertyStringValue(JsonItem item, string property) { var value = string.Empty; var prop = item.GetProperty(property); prop.TryGetValue(out value); return value; }
private JobStatusCode GetJobStatusCodeValue(JsonItem item, string property) { var jobStatus = JobStatusCode.Unknown; var value = string.Empty; var prop = item.GetProperty(property); prop.TryGetValue(out value); if (value.IsNotNullOrEmpty()) { if (!Enum.TryParse(value, true, out jobStatus)) { jobStatus = JobStatusCode.Unknown; } } return jobStatus; }
private long? GetJsonPropertyNullableLongValue(JsonItem item, string property) { long value; var prop = item.GetProperty(property); if (prop.TryGetValue(out value)) { return value; } return null; }
private long GetJsonPropertyLongValue(JsonItem item, string property) { long value; var prop = item.GetProperty(property); prop.TryGetValue(out value); return value; }
private bool GetJobId(JsonItem details, out string jobId) { var jobIdJson = details.GetProperty(JobId); if (jobIdJson == null || jobIdJson.IsNullOrMissing || jobIdJson.IsError) { var id = details.GetProperty(ParentId); return id.TryGetValue(out jobId); } return jobIdJson.TryGetValue(out jobId); }