コード例 #1
0
        private static string CreateInput(string value, string classe, string type)
        {
            List <KeyValuePair <string, string> > InputProperties = new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("class", classe),
                new KeyValuePair <string, string>("value", value),
                new KeyValuePair <string, string>("type", type)
            };
            string Propriedades = CreateHTMLProperties(InputProperties);

            return(HTMLElements.Input(Propriedades));
        }
コード例 #2
0
        private static string CreateInputForKey <T>(PropertyInfo prop, T entity) where T : ModeloBase
        {
            string ValorAtributo = ObterValorPropriedade(prop, entity);
            List <KeyValuePair <string, string> > Properties = new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("id", $"{prop.Name}"),
                new KeyValuePair <string, string>("name", $"{prop.Name}"),
                new KeyValuePair <string, string>("value", $"{ValorAtributo}"),
                new KeyValuePair <string, string>("type", $"hidden")
            };
            string Propriedades = CreateHTMLProperties(Properties);

            return(HTMLElements.Input(Propriedades));
        }
コード例 #3
0
        public void GerarElementoComMultiplosAtributosHTML()
        {
            List <KeyValuePair <string, string> > Styles = new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("id", $"{Name}"),
                new KeyValuePair <string, string>("name", $"{Name}"),
                new KeyValuePair <string, string>("value", $"{ValorAtributo}"),
                new KeyValuePair <string, string>("class", $"form-control"),
                new KeyValuePair <string, string>("placeholder", $"{NomeAtributo}"),
                new KeyValuePair <string, string>("type", $"text")
            };
            string For          = CreateHTMLProperty("for", Name);
            string Propriedades = CreateHTMLProperties(Styles);
            string Div          = AninharEmDiv(string.Format(" {0}: {1} ", AninharEmLabel(NomeAtributo, For), HTMLElements.Input(Propriedades)), CreateHTMLProperty("class", "md-form"));

            output.WriteLine(Div);
            Assert.True(Div == MensagemEsperada);
        }
コード例 #4
0
        private static string CreateColorDisplay <T>(PropertyInfo prop, T entity, string divClass) where T : ModeloBase
        {
            string NomeAtributo      = ObterNomePropriedade(prop);
            string ValorAtributo     = ObterValorPropriedade(prop, entity);
            string DescricaoAtributo = ObterDescricaoPropriedade(prop);
            List <KeyValuePair <string, string> > InputProperties = new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("id", $"{prop.Name}"),
                new KeyValuePair <string, string>("name", $"{prop.Name}"),
                new KeyValuePair <string, string>("class", $"form-control"),
                new KeyValuePair <string, string>("value", $"{ValorAtributo}"),
                new KeyValuePair <string, string>("placeholder", $"{NomeAtributo}"),
                new KeyValuePair <string, string>("type", $"color"),
                new KeyValuePair <string, string>("title", $"{DescricaoAtributo}")
            };
            string LabelFor          = CreateHTMLProperty("for", prop.Name);
            string InputPropriedades = CreateHTMLProperties(InputProperties);
            string InputDisplayDiv   = AninharEmDiv(string.Format(" {0}: {1} ", AninharEmLabel(NomeAtributo, LabelFor), HTMLElements.Input(InputPropriedades)));

            return(InputDisplayDiv);
        }
コード例 #5
0
        private static string CreateInputDisplay(string NomePropriedade, string value, string Descricao, string divClass, string inputType)
        {
            List <KeyValuePair <string, string> > InputProperties = new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("id", $"{NomePropriedade}"),
                new KeyValuePair <string, string>("name", $"{NomePropriedade}"),
                new KeyValuePair <string, string>("value", $"{value}"),
                new KeyValuePair <string, string>("class", $"form-control"),
                new KeyValuePair <string, string>("placeholder", $"{Descricao}"),
                new KeyValuePair <string, string>("type", $"{inputType}"),
                new KeyValuePair <string, string>("title", $"{Descricao}")
            };
            string LabelFor          = CreateHTMLProperty("for", NomePropriedade);
            string InputPropriedades = CreateHTMLProperties(InputProperties);
            string InputDisplayDiv   = AninharEmDiv(string.Format(" {0}: {1} ", AninharEmLabel(NomePropriedade, LabelFor), HTMLElements.Input(InputPropriedades)), CreateHTMLProperty("class", divClass));

            return(InputDisplayDiv);
        }