public EnumEntityFilter_()
        {
            var entity = new Entity(typeof(TestEntity));
            _property = entity["Option"];

            _filter = new EnumEntityFilter(_property, "0");
        }
        public BoolEntityFilter_()
        {
            var entity = new Entity(typeof(TestEntity));
            _property = entity["IsSpecial"];

            _filter = new BoolEntityFilter(_property, "1");
        }
        public ChangeEntityFilter_()
        {
            var entity = new Entity(typeof(TestEntity));
            _property = entity["Name"];

            _filter = new ChangeEntityFilter(_property, "entity_name");
        }
        public static IDictionary<string, object> GetValidationAttributes(
            Property property,
            ControllerContext context)
        {
            // create own metadata based on Property object
            var metadata = new ModelMetadata(
                ModelMetadataProviders.Current,
                property.Entity.Type,
                null,
                property.TypeInfo.Type,
                property.Name);
            metadata.DisplayName = property.Display;

            var clientRules = ModelValidatorProviders.Providers
                .GetValidators(metadata, context)
                .SelectMany(v => v.GetClientValidationRules());

            var provider = new PropertyModelValidatorProvider();
            var modelValidators = provider
                .GetValidatorsForAttributes(metadata, context, property.Validators);
            clientRules = clientRules
                .Union(modelValidators.SelectMany(x => x.GetClientValidationRules()))
                .DistinctBy(x => x.ValidationType);

            var validationAttributes = new Dictionary<string, object>();
            UnobtrusiveValidationAttributesGenerator
                .GetValidationAttributes(clientRules, validationAttributes);

            return validationAttributes;
        }
        public ForeignEntityFilter_()
        {
            var entity = new Entity(typeof(TestEntity));
            _property = entity["Child"];

            _filter = new ForeignEntityFilter(_property, "1");
        }
        public ForeignEntityFilter_()
        {
            Entity<TestEntity>.Register().ReadAttributes();
            _admin.Initialise();
            var entity = _admin.GetEntity<TestEntity>();
            _property = entity["Child"];

            _filter = new ForeignEntityFilter(_property, "1");
        }
        public RecordsSource_BoolEntityFilters()
        {
            DB.Products.Insert(ProductName: "Product", Discontinued: true);
            DB.Products.Insert(ProductName: "Product2", Discontinued: false);

            _source = new RecordsSource(_admin, new Notificator());
            Entity<Product>.Register().ReadAttributes();
            _admin.Initialise(ConnectionStringName);
            _entity = _admin.GetEntity("Product");
            _property = _entity["Discontinued"];
        }
 public static MvcHtmlString Password(
     this HtmlHelper htmlHelper,
     string name,
     object value,
     Property property)
 {
     return Password(
         htmlHelper,
         name, value,
         property,
         htmlAttributes: null);
 }
        public RecordsSource_ForeignEntityFilters()
        {
            _supplierId = DB.Suppliers.Insert(CompanyName: "Supplier").SupplierID;
            DB.Products.Insert(ProductName: "Product", SupplierID: _supplierId);
            DB.Products.Insert(ProductName: "Product2");

            _source = new RecordsSource(_admin, new Notificator());
            Entity<Product>.Register().ReadAttributes();
            _admin.Initialise(ConnectionStringName);
            _entity = _admin.GetEntity("Product");
            _property = _entity["SupplierID"];
        }
        public RecordsSource_BoolEntityFilters()
        {
            DB.Products.Insert(ProductName: "Product", Discontinued: true);
            DB.Products.Insert(ProductName: "Product2", Discontinued: false);

            _source = new RecordsSource(new Notificator());
            Admin.AddEntity<Product>();
            Admin.SetForeignKeysReferences();
            Admin.ConnectionStringName = ConnectionStringName;
            _entity = Admin.EntitiesTypes
                .FirstOrDefault(x => x.Name == "Product");
            _property = _entity["Discontinued"];
        }
 public static MvcHtmlString DropDownList(
     this HtmlHelper htmlHelper,
     string name,
     IEnumerable<SelectListItem> selectList,
     Property property)
 {
     return DropDownList(
         htmlHelper,
         name,
         selectList,
         property,
         htmlAttributes: null);
 }
 public static MvcHtmlString TextArea(
     this HtmlHelper htmlHelper,
     string name,
     string value,
     Property property)
 {
     return TextArea(
         htmlHelper,
         name,
         value,
         property,
         htmlAttributes: (IDictionary<string, object>)null);
 }
 public static MvcHtmlString CheckBox(
     this HtmlHelper htmlHelper,
     string name,
     bool isChecked,
     Property property)
 {
     return CheckBox(
         htmlHelper,
         name,
         isChecked,
         property,
         htmlAttributes: null);
 }
 public static MvcHtmlString TextArea(
     this HtmlHelper htmlHelper,
     string name,
     string value,
     Property property)
 {
     return TextArea(
         htmlHelper,
         name,
         value,
         property,
         htmlAttributes: null);
 }
        public static MvcHtmlString CheckBox(
            this HtmlHelper htmlHelper,
            string name,
            bool isChecked,
            Property property,
            IDictionary<string, object> htmlAttributes)
        {
            var validationAttributes = PropertyUnobtrusiveValidationAttributesGenerator
                .GetValidationAttributes(property, htmlHelper.ViewContext);

            htmlAttributes = htmlAttributes.Merge(validationAttributes);

            return htmlHelper.CheckBox(name, isChecked, htmlAttributes);
        }
 public static MvcHtmlString CheckBox(
     this HtmlHelper htmlHelper,
     string name,
     bool isChecked,
     Property property,
     object htmlAttributes)
 {
     return CheckBox(
         htmlHelper,
         name,
         isChecked,
         property,
         HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes));
 }
 public static MvcHtmlString TextArea(
     this HtmlHelper htmlHelper,
     string name,
     string value,
     Property property,
     object htmlAttributes)
 {
     return TextArea(
         htmlHelper,
         name,
         value,
         property,
         HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes));
 }
        public RecordsSource_ForeignEntityFilters()
        {
            _supplierId = DB.Suppliers.Insert(CompanyName: "Supplier").SupplierID;
            DB.Products.Insert(ProductName: "Product", SupplierID: _supplierId);
            DB.Products.Insert(ProductName: "Product2");

            _source = new RecordsSource(new Notificator());
            Admin.AddEntity<Product>();
            Admin.SetForeignKeysReferences();
            Admin.ConnectionStringName = ConnectionStringName;
            _entity = Admin.EntitiesTypes
                .FirstOrDefault(x => x.Name == "Product");
            _property = _entity["SupplierID"];
        }
 public static MvcHtmlString DropDownList(
     this HtmlHelper htmlHelper,
     string name,
     IEnumerable<SelectListItem> selectList,
     Property property,
     object htmlAttributes)
 {
     return DropDownList(
         htmlHelper,
         name,
         selectList,
         property,
         HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes));
 }
        public static MvcHtmlString DropDownList(
            this HtmlHelper htmlHelper,
            string name,
            IEnumerable<SelectListItem> selectList,
            Property property,
            IDictionary<string, object> htmlAttributes)
        {
            var validationAttributes = PropertyUnobtrusiveValidationAttributesGenerator
                .GetValidationAttributes(property, htmlHelper.ViewContext);

            htmlAttributes = htmlAttributes.Merge(validationAttributes);

            return htmlHelper.DropDownList(name, selectList, htmlAttributes);
        }
        public static MvcHtmlString Password(
            this HtmlHelper htmlHelper,
            string name,
            object value,
            Property property,
            IDictionary<string, object> htmlAttributes)
        {
            var validationAttributes = PropertyUnobtrusiveValidationAttributesGenerator
                .GetValidationAttributes(property, htmlHelper.ViewContext);

            htmlAttributes = htmlAttributes.Merge(validationAttributes);

            return htmlHelper.Password(name, value, htmlAttributes);
        }
 public static MvcHtmlString Password(
     this HtmlHelper htmlHelper,
     string name,
     object value,
     Property property,
     object htmlAttributes)
 {
     return Password(
         htmlHelper,
         name,
         value,
         property,
         HtmlHelper.AnonymousObjectToHtmlAttributes(htmlAttributes));
 }
        public static MvcHtmlString DropDownList(
            this HtmlHelper htmlHelper,
            string name,
            IEnumerable<SelectListItem> selectList,
            Property property,
            IDictionary<string, object> htmlAttributes)
        {
            // create own metadata based on PropertyViewModel
            var metadata = new ModelMetadata(
                ModelMetadataProviders.Current,
                property.Entity.Type,
                null,
                property.TypeInfo.Type,
                property.Name);
            var validationAttributes =
                htmlHelper.GetUnobtrusiveValidationAttributes(name, metadata);

            htmlAttributes = htmlAttributes.Merge(validationAttributes);

            return htmlHelper.DropDownList(name, selectList, htmlAttributes);
        }
        public static MvcHtmlString TextArea(
            this HtmlHelper htmlHelper,
            string name,
            string value,
            Property property,
            IDictionary<string, object> htmlAttributes)
        {
            // create own metadata based on PropertyViewModel
            var metadata = new ModelMetadata(
                ModelMetadataProviders.Current,
                property.Entity.Type,
                null,
                property.TypeInfo.Type,
                property.Name);
            var validationAttributes =
                htmlHelper.GetUnobtrusiveValidationAttributes(name, metadata);

            htmlAttributes = htmlAttributes.Merge(validationAttributes);

            return htmlHelper.TextArea(name, value, htmlAttributes);
        }
 public ChangeEntityFilter(Property property, string value = "")
     : base(property, value)
 {
 }
 public ForeignEntityFilter(Property property, string value = "")
     : base(property, value)
 {
 }
Beispiel #27
0
 public PropertyValue(Property property)
 {
     Property = property;
 }