private string GetOverTimeName(int index, AggregateTimeRange timeRange, DateTimeOffset now) { string result = string.Empty; switch (timeRange) { case AggregateTimeRange.None: throw new InvalidEnumArgumentException("Must specify time range value other than None"); case AggregateTimeRange.SevenDays: result = now.AddDays(index * -1).DayOfWeek.ToString(); break; case AggregateTimeRange.ThreeMonths: result = now.AddDays(-1 * (int)now.DayOfWeek).AddDays(index * -7).DateTime.ToShortDateString(); break; case AggregateTimeRange.OneYear: result = now.AddMonths(index * -1).DateTime.ToShortDateString(); break; default: throw new NotSupportedException("Value: " + timeRange.ToString()); } return(result); }
private static int GetTimeRangeMultipler(AggregateTimeRange timeRange) { int multiplier; switch (timeRange) { case AggregateTimeRange.None: throw new InvalidEnumArgumentException("Must specify time range value other than None"); case AggregateTimeRange.SevenDays: multiplier = 1; break; case AggregateTimeRange.ThreeMonths: multiplier = 20; break; case AggregateTimeRange.OneYear: multiplier = 50; break; default: throw new NotSupportedException("Value: " + timeRange.ToString()); } return(multiplier); }