本文整理汇总了C#中TimeInterval.GetTimeIntervalString方法的典型用法代码示例。如果您正苦于以下问题:C# TimeInterval.GetTimeIntervalString方法的具体用法?C# TimeInterval.GetTimeIntervalString怎么用?C# TimeInterval.GetTimeIntervalString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TimeInterval
的用法示例。
在下文中一共展示了TimeInterval.GetTimeIntervalString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetPrivateSessionTimeSeries
public List<PVTimeSeries> GetPrivateSessionTimeSeries(string gameShort, TimeInterval interval, DateTime startDate, DateTime endDate)
{
#region Validation
GameMonitoringConfig game = Games.Instance.GetMonitoredGames().Where(x => x.ShortTitle == gameShort).FirstOrDefault();
#endregion
List<PVTimeSeries> timeSeriesData = new List<PVTimeSeries>();
startDate = startDate.RoundDown(interval);
endDate = endDate.RoundDown(interval);
// Create a chart for each privacy comparison session type
foreach (string sessionType in GetPrivateSessionCompareTypes(game))
{
string query = String.Format(
@"SELECT RecordTimestamp,
'Private', PrivateSessions,
'Non-Private', Sessions
FROM {0}
WHERE GameId = '{1}'
AND SessionType = '{2}'
AND RecordTimestamp BETWEEN '{3}' AND '{4}'
GROUP BY RecordTimestamp
ORDER BY RecordTimestamp;",
String.Format("GameSessionUserStats{0}", interval.GetTimeIntervalString()),
game.Id,
sessionType,
startDate.ToString("yyyy-MM-dd HH:mm:ss"),
endDate.ToString("yyyy-MM-dd HH:mm:ss"));
try
{
// Get time series data
DataTable queryResults = DBManager.Instance.Query(Datastore.Monitoring, query);
if (queryResults.HasRows())
{
foreach (DataRow row in queryResults.Rows)
{
PVTimeSeries series = timeSeriesData.FirstOrDefault(x => x.name == row["Private"].ToString());
if (series == default(PVTimeSeries))
{
series = new PVTimeSeries();
series.name = row["Private"].ToString();
series.data = new List<int>();
series.pointStart = queryResults.Rows[0].Field<DateTime>("RecordTimestamp").ToUnixTimestamp() * 1000; //JS unix timestamp is in milliseconds
series.pointInterval = (int)interval * 60 * 1000; //JS unix timestamp is in milliseconds
series.type = "area";
timeSeriesData.Add(series);
}
PVTimeSeries nonPrivateSeries = timeSeriesData.FirstOrDefault(x => x.name == row["Non-Private"].ToString());
if (nonPrivateSeries == default(PVTimeSeries))
{
nonPrivateSeries = new PVTimeSeries();
nonPrivateSeries.name = row["Non-Private"].ToString();
nonPrivateSeries.data = new List<int>();
nonPrivateSeries.pointStart = queryResults.Rows[0].Field<DateTime>("RecordTimestamp").ToUnixTimestamp() * 1000; //JS unix timestamp is in milliseconds
nonPrivateSeries.pointInterval = (int)interval * 60 * 1000; //JS unix timestamp is in milliseconds
nonPrivateSeries.type = "area";
timeSeriesData.Add(nonPrivateSeries);
}
series.data.Add(Convert.ToInt32(row["PrivateSessions"].ToString()));
nonPrivateSeries.data.Add(Convert.ToInt32(row["Sessions"].ToString()));
}
}
}
catch (Exception ex)
{
Logger.Instance.Exception(ex.Message, ex.StackTrace);
}
}
return timeSeriesData;
}