/// <summary> /// Renders the specified context. /// </summary> /// <param name="context">The context.</param> /// <param name="result">The result.</param> public override void OnRender(ILavaRenderContext context, TextWriter result) { try { var dataSource = new EventOccurrencesLavaDataSource(); _settings.ParseFromMarkup(_attributesMarkup, context); var events = dataSource.GetEventOccurrencesForCalendar(_settings, LavaHelper.GetRockContextFromLavaContext(context)); AddLavaMergeFieldsToContext(context, events); base.OnRender(context, result); } catch (Exception ex) { var message = "Calendar Events not available. " + ex.Message; if (_renderErrors) { result.Write(message); } else { ExceptionLogService.LogException(ex); } } }
/// <summary> /// Renders the specified context. /// </summary> /// <param name="context">The context.</param> /// <param name="result">The result.</param> public override void Render(Context context, TextWriter result) { try { var dataSource = new EventOccurrencesLavaDataSource(); _settings.ParseFromMarkup(_attributesMarkup, context); var events = dataSource.GetEventOccurrencesForEvent(_settings); AddLavaMergeFieldsToContext(context, events); RenderAll(this.NodeList, context, result); } catch (Exception ex) { var message = "Event Occurrences not available. " + ex.Message; if (_renderErrors) { result.Write(message); } else { ExceptionLogService.LogException(ex); } } }