Ejemplo n.º 1
0
        public void StepsRelatedDataViewFilterSettingsSerializationCanRoundTrip()
        {
            var startPeriod = new TimePeriod(new DateTime(2019, 2, 1), new DateTime(2019, 3, 1));
            var endPeriod   = new TimePeriod(new DateTime(2019, 4, 1), new DateTime(2019, 5, 1));

            var settingsSource = new StepDataViewFilter.FilterSettings();

            settingsSource.DataViewGuid = TestGuids.Steps.ProgramSacramentsGuid;

            var settingsString = settingsSource.ToSelectionString();

            var settingsTarget = new StepDataViewFilter.FilterSettings(settingsString);

            Assert.That.AreEqual(TestGuids.Steps.ProgramSacramentsGuid, settingsTarget.DataViewGuid);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Create a Person Query using the StepDataViewFilter with the specified settings.
        /// </summary>
        /// <param name="settings"></param>
        /// <returns></returns>
        private IQueryable <IEntity> GetPersonQueryWithStepDataViewFilter(StepDataViewFilter.FilterSettings settings)
        {
            var settingsFilter = new StepDataViewFilter();

            var dataContext = new RockContext();

            var personService = new PersonService(dataContext);

            var parameterExpression = personService.ParameterExpression;

            var predicate = settingsFilter.GetExpression(typeof(Rock.Model.Person), personService, parameterExpression, settings.ToSelectionString());

            var personQuery = GetFilteredEntityQuery <Person>(dataContext, predicate, parameterExpression);

            return(personQuery);
        }