9ee9146993ec8d262eb1aba7dc6cd4f86fb7f66a
How-to-Add-a-Custom-Timespan-Type.md
| ... | ... | @@ -0,0 +1,21 @@ |
| 1 | +#How to Add a Custom Timespan Type |
|
| 2 | + |
|
| 3 | +[[_TOC_]] |
|
| 4 | + |
|
| 5 | +##Adding Custom Timespans |
|
| 6 | + |
|
| 7 | +Here is an example of how to add custom time spans to the filters. Apply this code within ConfigureSettings in Global.asax. |
|
| 8 | + |
|
| 9 | +```csharp |
|
| 10 | +CustomTimePeriod customTimePeriod = AdHocSettings.CustomTimePeriod[key]; |
|
| 11 | +TimeSpan period = customTimePeriod.Period; |
|
| 12 | +if (period.Ticks >0) |
|
| 13 | +{ |
|
| 14 | + startDate=now+period; |
|
| 15 | +} |
|
| 16 | +else |
|
| 17 | +{ |
|
| 18 | + endDate=now; |
|
| 19 | + startDate=now.period; |
|
| 20 | +} |
|
| 21 | +``` |
|
| ... | ... | \ No newline at end of file |