HEX
Server: Microsoft-IIS/8.5
System: Windows NT YDAWBH120 6.3 build 9600 (Windows Server 2012 R2 Standard Edition) AMD64
User: tentjecom_web (0)
PHP: 7.4.14
Disabled: NONE
Upload Files
File: D:/HostingSpaces/TDijk1/erp-apps.eu/wwwroot/CMSModules/Personas/Controls/PersonaInformation.ascx.cs
using System;
using System.Linq;

using CMS.Base;
using CMS.FormControls;
using CMS.Helpers;
using CMS.Personas;

/// <summary>
/// 'Viewer' form contol which displays persona information. Persona's picture and name is displayed. ID of persona should be set to Value.
/// </summary>
public partial class CMSModules_Personas_Controls_PersonaInformation : FormEngineUserControl
{
    /// <summary>
    /// Gets or sets field value.
    /// </summary>
    public override object Value
    {
        get;
        set;
    }


    protected void Page_Load(object sender, EventArgs e)
    {
        var personaInfo = PersonaInfoProvider.GetPersonaInfoById(Value.ToInteger(0));

        string personaPictureUrl;

        if (personaInfo == null)
        {
            lblPersonaName.Text = GetString("general.empty");
            personaPictureUrl = PersonasFactory.GetPersonaPictureUrlCreator().CreateDefaultPersonaPictureUrl(32);
            imgPersonaImage.AlternateText = GetString("general.empty");
        }
        else
        {
            divPersonaInfoContent.Attributes["title"] = personaInfo.PersonaDescription;
            lblPersonaName.Text = HTMLHelper.HTMLEncode(personaInfo.PersonaDisplayName);
            personaPictureUrl = PersonasFactory.GetPersonaPictureUrlCreator().CreatePersonaPictureUrl(personaInfo, 32);
            imgPersonaImage.AlternateText = HTMLHelper.HTMLEncode(personaInfo.PersonaDisplayName);
        }

        if (personaPictureUrl != null)
        {
            imgPersonaImage.ImageUrl = personaPictureUrl;
        }
        else
        {
            imgPersonaImage.Visible = false;
        }
    }
}