Пример #1
0
    /// <summary>
    /// Creates a list of localized attribute name/display value pairs for the specified Data.com contact, and returns it.
    /// </summary>
    /// <returns>A list of localized attribute name/display value pairs for the specified Data.com contact.</returns>
    private List <RepeaterDataItem> CreateDataSource()
    {
        IEntityAttributeFormatter formatter = DataComHelper.GetEntityAttributeFormatter();
        List <RepeaterDataItem>   items     = new List <RepeaterDataItem>();
        EntityInfo entityInfo = DataComHelper.GetContactEntityInfo();
        IEntityAttributeMapperFactory entityAttributeFactory = DataComHelper.GetContactAttributeMapperFactory();

        foreach (EntityAttributeInfo entityAttributeInfo in entityInfo.Items)
        {
            string entityAttributeValue = String.Empty;
            EntityAttributeMapperBase entityAttribute = entityAttributeFactory.CreateEntityAttributeMapper(entityAttributeInfo.Name, entityInfo);
            if (entityAttribute != null)
            {
                entityAttributeValue = entityAttribute.GetEntityAttributeDisplayValue(Contact, formatter);
            }
            RepeaterDataItem item = new RepeaterDataItem()
            {
                AttributeName  = ResHelper.LocalizeString(entityAttributeInfo.DisplayName),
                AttributeValue = entityAttributeValue
            };
            items.Add(item);
        }

        return(items);
    }
    /// <summary>
    /// Creates a list of localized attribute name/display value pairs for the specified Data.com company, and returns it.
    /// </summary>
    /// <returns>A list of localized attribute name/display value pairs for the specified Data.com company.</returns>
    private List<RepeaterDataItem> CreateDataSource()
    {
        IDataComConfiguration configuration = DataComHelper.GetConfiguration(SiteContext.CurrentSiteID);
        IEntityAttributeFormatter formatter = DataComHelper.GetEntityAttributeFormatter();
        List<RepeaterDataItem> items = new List<RepeaterDataItem>();
        EntityInfo entityInfo = DataComHelper.GetCompanyEntityInfo(configuration);
        IEntityAttributeMapperFactory entityAttributeFactory = DataComHelper.GetCompanyAttributeMapperFactory();
        foreach (EntityAttributeInfo entityAttributeInfo in entityInfo.Items)
        {
            string entityAttributeValue = String.Empty;
            EntityAttributeMapperBase entityAttribute = entityAttributeFactory.CreateEntityAttributeMapper(entityAttributeInfo.Name, entityInfo);
            if (entityAttribute != null)
            {
                entityAttributeValue = entityAttribute.GetEntityAttributeDisplayValue(Company, formatter);
            }
            RepeaterDataItem item = new RepeaterDataItem
            {
                AttributeName = ResHelper.LocalizeString(entityAttributeInfo.DisplayName),
                AttributeValue = entityAttributeValue
            };
            items.Add(item);
        }

        return items;
    }