Example #1
0
        public static string MakeInputHtml(Context configContext, TableInfo tableInfo, Info info, bool isStringLengthBig, string propertyName)
        {
            var _isPassword             = HelperFieldConfig.IsPassword(tableInfo, propertyName);
            var _isPasswordConfirmation = HelperFieldConfig.IsPasswordConfirmation(tableInfo, propertyName);
            var _isEmail    = HelperFieldConfig.IsEmail(tableInfo, propertyName);
            var _isRequired = info.IsNullable == 0;


            var required = _isRequired ? "required" : string.Empty;
            var attr     = DefineAttr(configContext, tableInfo, info, propertyName);

            if (isStringLengthBig)
            {
                return(MakeTextArea(required));
            }

            if (_isPassword)
            {
                return(MakeInputType(required, "password", info.Type));
            }

            if (_isPasswordConfirmation)
            {
                return(MakeInputPasswordConfirmation(required, "password"));
            }

            if (_isEmail)
            {
                return(MakeInputType(required, "email", "email"));
            }


            if (info.PropertyName.ToLower().Contains("email"))
            {
                return(MakeInputType(required, "email", "email"));
            }

            if (info.PropertyName.ToLower().Contains("cep") ||
                info.PropertyName.ToLower().Contains("zipcode"))
            {
                return(MakeCEP(_isRequired, attr));
            }

            if (info.PropertyName.ToLower().Contains("cpfcnpj") ||
                info.PropertyName.ToLower().Contains("cpf_cnpj") ||
                info.PropertyName.ToLower().Contains("cpf-cnpj"))
            {
                return(MakeCPFCNPJTab(required, attr));
            }

            return(MakeInputType(required, "text", attr));
        }
        public static string MakeInputHtml(TableInfo tableInfo, Info info, bool isStringLengthBig, string propertyName)
        {
            var ng_required = info.IsNullable == 0 ? "ng-required='true'" : string.Empty;

            var _isPassword             = HelperFieldConfig.IsPassword(tableInfo, propertyName);
            var _isPasswordConfirmation = HelperFieldConfig.IsPasswordConfirmation(tableInfo, propertyName);
            var _isEmail = HelperFieldConfig.IsEmail(tableInfo, propertyName);
            var _length  = info.Length;



            if (isStringLengthBig)
            {
                return(MakeTextArea(ng_required));
            }

            if (_isPassword)
            {
                return(MakeInputType(ng_required, "password"));
            }

            if (_isPasswordConfirmation)
            {
                return(MakeInputPasswordConfirmation(ng_required, "password"));
            }

            if (_isEmail)
            {
                return(MakeInputType(ng_required, "email"));
            }

            var attr = DefineAttr(tableInfo, info, propertyName);

            if (Convert.ToInt32(_length) > 0 && info.Type == "string")
            {
                if (!attr.Contains("maxlength"))
                {
                    attr += " maxlength='" + _length + "'";
                }
            }

            return(MakeInputType(ng_required, "text", attr));
        }