public ActionResult Index() { string username = Membership.GetUser().UserName; List <Guid> apps = UserHelper.GetAppsIdsForUser(username); LogsSearchSettings logSearch = new LogsSearchSettings() { Applications = apps, PageNumber = 1, PageSize = 10 }; IPagedList <LogEntity> lastestLog = RepositoryContext.Current.Logs.SeachLog(logSearch); DashboardModel dm = new DashboardModel(); dm.ErrorCount = RepositoryContext.Current.Logs.CountByLevel(StandardLogLevels.ERROR); dm.InfoCount = RepositoryContext.Current.Logs.CountByLevel(StandardLogLevels.ERROR); dm.LogCount = RepositoryContext.Current.Logs.CountByLevel(StandardLogLevels.ALL_LEVELS); dm.WarnCount = RepositoryContext.Current.Logs.CountByLevel(StandardLogLevels.WARNING); dm.LastTen = ConversionHelper.ConvertLogEntityToMessage(lastestLog.ToList()); dm.QueueLoad = LogQueue.Current.QueueLoad; dm.AppLastTen = new List <MessagesListModel>(); IPagedList <LogEntity> logOfCurrentApp; foreach (ApplicationEntity app in UserHelper.GetAppsForUser(username)) { logSearch = new LogsSearchSettings() { PageNumber = 1, PageSize = 10 }; logSearch.Applications.Add(app.IdApplication); logOfCurrentApp = RepositoryContext.Current.Logs.SeachLog(logSearch); MessagesListModel list = new MessagesListModel(); list.ApplicationName = app.ApplicationName; list.IdApplication = app.IdApplication; list.Messages = ConversionHelper.ConvertLogEntityToMessage(logOfCurrentApp.ToList()); dm.AppLastTen.Add(list); } return(View(dm)); }
public ActionResult Index() { string username = Membership.GetUser().UserName; List<Guid> apps = UserHelper.GetAppsIdsForUser(username); LogsSearchSettings logSearch = new LogsSearchSettings() { Applications = apps, PageNumber = 1, PageSize = 10 }; IPagedList<LogEntity> lastestLog = RepositoryContext.Current.Logs.SeachLog(logSearch); DashboardModel dm = new DashboardModel(); dm.ErrorCount = RepositoryContext.Current.Logs.CountByLevel(StandardLogLevels.ERROR ); dm.InfoCount = RepositoryContext.Current.Logs.CountByLevel(StandardLogLevels.ERROR); dm.LogCount = RepositoryContext.Current.Logs.CountByLevel(StandardLogLevels.ALL_LEVELS); dm.WarnCount = RepositoryContext.Current.Logs.CountByLevel(StandardLogLevels.WARNING); dm.LastTen = ConversionHelper.ConvertLogEntityToMessage(lastestLog.ToList()); dm.QueueLoad = LogQueue.Current.QueueLoad; dm.AppLastTen = new List<MessagesListModel>(); IPagedList<LogEntity> logOfCurrentApp; foreach (ApplicationEntity app in UserHelper.GetAppsForUser(username)) { logSearch = new LogsSearchSettings() { PageNumber = 1, PageSize = 10 }; logSearch.Applications.Add(app.IdApplication); logOfCurrentApp = RepositoryContext.Current.Logs.SeachLog(logSearch); MessagesListModel list = new MessagesListModel(); list.ApplicationName = app.ApplicationName; list.IdApplication = app.IdApplication; list.Messages= ConversionHelper.ConvertLogEntityToMessage(logOfCurrentApp.ToList()); dm.AppLastTen.Add(list); } return View(dm); }