コード例 #1
0
        public virtual void Initialize(string placeHolder = null, string width = null, object attrs = null, object inputAttr = null, string classes = "")
        {
            ColumnModel.Attributes = RazorUtils.ToAttributeString(attrs);
            ColumnModel.Width      = width == null ? "" : $"style='width:{width}'";

            InputModel.PlaceHolder     = placeHolder ?? TextProvider.Column(ColumnId);
            InputModel.Classes         = classes;
            InputModel.AttributeObject = inputAttr;
        }
コード例 #2
0
        public virtual void UseProperty(string memberName, string columnId, string propertyName, bool useGroup = true)
        {
            ColumnId = columnId;
            string groupName = useGroup ? "FG_" + memberName.Replace(".", "_") : null;

            InputModel = new NgInput
            {
                MemberName         = memberName,
                NgModelName        = Helper.GetModelName(),
                NgFormName         = Helper.GetFormName(),
                EntityPropertyName = propertyName,
                GroupName          = groupName
            };

            GroupModel = new NgControlGroup
            {
                Label        = TextProvider.Column(ColumnId),
                Name         = groupName,
                PropertyName = InputModel.MemberName.GetAfterLast(".").UCFirst()
            };

            Helper.AddText(StringType.Column, columnId);
        }
コード例 #3
0
        public override void UseExpression <T, TValue>(Expression <Func <T, TValue> > exp)
        {
            ColumnId         = RazorUtils.GetColumnId(exp);
            MemberExpression = RazorUtils.GetMemberExpression(exp);

            string groupName = "FG_" + RazorUtils.GetMemberName(exp).Replace(".", "_");

            InputModel = new NgInput
            {
                MemberName  = RazorUtils.GetMemberName(exp),
                NgModelName = Helper.GetModelName(),
                NgFormName  = Helper.GetFormName(),
                GroupName   = groupName
            };

            GroupModel = new NgControlGroup
            {
                Label        = TextProvider.Column(ColumnId),
                Name         = groupName,
                PropertyName = RazorUtils.GetMemberNameDefault(exp).GetAfterLast(".")
            };

            Helper.AddText(StringType.Column, ColumnId);
        }
コード例 #4
0
        public override IEnumerable <ValidatorModel> GetMessageModels()
        {
            var m = MakeModel("unique", TextProvider.Message(MessageIds.field_exists, TextProvider.Column(ColumnId)));

            return(new[] { m });
        }