예제 #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);
    }
예제 #2
0
    /// <summary>
    /// Initializes the form with the required dependencies and the specified CMS contact.
    /// </summary>
    protected void InitializeDataComForm()
    {
        IDataComConfiguration configuration = DataComHelper.GetConfiguration();
        ContactInfo           contactInfo   = EditedObject as ContactInfo;

        ContactForm.ParametersIdentifier         = BuyParametersIdentifier;
        ContactForm.FormInformation              = DataComHelper.GetContactFormInfo();
        ContactForm.EntityInfo                   = DataComHelper.GetContactEntityInfo();
        ContactForm.EntityMapping                = configuration.GetContactMapping();
        ContactForm.EntityAttributeMapperFactory = DataComHelper.GetContactAttributeMapperFactory();
        ContactForm.Entity = Contact;
        ContactForm.EntityAttributeFormatter = DataComHelper.GetEntityAttributeFormatter();
        ContactForm.BuyContactEnabled        = (credentialProvider.GetCredential() != null);
        ContactForm.DefaultFieldLayout       = FieldLayoutEnum.ThreeColumns;
        ContactForm.DefaultFormLayout        = FormLayoutEnum.SingleTable;
        ContactForm.Restore(contactInfo);
    }