This commit is contained in:
2020-11-24 23:00:17 +00:00
parent e89f508f99
commit dd967b4e27
4 changed files with 23 additions and 11 deletions

View File

@@ -269,6 +269,7 @@ namespace AyaNova.Biz
foreach (Customer w in orderedList) foreach (Customer w in orderedList)
{ {
var jo = JObject.FromObject(w); var jo = JObject.FromObject(w);
if (!JsonUtil.JTokenIsNullOrEmpty(jo["CustomFields"]))
jo["CustomFields"] = JObject.Parse((string)jo["CustomFields"]); jo["CustomFields"] = JObject.Parse((string)jo["CustomFields"]);
ReportData.Add(jo); ReportData.Add(jo);
} }

View File

@@ -181,7 +181,6 @@ namespace AyaNova.Biz
foreach (CustomerNote w in orderedList) foreach (CustomerNote w in orderedList)
{ {
var jo = JObject.FromObject(w); var jo = JObject.FromObject(w);
// jo["CustomFields"] = JObject.Parse((string)jo["CustomFields"]);
ReportData.Add(jo); ReportData.Add(jo);
} }
} }

View File

@@ -303,6 +303,7 @@ namespace AyaNova.Biz
foreach (Widget w in orderedList) foreach (Widget w in orderedList)
{ {
var jo = JObject.FromObject(w); var jo = JObject.FromObject(w);
if (!JsonUtil.JTokenIsNullOrEmpty(jo["CustomFields"]))
jo["CustomFields"] = JObject.Parse((string)jo["CustomFields"]); jo["CustomFields"] = JObject.Parse((string)jo["CustomFields"]);
ReportData.Add(jo); ReportData.Add(jo);
} }

View File

@@ -69,6 +69,15 @@ namespace AyaNova.Util
return ret; return ret;
} }
public static bool JTokenIsNullOrEmpty(JToken token)
{
return (token == null) ||
(token.Type == JTokenType.Array && !token.HasValues) ||
(token.Type == JTokenType.Object && !token.HasValues) ||
(token.Type == JTokenType.String && token.ToString() == String.Empty) ||
(token.Type == JTokenType.Null);
}
//Contract resolver used for exporting to file translations and report templates //Contract resolver used for exporting to file translations and report templates
//and ignoring specified propertes //and ignoring specified propertes
public class ShouldSerializeContractResolver : DefaultContractResolver public class ShouldSerializeContractResolver : DefaultContractResolver
@@ -88,6 +97,8 @@ namespace AyaNova.Util
}//eoc }//eoc
}//eons }//eons