Exemplo n.º 1
0
        public IList <IEntityFilter> PrepareFilters(Entity entity, HttpRequestBase request)
        {
            var filters = new List <IEntityFilter>();

            foreach (var property in entity.Properties.Where(x => x.DataType == DataType.Bool))
            {
                var value = request[property.Name];

                var filter = new BoolEntityFilter();
                filter.Initialize(property, value);
                filters.Add(filter);
            }

            foreach (var property in entity.Properties.Where(x => x.DataType == DataType.Enum))
            {
                var value = request[property.Name];

                var filter = new EnumEntityFilter();
                filter.Initialize(property, value);
                filters.Add(filter);
            }

            foreach (var property in entity.Properties.Where(x => x.DataType == DataType.DateTime))
            {
                var value = request[property.Name];

                var filter = new DateTimeEntityFilter();
                filter.Initialize(property, value);
                filters.Add(filter);
            }

            return(filters);
        }
Exemplo n.º 2
0
        public BoolEntityFilter_()
        {
            var entity = new Entity(typeof(TestEntity));
            _property = entity["IsSpecial"];

            _filter = new BoolEntityFilter(_property, "1");
        }
Exemplo n.º 3
0
        public BoolEntityFilter_()
        {
            var entity = new Entity(typeof(TestEntity));

            _property = entity["IsSpecial"];

            _filter = new BoolEntityFilter(_property, "1");
        }
Exemplo n.º 4
0
        public void selected_value_should_match()
        {
            _filter = new BoolEntityFilter(_property, "1");
            var options = _filter.Options.ToList();
            Assert.True(options[1].Selected);

            _filter = new BoolEntityFilter(_property, "0");
            options = _filter.Options.ToList();
            Assert.True(options[2].Selected);
        }
Exemplo n.º 5
0
        public void selected_value_should_match()
        {
            _filter = new BoolEntityFilter(_property, "1");
            var options = _filter.Options.ToList();

            Assert.True(options[1].Selected);

            _filter = new BoolEntityFilter(_property, "0");
            options = _filter.Options.ToList();
            Assert.True(options[2].Selected);
        }