/// <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(); 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); }
/// <summary> /// Initializes the form with the required dependencies and the specified CMS account. /// </summary> protected void InitializeDataComForm() { IDataComConfiguration configuration = DataComHelper.GetConfiguration(AccountSiteID); AccountInfo accountInfo = EditedObject as AccountInfo; CompanyForm.FormInformation = DataComHelper.GetAccountFormInfo(); CompanyForm.EntityInfo = DataComHelper.GetCompanyEntityInfo(configuration); CompanyForm.EntityMapping = configuration.GetCompanyMapping(); CompanyForm.EntityAttributeMapperFactory = DataComHelper.GetCompanyAttributeMapperFactory(); CompanyForm.Entity = Company; CompanyForm.EntityAttributeFormatter = DataComHelper.GetEntityAttributeFormatter(); CompanyForm.Restore(accountInfo); }