Esempio n. 1
0
        public static string ToJSONString(List <IncomeStatistics> listData)
        {
            try
            {
                string jsonStr = "";

                jsonStr += "{";
                jsonStr += "\"message\": \"Okay\",";
                jsonStr += "\"data\": [";
                for (int i = 0, lenght = listData.Count; i < lenght; i++)
                {
                    jsonStr += "[";

                    long ticks = JSONUtilities.GetJavascriptTimestamp(listData[i].OrderDate);
                    jsonStr += ticks + ", ";
                    jsonStr += listData[i].DetailTotal.ToString();
                    jsonStr += "]";
                    if (i < lenght - 1)
                    {
                        jsonStr += ", ";
                    }
                }


                jsonStr += "]";

                jsonStr += "}";

                return(jsonStr);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }