public static void AddLogixAppHeaders(this Microsoft.AspNetCore.Builder.IApplicationBuilder app, Microsoft.Extensions.Configuration.IConfiguration configuration) { if (LogixAuthentication.LogixUser == null) { return; } if (LogixAuthentication.LogixUser.Claims.Count() == 0) { return; } string applicationName = configuration["ApplicationName"]; string useNewConnectHeader = configuration["HeaderAndFooter:UseNewConnectHeader"]; string endpoint = configuration["HeaderAndFooter:Address"]; string binding = configuration["HeaderAndFooter:Binding"]; string helpId = string.Empty; string timeOut = string.Empty; string organizationId = ""; LogixHeaderAndFooterServiceClient serviceClient = new LogixHeaderAndFooterServiceClient(binding, endpoint); ConnectHeader = new LogixConnectHeader(); if (useNewConnectHeader.ToUpper() == "YES") { ConnectHeader.TheNewConnectHeader = serviceClient.GetUserHeaderForCurrentArea(new System.Guid(LogixAuthentication.LogixUser.ClaimsUserID()), applicationName, helpId, timeOut, organizationId); if (ConnectHeader.TheNewConnectHeader != null) { ConnectHeader.TheNewConnectHeader.ApplicationName = applicationName; } } else if (useNewConnectHeader.ToUpper() == "NO") { ConnectHeader.TheOldConnectHeader = serviceClient.GetUserHeader(new System.Guid(LogixAuthentication.LogixUser.ClaimsUserID()), organizationId); if (ConnectHeader.TheOldConnectHeader != null) { ConnectHeader.TheOldConnectHeader.ApplicationName = applicationName; } } }
public static void InitializeHeaderAndFooter() { if (LoggedInUser == null) { return; } if (LoggedInUser.Claims.Count() == 0) { return; } if (!LoggedInUser.Identity.IsAuthenticated) { return; } string organizationId = "0"; HeadersAndFooters.LogixHeaderAndFooterServiceClient serviceClient = new HeadersAndFooters.LogixHeaderAndFooterServiceClient ( _configuration.HeaderAndFooterSettings.ServiceBinding, _configuration.HeaderAndFooterSettings.ServiceAddress ); HeadersAndFooters.LogixPortal.UseNewHeaderFooter = null; if (_configuration.HeaderAndFooterSettings.UseNewConnectHeader.ToUpper() == "YES") { string helpId = string.Empty; string timeOut = string.Empty; HeadersAndFooters.LogixPortal.Header = serviceClient.GetUserHeaderForCurrentArea ( new System.Guid(LoggedInUser.UserID()), _configuration.LogixLoggerSettings.ApplicationName, helpId, timeOut, organizationId ); HeadersAndFooters.LogixPortal.Footer = serviceClient.GetUserFooterCurrentArea ( _configuration.LogixLoggerSettings.ApplicationName ); if (HeadersAndFooters.LogixPortal.Header != null) { HeadersAndFooters.LogixPortal.UseNewHeaderFooter = true; } } else { HeadersAndFooters.LogixPortal.Header = serviceClient.GetUserHeader ( new System.Guid(LoggedInUser.UserID()), organizationId ); if (HeadersAndFooters.LogixPortal.Header != null) { HeadersAndFooters.LogixPortal.Header.ApplicationName = _configuration.LogixLoggerSettings.ApplicationName; } HeadersAndFooters.LogixPortal.UseNewHeaderFooter = false; } }
public static void InitializeHeaderAndFooter() { if (LoggedInUser == null) { return; } if (LoggedInUser.Claims.Count() == 0) { return; } if (!LoggedInUser.Identity.IsAuthenticated) { return; } string organizationId = "0"; HeadersAndFooters.LogixHeaderAndFooterServiceClient serviceClient = new HeadersAndFooters.LogixHeaderAndFooterServiceClient ( _configuration.HeaderAndFooterSettings.ServiceBinding, _configuration.HeaderAndFooterSettings.ServiceAddress ); HeadersAndFooters.LogixPortal.UseNewHeaderFooter = null; if (_configuration.HeaderAndFooterSettings.UseNewConnectHeader.ToUpper() == "YES") { string helpId = string.Empty; string timeOut = string.Empty; HeadersAndFooters.LogixPortal.Header = serviceClient.GetUserHeaderForCurrentArea ( new System.Guid(LoggedInUser.UserID()), _configuration.LogixLoggerSettings.ApplicationName, helpId, timeOut, organizationId ); HeadersAndFooters.LogixPortal.Footer = serviceClient.GetUserFooterCurrentArea ( _configuration.LogixLoggerSettings.ApplicationName ); if (HeadersAndFooters.LogixPortal.Header != null) { HeadersAndFooters.LogixPortal.UseNewHeaderFooter = true; } } else { organizationId = ""; HeadersAndFooters.LogixPortal.Header = serviceClient.GetUserHeader ( new System.Guid(LoggedInUser.UserID()), organizationId ); if (HeadersAndFooters.LogixPortal.Header != null) { string htmlHeader = "" + "<div class=\"page - header\"> " + " <div class=\"nav - bar\">" + " <div class=\"container cf\">" + " <a href=\"#\"><i class=\"icn logo paidright\"></i></a>" + " <ul class=\"nav\">" + " <li class=\"level-1-first\" style=\"z-index: 1\">" + " <a class=\"user\" tabindex=\"0\" id=\"userName\">" + " <span id=\"spnGreetings\"></span>" + " </a>" + " <div class=\"level-2\" style=\"height: 32px;\">" + " <dl class=\"app-alerts user-menu\">" + " <dt>" + " <input type=\"hidden\" id=\"hdnLoggedUserId\" />" + " <ul class=\"main\">" + " <li><a href=\"~/Home/Logout\"><i class=\"icn logout\"></i></a></li>" + " <li style=\"margin-top: 5px;\"><h6><a class=\"clr1-text\" href=\"~/Home/Logout\">Logout</a></h6></li>" + " @Html.Hidden(\"ApplicationPath\", Url.Content(\"~/\"))" + " </ul>" + " </dt>" + " </dl>" + " </div>" + " </li>" + " </ul>" + " </div>" + " </div>" + "</div>"; HeadersAndFooters.LogixPortal.Header.ApplicationName = _configuration.LogixLoggerSettings.ApplicationName; HeadersAndFooters.LogixPortal.Header.OutputHtmlHeader = htmlHeader; } HeadersAndFooters.LogixPortal.UseNewHeaderFooter = false; } }