示例#1
0
 // Leaving fully qualified names here since it's kind of confusing having the two sponsor classes
 // named the same.  This way, it's clear.
 private CC.UI.Webhost.Models.Sponsor ServiceToWebHostSponsor(Service.Webhost.Services.Sponsor serviceSponsor)
 {
     return(new CC.UI.Webhost.Models.Sponsor()
     {
         ID = serviceSponsor.ID,
         EventID = serviceSponsor.EventID,
         Name = serviceSponsor.Name,
         Description = serviceSponsor.Description,
         SponsorshipLevel = serviceSponsor.SponsorshipLevel,
         WebsiteUrl = serviceSponsor.WebsiteUrl,
         Logo = ImageUtils.ImageFromBytes(serviceSponsor.Image),
     });
 }
示例#2
0
        private MetroTileImage SponsorToDoubleMetroTile(Service.Webhost.Services.Sponsor sponsor)
        {
            // Only create a tile if the sponsor has a Name AND an image.
            // Also, if the sponsor image is corrupted for some reason, don't add it.
            WebImageOCC image = ImageUtils.ImageFromBytes(sponsor.Image);

            if (!string.IsNullOrEmpty(sponsor.Name) && image != null)
            {
                return(new MetroTileImage(image)
                {
                    AltText = sponsor.Name,
                    Title = string.Format("{0} ({1} sponsor)", sponsor.Name, sponsor.SponsorshipLevel.Replace("sponsor", String.Empty)),
                    AnchorTagUri = sponsor.WebsiteUrl
                });
            }
            else
            {
                return(null);
            }
        }