Exemplo n.º 1
0
        public static HtmlString ExibirEntidadeColorCodedComNomePersonalizado(this IColorCoded entidade, string texto, string elemento = "p", string imgclass = "img-thumbnail rounded float-left")
        {
            List <KeyValuePair <string, string> > ConteudoStyles = new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("border-bottom", $"3px solid {entidade.Color}")
            };

            string ConteudoStyle = CreateHTMLStyle(ConteudoStyles);
            string Conteudo      = AninharEmElemento(elemento, texto, CreateHTMLProperty("class", "card-body instituicao-title") + ConteudoStyle);
            string HrefConteudo  = AninharEmElemento("a", Conteudo);
            string Img           = string.Empty;

            if (entidade.Logo != null)
            {
                List <KeyValuePair <string, string> > ImageProperties = new List <KeyValuePair <string, string> >()
                {
                    new KeyValuePair <string, string>("class", $"{imgclass}"),
                    new KeyValuePair <string, string>("src", $"data:image;base64,{Convert.ToBase64String(entidade.Logo)}")
                };
                Img = HTMLElements.Img(CreateHTMLProperties(ImageProperties));
            }

            string     DivClasse  = CreateHTMLProperty("class", CSSCustomClassNames.InstituicaoDiv());
            string     Properties = DivClasse;
            string     Elemento   = AninharEmDiv(Img + HrefConteudo, Properties);
            HtmlString html       = new HtmlString(Elemento);

            return(html);
        }
Exemplo n.º 2
0
        public override float Calcular()
        {
            float Media = Valores.Average();

            Passos.WriteLineAsyncCounter($"O {Titulo("Desvio padrão")} é uma medida que expressa o grau de dispersão de um conjunto de dados:");
            Passos.WriteLineAsyncCounter($" {HTMLElements.Img(Properties: "src='https://dados-agrupados-api.herokuapp.com/Imagens/desvio-padrao-1.png'")}");
            Passos.WriteLineAsyncCounter($"Obter a média aritimética dos dados (Ma) = {Media}");
            Passos.WriteLineAsyncCounter($"Obter o número de termos (N) = {Valores.Count}");
            Passos.WriteLineAsyncCounter($"(Somátorio de Xi = 1 até a posição N ({Valores.Count}) menos a média ({Media})) elevado ao quadrado{HTMLElements.Hr()}");
            int xi = 1;

            foreach (var Elemento in Valores)
            {
                //Passos.WriteLineAsync($"Termo (x{xi}) = {Elemento}");
                var operacao = (Elemento - Media) * (Elemento - Media);
                Resultado += operacao;
                Passos.WriteLineAsync($"$$ {(xi > 1 ? '+' : ' ')}(" + Elemento + " - " + Media.ToString("F2") + $")^ 2 = {operacao} ..." + Resultado + $"  $$  {HTMLElements.Hr()}");
                xi++;
            }

            Passos.WriteLineAsyncCounter($"Obter a raíz quadrada da divisão do somatório ({Resultado}) pelo numero de termos ({Valores.Count}) {HTMLElements.Hr()}");
            var operacaoFinal = (float)Math.Sqrt(Resultado / Valores.Count());

            Passos.WriteLineAsync($"\n $$ Resultado = \\sqrt {{ \\dfrac{{ {{{Resultado}}} }} {{{Valores.Count()}}}  }} = {{{operacaoFinal}}}$$");
            Resultado = operacaoFinal;
            return(Resultado);
        }