Beispiel #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        // Check that the control is included in CMSPage (otherwise an exception is thrown on the Design tab)
        var page = Page as CMSPage;

        if (page == null)
        {
            return;
        }

        var persona = UIContext.EditedObjectParent as PersonaInfo;

        if (persona == null)
        {
            return;
        }

        // Display number of contacts in persona
        int personaContactCount = PersonasFactory.GetPersonaService().GetContactsForPersona(persona).Count;

        lblCount.InnerText = String.Format(GetString("personas.ui.contactcount"), personaContactCount);

        // Display ratio of the number of contacts in persona to the number of all contacts
        int totalContactCount = ContactInfoProvider.GetContacts().Count;

        double ratio = (totalContactCount == 0) ? 0 : (double)personaContactCount / totalContactCount * 100;

        lblRatio.InnerText = String.Format(GetString("personas.ui.contactratio"), ratio);
    }
Beispiel #2
0
    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;
        }
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        // Check that the control is included in CMSPage (otherwise an exception is thrown on the Design tab)
        var page = Page as CMSPage;

        if (page == null)
        {
            return;
        }

        int personaID = QueryHelper.GetInteger("personaid", 0);

        if (personaID > 0)
        {
            PersonaInfo persona = PersonaInfoProvider.GetPersonaInfoById(personaID);
            if (persona != null)
            {
                // Display number of contacts in persona
                int personaContactCount = PersonasFactory.GetPersonaService().GetContactsForPersona(persona).Count;
                lblCount.InnerText = String.Format(GetString("personas.ui.contactcount"), personaContactCount);

                // Display ratio of the number of contacts in persona to the number of all contacts
                int totalContactCount = ContactInfoProvider.GetContacts()
                                        .OnSite(SiteContext.CurrentSiteID)
                                        .WhereNull("ContactMergedWithContactID")
                                        .Count;

                double ratio = (totalContactCount == 0) ? 0 : (double)personaContactCount / totalContactCount * 100;
                lblRatio.InnerText = String.Format(GetString("personas.ui.contactratio"), ratio);
            }
        }
    }
Beispiel #4
0
    /// <summary>
    /// Updates UniGrid to display the same contacts as the ones in the given ObjectQuery (filters out contacts not related to current persona).
    /// </summary>
    private void UpdateGridWithObjectQuery()
    {
        var objectQuery = PersonasFactory.GetPersonaService().GetContactsForPersona(GetCurrentPersonaInfo());

        if (Control.QueryParameters == null)
        {
            Control.QueryParameters = objectQuery.Parameters;
        }
        else
        {
            foreach (var param in objectQuery.Parameters)
            {
                Control.QueryParameters.Add(param);
            }
        }

        Control.WhereCondition = new WhereCondition(Control.GetFilter()).Where(objectQuery.WhereCondition).WhereCondition;
    }