示例#1
0
        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));
        }
示例#2
0
        private string GetJsonPropertyStringValue(JsonItem item, string property)
        {
            var value = string.Empty;
            var prop  = item.GetProperty(property);

            prop.TryGetValue(out value);
            return(value);
        }
示例#3
0
        private long GetJsonPropertyLongValue(JsonItem item, string property)
        {
            long value;
            var  prop = item.GetProperty(property);

            prop.TryGetValue(out value);
            return(value);
        }
示例#4
0
        private JsonObject GetJsonObject(JsonItem item, string property)
        {
            var prop = item.GetProperty(property);

            if (prop == null || !prop.IsValidObject())
            {
                return(null);
            }
            return((JsonObject)prop);
        }
示例#5
0
        private long?GetJsonPropertyNullableLongValue(JsonItem item, string property)
        {
            long value;
            var  prop = item.GetProperty(property);

            if (prop.TryGetValue(out value))
            {
                return(value);
            }

            return(null);
        }
示例#6
0
        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);
        }
示例#7
0
        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);
 }