Example #1
0
 public AuditService()
 {
     _allProperties = new Lazy <IDictionary <Guid, IAuditProperty> >(() =>
                                                                     EventKinds.SelectMany(k => k.Properties).Distinct().ToDictionary(p => p.ID));
     _allEventKinds = new Lazy <IDictionary <Guid, AuditEventKind> >(() =>
                                                                     EventKinds.ToDictionary(k => k.ID));
     _filterFactories = new Lazy <ILookup <string, IAuditEventFilterFactory <TDomain> > >(() =>
                                                                                          FilterFactories.EmptyIfNull().ToLookup(f => f.Id.ToString(), StringComparer.InvariantCultureIgnoreCase));
 }
Example #2
0
 /// <summary>
 /// Instantiates a new instance of the ConditionalEvent class.
 /// </summary>
 /// <param name="conditionScript">The condition script of this instance.</param>
 /// <param name="kind">The kind of this instance.</param>
 /// <param name="title">The title of this instance.</param>
 /// <param name="criticality">The criticality of this instance.</param>
 /// <param name="description">The description of this instance.</param>
 /// <param name="date">The date of this instance.</param>
 /// <param name="id">The ID of this instance.</param>
 public BdoConditionalEvent(
     string conditionScript,
     EventKinds kind,
     string title = "",
     BdoEventCriticality criticality = BdoEventCriticality.None,
     string description = "",
     DateTime?date      = null,
     string id          = null) : base(kind, title, criticality, description, date, id)
 {
     ConditionScript = conditionScript;
 }
Example #3
0
        // Gets -------------------------

        /// <summary>
        /// Gets the maximum kind of events of the specified event kinds.
        /// </summary>
        /// <param name="eventKinds">The event kinds to consider.</param>
        /// <returns>True if this instance has the specified events. False otherwise.</returns>
        public static EventKinds Max(this List <EventKinds> eventKinds)
        {
            EventKinds eventKind = EventKinds.None;

            if (eventKinds != null)
            {
                foreach (EventKinds currentEventKind in eventKinds)
                {
                    eventKind = currentEventKind.Max(eventKind);
                }
            }

            return(eventKind);
        }
Example #4
0
        public ActionResult GetSelector(string propertyId, string onChangeFunction)
        {
            var sel = from id in Maybe.ParseGuid(propertyId)
                      from prop in EventKinds.SelectMany(k => k.Properties).FirstOrDefault(p => p.ID == id)
                      from ui in RenderSelector(Composition, prop, null)
                      select ui;

            if (sel.Kind == MaybeKind.Null)
            {
                return(HttpNotFound());
            }

            return(View <Views.PropertyValueSelector>().WithModel(new Models.ValueSelectorModel
            {
                Selector = sel.Value, OnChangeFunction = onChangeFunction
            }));
        }
Example #5
0
 /// <summary>
 /// Gets the maximum between the two specified event kinds.
 /// </summary>
 /// <param name="eventKind1">The first event kind to consider.</param>
 /// <param name="eventKind2">The second event kind to consider.</param>
 /// <returns>True if the first event kind is greater than the second one.</returns>
 public static EventKinds Max(this EventKinds eventKind1, EventKinds eventKind2)
 {
     return(eventKind2 == EventKinds.Any ? eventKind1 : (eventKind1 > eventKind2 ? eventKind1 : eventKind2));
 }
Example #6
0
 /// <summary>
 /// Indicates whether the first event kind is greater than the second one.
 /// </summary>
 /// <param name="eventKind1">The first event kind to consider.</param>
 /// <param name="eventKind2">The second event kind to consider.</param>
 /// <returns>True if the first event kind is greater than the second one.</returns>
 public static bool IsGreaterThan(this EventKinds eventKind1, EventKinds eventKind2)
 {
     return(eventKind1 > eventKind2);
 }