8abe3fca8c10ab5d820f53cae54e04a56768e2cb
FAQ/Questions/Adding-Custom-Time-Periods.md
| ... | ... | @@ -0,0 +1,23 @@ |
| 1 | +#How to Add a Custom TimePeriod Type |
|
| 2 | + |
|
| 3 | +[[_TOC_]] |
|
| 4 | + |
|
| 5 | +##Adding Custom TimePeriods |
|
| 6 | + |
|
| 7 | +Here is an example of how to add custom time spans to the filters. Apply this code within ``InitializeReporting()`` in your Global.asax. |
|
| 8 | + |
|
| 9 | +```csharp |
|
| 10 | +//the if block prevents the key from being re-added to the list |
|
| 11 | +if (!AdHocSettings.CustomTimePeriods.ContainsKey("Lunar Cycle")) { |
|
| 12 | + AdHocSettings.CustomTimePeriods.Add("Lunar Cycle", new CustomTimePeriod("Lunar Cycle", new TimeSpan(29, 12, 44, 2, 976))); |
|
| 13 | +} |
|
| 14 | +``` |
|
| 15 | + |
|
| 16 | +##Modifying An Existing Time Period |
|
| 17 | + |
|
| 18 | +You may at any time modify your existing set of custom time periods. You cannot, however, modify built-in time periods this way. |
|
| 19 | + |
|
| 20 | +```csharp |
|
| 21 | + CustomTimePeriod ctp = AdHocSettings.CustomTimePeriods["Lunar Cycle"]; |
|
| 22 | + ctp.StartDate = DateTime.Now + ctp.Period; //passed by reference so the original list will update |
|
| 23 | +``` |
|
| ... | ... | \ No newline at end of file |
FAQ/Questions/How-to-Add-a-Custom-Timespan-Type.md
| ... | ... | @@ -1,23 +0,0 @@ |
| 1 | -#How to Add a Custom TimePeriod Type |
|
| 2 | - |
|
| 3 | -[[_TOC_]] |
|
| 4 | - |
|
| 5 | -##Adding Custom TimePeriods |
|
| 6 | - |
|
| 7 | -Here is an example of how to add custom time spans to the filters. Apply this code within ``InitializeReporting()`` in your Global.asax. |
|
| 8 | - |
|
| 9 | -```csharp |
|
| 10 | -//the if block prevents the key from being re-added to the list |
|
| 11 | -if (!AdHocSettings.CustomTimePeriods.ContainsKey("Lunar Cycle")) { |
|
| 12 | - AdHocSettings.CustomTimePeriods.Add("Lunar Cycle", new CustomTimePeriod("Lunar Cycle", new TimeSpan(29, 12, 44, 2, 976))); |
|
| 13 | -} |
|
| 14 | -``` |
|
| 15 | - |
|
| 16 | -##Modifying An Existing Time Period |
|
| 17 | - |
|
| 18 | -You may at any time modify your existing set of custom time periods. You cannot, however, modify built-in time periods this way. |
|
| 19 | - |
|
| 20 | -```csharp |
|
| 21 | - CustomTimePeriod ctp = AdHocSettings.CustomTimePeriods["Lunar Cycle"]; |
|
| 22 | - ctp.StartDate = DateTime.Now + ctp.Period; //passed by reference so the original list will update |
|
| 23 | -``` |
|
| ... | ... | \ No newline at end of file |