private static string DefineAttr(TableInfo tableInfo, Info info, string propertyName)
        {
            var attrFieldConfig = HelperFieldConfig.GetAttr(tableInfo, propertyName);
            var attr            = string.Format("{0}", attrFieldConfig);

            return(attr);
        }
Ejemplo n.º 2
0
        private static string DefineAttr(Context configContext, TableInfo tableInfo, Info info, string propertyName)
        {
            var mask = string.Empty;

            if (configContext.ApplyMasksDefault)
            {
                mask = DefineMask(info.Type);

                if (info.PropertyName.ToLower().Contains("cpf"))
                {
                    mask = "[textMask]='{ mask: vm.masks.maskCPF }'";
                }

                if (info.PropertyName.ToLower().Contains("cnpj"))
                {
                    mask = "[textMask]='{ mask: vm.masks.maskCNPJ }'";
                }

                if (info.PropertyName.ToLower().Contains("telefone") ||
                    info.PropertyName.ToLower().Contains("phone"))
                {
                    mask = "[textMask]='{ mask: vm.masks.maskTelefone }'";
                }

                if (info.PropertyName.ToLower().Contains("celular") ||
                    info.PropertyName.ToLower().Contains("cellphone"))
                {
                    mask = "[textMask]='{ mask: vm.masks.maskCelular }'";
                }
            }

            var maxLength = "";

            if (info.Type == "string")
            {
                maxLength = " maxlength=" + info.Length;
            }

            var attrFieldConfig = HelperFieldConfig.GetAttr(tableInfo, propertyName);

            if (attrFieldConfig.Contains("maskm"))
            {
                mask = "";
            }
            if (attrFieldConfig.Contains("textMask"))
            {
                mask = "";
            }
            if (attrFieldConfig.Contains("maski"))
            {
                mask = "";
            }


            var attr = string.Format("{0} {1} {2}", attrFieldConfig, mask, maxLength);

            return(attr);
        }