public static MvcHtmlString ObterFotoFuncionario(this HtmlHelper htmlHelper, string urlWebSite) { var html = new StringBuilder(); int matricula = ClaimsHelper.ObterClaim(Claims.Matricula).Value.ToInt(); string primeiroNome = ClaimsHelper.ObterClaim(Claims.PrimeiroNome).Value; byte[] foto = null; var appFuncionario = SimpleInjectorInitializerFactory.GetInstance <IFotoFuncionarioApp>(); try { foto = appFuncionario.ObterFotoFuncionario(matricula); } catch (Exception ex) { ErrorSignal.FromCurrentContext().Raise(ex, HttpContext.Current); } html.AppendLine("<span href=\"#\">" + primeiroNome + "</span>"); if (foto != null) { html.AppendLine("<img id='imgFotoServidor' src='data:image/png; base64," + Convert.ToBase64String(foto) + "' class='rounded-circle user-image' alt='Foto' />"); } else { html.AppendLine("<img id='imgFotoServidor' src='" + urlWebSite + "Content/Images/PersonPlaceholder.png' class='rounded-circle user-image' alt='Foto' />"); } html.AppendLine("<input type='hidden' value='" + matricula + "' id='hdnIdentificaUsuario' />"); return(MvcHtmlString.Create(html.ToString())); }
/// <summary> /// Método para validar a connection do ambiente esta correta. /// </summary> /// <param name="httpContext"></param> /// <returns></returns> protected static bool ValidaAmbiente(HttpContextBase httpContext) { var ambiente = SimpleInjectorInitializerFactory.GetInstance <IValidaConfiguracao>().ValidarConection(httpContext.Request.Url.Host); if (httpContext != null && !ambiente.Resultado) { Exception exception = new InvalidOperationException($"Erro de Configuração de Ambiente - {ambiente.RetornoMensagem}"); ErrorSignal.FromCurrentContext().Raise(exception, HttpContext.Current); return(false); } return(true); }
public static string VersaoSistema() { var versao = SimpleInjectorInitializerFactory.GetInstance <IValidaConfiguracao>().VersaoSistema(); string release = ConfigurationManager.AppSettings["Release"]; if (!string.IsNullOrEmpty(release)) { release = release.Split('-')[1]; } return($"{versao.RetornoMensagem}.{release}"); }