Exemplo n.º 1
0
        private static void CreateLogo(Organization org, Instance inst, ref HyperLink link)
        {
            if (org != null)
            {
                string headerLogoImageUrl    = string.Empty;
                string headerLogoText        = string.Empty;
                string headerLogoNavigateUrl = string.Empty;

                if (FrameworkConfiguration.Current.WebApplication.EnableMultipleInstances)
                {
                    if (inst != null)
                    {
                        headerLogoImageUrl = InstanceProvider.GetInstanceLogoImageUrlFromCache(inst.InstanceId, inst.OrganizationId);
                        headerLogoText     = inst.Name;
                    }
                }

                if (string.IsNullOrEmpty(headerLogoImageUrl))
                {
                    headerLogoImageUrl = OrganizationProvider.GetOrganizationLogoImageUrlFromCache(org.OrganizationId);
                }

                if (string.IsNullOrEmpty(headerLogoText))
                {
                    headerLogoText = org.Name;
                }
                else
                {
                    headerLogoText = org.Name + Html32TextWriter.SpaceChar + headerLogoText;
                }

                headerLogoNavigateUrl = org.WebsiteUrl;

                if (link == null)
                {
                    link = new HyperLink();
                }

                if (!string.IsNullOrEmpty(headerLogoNavigateUrl))
                {
                    link.NavigateUrl = headerLogoNavigateUrl;
                    if (string.IsNullOrEmpty(headerLogoImageUrl))
                    {
                        link.Text = headerLogoText;
                    }
                    else
                    {
                        link.ImageUrl = headerLogoImageUrl;
                    }
                    link.ToolTip = headerLogoText;
                    link.Target  = "_blank";
                    link.Visible = true;
                }
                else
                {
                    if (string.IsNullOrEmpty(headerLogoImageUrl))
                    {
                        link.Text    = headerLogoText;
                        link.Visible = true;
                    }
                    else
                    {
                        link.ImageUrl = headerLogoImageUrl;
                        link.ToolTip  = headerLogoText;
                        link.Visible  = true;
                    }
                }
            }
        }