Esempio n. 1
0
        StringBuilder SetModelInfo(IDataHelper helper, IDictionary <String, Object> sys)
        {
            if (sys == null)
            {
                return(null);
            }
            var sb = new StringBuilder("cmn.setModelInfo(root, {\n");

            foreach (var k in sys)
            {
                var val = k.Value;
                if (val is Boolean)
                {
                    val = val.ToString().ToLowerInvariant();
                }
                else if (val is String)
                {
                    val = $"'{val}'";
                }
                else if (val is Object)
                {
                    val = JsonConvert.SerializeObject(val);
                }
                else if (val is DateTime)
                {
                    val = helper.DateTime2StringWrap(val);
                }
                sb.Append($"'{k.Key}': {val},");
            }
            sb.RemoveTailComma();
            sb.Append("}, rawData);");
            return(sb);
        }