Exemplo n.º 1
0
        public List<PVTableRow> ProcessedSessionLengthData(DataTable data, TimeInterval interval, DateTime startDate, DateTime endDate, string timestampColumnName)
        {
            // This method expects the dates to be rounded to their respected intervals

            //init return list
            List<PVTableRow> response = new List<PVTableRow>()
            {
            };

            // Capture the series data that matches the record timestamp
            if (data.HasRows())
            {
                List<object> SeriesNames = data.AsEnumerable().Select(r => r["SeriesName"]).Distinct().ToList();
                foreach (DataRow row in data.Rows)
                {
                    PVTableRow tablerow = new PVTableRow()
                    {
                        data = new List<PlaytricsPair>(),
                        index = row["RecordTimestamp"].ToString()
                    };
                    foreach (string sessionName in SeriesNames)
                    {
                        PlaytricsPair sessionLength = new PlaytricsPair()
                        {
                            name = sessionName,
                            value = 0
                        };
                        tablerow.data.Add(sessionLength);
                    }

                    // Iterate through the series keypairs
                    response.Add(tablerow);
                }
            }

            return response;
        }
Exemplo n.º 2
0
        public List<PVTableRow> ProcessedDataTable(DataTable data, TimeInterval interval, DateTime startDate, DateTime endDate, string timestampColumnName)
        {
            // This method expects the dates to be rounded to their respected intervals

            //init return list
            List<PVTableRow> response = new List<PVTableRow>();

            // Capture the series data that matches the record timestamp
            if (data.HasRows())
            {
                foreach (DataRow row in data.Rows)
                {
                    List<PlaytricsPair> rowdata = new List<PlaytricsPair>();
                    // Iterate through the series keypairs
                    for (int x = 1; x < data.Columns.Count; x += 2)
                    {
                        if (row[x].ToString() == "")
                        {
                            continue;
                        }
                        string seriesName = row[x].ToString();
                        string seriesValue = row[x + 1].ToString();
                        PlaytricsPair datapoint = new PlaytricsPair()
                        {
                            name = seriesName,
                            value = (String.Format("{0} seconds", Int32.Parse(seriesValue) / 1000))
                        };
                        rowdata.Add(datapoint);
                    }
                    PVTableRow tablerow = new PVTableRow()
                    {
                        data = rowdata,
                        index = row["RecordTimestamp"].ToString()
                    };
                    response.Add(tablerow);
                }
            }

            return response;
        }