public async Task <IReadOnlyCollection <ActivityLog> > SearchActivityLogs(ActivitySearchModel activityFilter)
        {
            activityFilter.BeginDate = activityFilter.BeginDate == null?DateTime.Parse("01/01/1900") : activityFilter.BeginDate;

            activityFilter.EndDate = activityFilter.EndDate == null ? DateTime.Now : activityFilter.EndDate;
            var response = elasticClient.Search <ActivityLog>(s => s
                                                              .From(activityFilter.Page)
                                                              .Size(activityFilter.RowCount)
                                                              .Sort(ss => ss.Descending(p => p.DateCreated))
                                                              .Query(q => q
                                                                     .Bool(b => b
                                                                           .Must(
                                                                               q => q.Term(t => t.UserId, activityFilter.UserId),
                                                                               q => q.Term(t => t.ControllerName.ToFilter(), activityFilter.ControllerName.ToFilter()),
                                                                               q => q.Term(t => t.ActionName.ToFilter(), activityFilter.ActionName.ToFilter()),
                                                                               q => q.Term(t => t.HttpType.ToFilter(), activityFilter.HttpType.ToFilter()),
                                                                               q => q.Term(t => t.IPAddress.ToFilter(), activityFilter.IPAddress.ToFilter()),
                                                                               q => q.Term(t => t.StatusCode, activityFilter.StatusCode),
                                                                               q => q.DateRange(r => r
                                                                                                .Field(f => f.DateCreated)
                                                                                                .GreaterThanOrEquals(DateMath.Anchored(((DateTime)activityFilter.BeginDate).AddDays(-1)))
                                                                                                .LessThanOrEquals(DateMath.Anchored(((DateTime)activityFilter.EndDate).AddDays(1)))
                                                                                                ))
                                                                           )
                                                                     )
                                                              .Index(IndexType.activity_log.ToString())
                                                              );

            return(response.Documents);
        }
Пример #2
0
        public void ActivitySearchModel_Search_ExistingDataFiltered_ItemsFound()
        {
            var model = new ActivitySearchModel
            {
                ModuleName = "cloudcore", 
                ModuleNameFilter = "%{0}%", 
                ProcessName = "test", 
                ProcessNameFilter = "%{0}%",
                SubProcessName = "test",
                SubProcessNameFilter = "%{0}%"
            };

            model.Search(Repository);
            Assert.IsTrue(model.SearchResults.Any());
        }
Пример #3
0
 public void ActivitySearchModel_Search_NonExistentName_ResultEmtpy()
 {
     var model = new ActivitySearchModel { ActivityName = Guid.NewGuid().ToString(), ActivityNameFilter = "%{0}%" };
     model.Search(Repository);
     Assert.IsFalse(model.SearchResults.Any());
 }
Пример #4
0
 public void ActivitySearchModel_Search_NoInput_ActivitiesFound()
 {
     var model = new ActivitySearchModel();
     model.Search(Repository);
     Assert.IsTrue(model.SearchResults.Any());
 }
Пример #5
0
        public MainViewModel(INovaromaEngine engine, IExceptionHandler exceptionHandler, IDialogService dialogService, ILogger logger)
            : base(dialogService)
        {
            _engine           = engine;
            _exceptionHandler = exceptionHandler;
            _logger           = logger;
            _pluginServices   = engine.Services.OfType <IPluginService>();

            var genres = engine.MediaGenres;

            _movieSearchModel    = new MovieSearchModel(genres);
            _tvShowSearchModel   = new TvShowSearchModel(genres);
            _activitySearchModel = new ActivitySearchModel();

            _installUpdateCommand          = new RelayCommand(InstallUpdate);
            _aboutCommand                  = new RelayCommand(About);
            _newCommand                    = new RelayCommand(NewMedia);
            _watchDirectoryCommand         = new RelayCommand(WatchDirectory);
            _discoverCommand               = new RelayCommand(Discover);
            _manualDownloadCommand         = new RelayCommand(DoManualDownload);
            _executePluginServiceCommand   = new RelayCommand(DoExecutePluginService);
            _settingsCommand               = new RelayCommand(EditSettings);
            _executeDownloadsCommand       = new RelayCommand(ExecuteDownloads);
            _executeTvShowUpdatesCommand   = new RelayCommand(ExecuteTvShowUpdates);
            _backupDatabaseCommand         = new RelayCommand(DoBackupDatabase);
            _manageRuntimeServicesCommand  = new RelayCommand(ManageRuntimeServices);
            _clearLogsAndActivitiesCommand = new RelayCommand(DoClearLogsAndActivities);

            _saveSearchModelCommand        = new RelayCommand(DoSaveSearchModel);
            _movieSearchCommand            = new RelayCommand(DoGetMovies);
            _tvShowSearchCommand           = new RelayCommand(DoGetTvShows);
            _clearMovieSearchModelCommand  = new RelayCommand(DoClearMovieSearchModel);
            _clearTvShowSearchModelCommand = new RelayCommand(DoClearTvShowSearchModel);

            _moviePlayCommand             = new RelayCommand(PlayMovie, CanPlayMovie);
            _movieMarkWatchedCommand      = new RelayCommand(MarkMovieWatched, CanMarkMovieWatched);
            _movieUpdateInfoCommand       = new RelayCommand(DoUpdateMovieInfo);
            _movieDeleteCommand           = new RelayCommand(DoDeleteMovie);
            _movieSaveCommand             = new RelayCommand(DoSaveMovie);
            _movieDownloadCommand         = new RelayCommand(DoDownloadMovie);
            _movieSubtitleDownloadCommand = new RelayCommand(DoDownloadMovieSubtitle);
            _movieDiscoverFilesCommand    = new RelayCommand(DiscoverMovieFiles);
            _movieGoToDirectoryCommand    = new RelayCommand(GoToMovieDirectory);

            _tvShowPlayCommand = new RelayCommand(PlayTvShow, CanPlayTvShow);
            _tvShowMarkEpisodeWatchedCommand = new RelayCommand(MarkEpisodeWatched, CanMarkEpisodeWatched);
            _tvShowEpisodePlayCommand        = new RelayCommand(PlayTvShowEpisode, CanPlayTvShowEpisode);
            _tvShowEpisodeDeleteCommand      = new RelayCommand(DeleteTvShowEpisode, CanDeleteTvShowEpisode);
            _tvShowUpdateInfoCommand         = new RelayCommand(DoUpdateTvShowInfo);
            _tvShowDeleteCommand             = new RelayCommand(DoDeleteTvShow);
            _tvShowSaveCommand                    = new RelayCommand(DoSaveTvShow);
            _tvShowEpisodeDownloadCommand         = new RelayCommand(DoDownloadTvShowEpisode);
            _tvShowEpisodeSubtitleDownloadCommand = new RelayCommand(DoDownloadTvShowEpisodeSubtitle);
            _tvShowDiscoverFilesCommand           = new RelayCommand(DiscoverTvShowFiles);
            _tvShowGoToDirectoryCommand           = new RelayCommand(GoToTvShowDirectory);
            _activityPlayCommand                  = new RelayCommand(PlayActivity);

            _sendASmileCommand = new RelayCommand(SendASmile);
            _sendAFrownCommand = new RelayCommand(SendAFrown);

            _escapeKeyCommand = new RelayCommand(PressEscapeKey);

            _allTvDownloadCheckCommand     = new RelayCommand(o => Helper.AllTvDownloadCheck(o, _engine));
            _allSeasonDownloadCheckCommand = new RelayCommand(o => Helper.AllSeasonDownloadCheck(o, _engine));
            _episodeDownloadCheckCommand   = new RelayCommand(o => Helper.EpisodeDownloadCheck(o, _engine));
            _movieDownloadCheckCommand     = new RelayCommand(o => Helper.MovieDownloadCheck(o, _engine));

            _videoQualityEnumInfo = Constants.VideoQualityEnumInfo;

            _engine.MoviesChanged     += EngineOnMoviesChanged;
            _engine.TvShowsChanged    += EngineOnTvShowsChanged;
            _engine.ActivitiesChanged += EngineOnActivitiesChanged;
            _engine.LanguageChanged   += EngineOnLanguageChanged;

            _updateCheckTimer = new Timer(o => DoCheckForUpdate(), null, TimeSpan.FromSeconds(5), TimeSpan.FromHours(1));
        }
Пример #6
0
 public ActionResult Search(ActivitySearchModel model)
 {
     model.Search();
     return View(model);
 }
Пример #7
0
 public ActionResult Search()
 {
     var model = new ActivitySearchModel();
     return View(model);
 }
        public async Task <IActionResult> SearchActivityLogs(ActivitySearchModel activityFilter)
        {
            var result = await elasticSearchService.SearchActivityLogs(activityFilter);

            return(Ok(result));
        }