/// <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); }
protected override void OnPreRender(EventArgs e) { if (Mapping != null) { try { IDataComConfiguration configuration = DataComHelper.GetConfiguration(); FormInfo formInfo = DataComHelper.GetAccountFormInfo(); EntityInfo entityInfo = DataComHelper.GetCompanyEntityInfo(configuration); Panel mappingPanel = CreateMappingPanel(formInfo, entityInfo, Mapping); Controls.Add(mappingPanel); } catch (Exception exception) { HandleException(exception); } } base.OnPreRender(e); }
protected override void OnPreRender(EventArgs e) { if (Mapping != null) { try { IDataComConfiguration configuration = DataComHelper.GetConfiguration(CMSContext.CurrentSiteID); FormInfo formInfo = DataComHelper.GetAccountFormInfo(); EntityInfo entityInfo = DataComHelper.GetCompanyEntityInfo(configuration); HtmlTable table = CreateTable(formInfo, entityInfo, Mapping); Controls.Add(table); } catch (Exception exception) { HandleException(exception); } } base.OnPreRender(e); }
/// <summary> /// Creates current request context, and returns it. /// </summary> /// <returns>Current request context.</returns> private RequestContext CreateContext() { if (mEntityName == "Contact") { return(new RequestContext { FormInfo = DataComHelper.GetContactFormInfo(), EntityInfo = DataComHelper.GetContactEntityInfo(), InitializeMappingControl = (x => ContactMappingControl.Mapping = x) }); } if (mEntityName == "Company") { IDataComConfiguration configuration = DataComHelper.GetConfiguration(); return(new RequestContext { FormInfo = DataComHelper.GetAccountFormInfo(), EntityInfo = DataComHelper.GetCompanyEntityInfo(configuration), InitializeMappingControl = (x => CompanyMappingControl.Mapping = x) }); } throw new Exception(String.Format("[DataComEditMappingPage.CreateContext]: Invalid mapping type ({0}).", mEntityName)); }