public ActionResult GetEventsChart(ManagementPortalFilter filter, bool?mb, bool?kb, int?PluginID)
        {
            MergeSession(filter, ManagementPortalFilter.SessionKey);

            using (var unit = GetUnitOfWork())
            {
                var events = unit.Scope
                             .Repository <Event>()
                             .Include(@event => @event.EventType)
                             .Include(@event => @event.Plugin)
                             .GetAll(@event
                                     => (!PluginID.HasValue || @event.PluginID == PluginID.Value) &&
                                     filter.FromDate != null
              ? @event.CreationTime >= filter.FromDate
              : @event.CreationTime >= DateTime.MinValue &&
                                     filter.UntilDate != null
              ? @event.CreationTime <= filter.UntilDate
              : @event.CreationTime <= DateTime.MaxValue)
                             .ToArray();

                var series = events
                             .GroupBy(@event => @event.EventType.Type)
                             .Select(eventsPerEventType => new Serie(eventsPerEventType
                                                                     .GroupBy(@event => @event.Plugin.PluginName)
                                                                     .Select(eventsPerPluginName => new PieChartPoint(eventsPerPluginName.Key, eventsPerPluginName.Count(), EventTypeColors[eventsPerEventType.Key] ?? "Black"))
                                                                     , eventsPerEventType.Key));

                return(View("Anychart/Default2DStackedBarChart", new AnychartComponentModel(series)));
            }
        }
Beispiel #2
0
 public ActionResult GetList(int?PluginID, int?TypeID, ManagementPortalFilter filter)
 {
     return(List(unit => from e in unit.Service <Event>().GetAll()
                 let user = e.User
                            select new
     {
         e.EventID,
         e.TypeID,
         e.ProcessName,
         Message = e.Message,
         CreationTime = e.CreationTime,
         User = user == null ? string.Empty : user.Firstname + " " + user.Lastname,
         e.ExceptionMessage,
         e.ExceptionLocation,
         e.StackTrace
     }));
 }