internal static string ToJson(ThemeGridUniqueItem item)
{
string json = "{";
List<string> list = new List<string>();
if (!string.IsNullOrEmpty(item.Caption))
{
list.Add(string.Format("\"caption\":\"{0}\"", item.Caption));
}
else
{
list.Add("\"caption\":\"\"");
}
//默认值这边儿是个问题,要不要判断呢?
list.Add(string.Format("\"visible\":{0}", item.Visible.ToString(System.Globalization.CultureInfo.InvariantCulture).ToLower()));
if (item.Caption != null)
{
list.Add(string.Format("\"color\":{0}", ServerColor.ToJson(item.Color)));
}
else
{
list.Add(string.Format("\"color\":{0}", ServerColor.ToJson(new ServerColor())));
}
if (!string.IsNullOrEmpty(item.Unique))
{
list.Add(string.Format("\"unique\":\"{0}\"", item.Unique));
}
else
{
list.Add("\"unique\":\"\"");
}
json += string.Join(",", list.ToArray());
json += "}";
return json;
}