/// <summary> /// Tries to match a specific <see cref="EventOccurrence">event occurrence</see> from a set of them, using /// querystring parameters on an <see cref="HttpRequest"/>. The parameters are "schedule", which is the /// <see cref="Guid"/> ID of an adx_eventschedule, and "start", which is the start <see cref="DateTime"/> /// of the occurrence. /// </summary> public bool TryMatchRequestEventOccurrence(HttpRequest request, IEnumerable <IEventOccurrence> occurrences, out IEventOccurrence requestOccurrence) { if (request == null) { throw new ArgumentNullException("request"); } if (occurrences == null) { throw new ArgumentNullException("occurrences"); } requestOccurrence = null; Guid schedule; if (!Guid.TryParse(request["schedule"], out schedule)) { return(false); } DateTime start; if (!DateTime.TryParseExact(request["start"], "o", CultureInfo.InvariantCulture, DateTimeStyles.RoundtripKind, out start)) { return(false); } requestOccurrence = occurrences.FirstOrDefault(e => e.EventSchedule.Id == schedule && e.Start == start); return(requestOccurrence != null); }
public EventOccurrenceDrop(IPortalLiquidContext portalLiquidContext, IDataAdapterDependencies dependencies, IEventOccurrence occurrence) : base(portalLiquidContext) { Occurrence = occurrence; _dependencies = dependencies; }