/// <summary> /// Creates and initializes a new instance of the Panel class with the specified Data.com contact mapping, and returns it. /// </summary> /// <param name="formInfo">The CMS contact form info.</param> /// <param name="entityInfo">The Data.com contact entity info.</param> /// <param name="mapping">The Data.com contact mapping.</param> /// <returns>A new instance of the Panel class initialized with the specified Data.com contact mapping.</returns> private Panel CreateMappingPanel(FormInfo formInfo, EntityInfo entityInfo, EntityMapping mapping) { Panel mappingPanel = new Panel { CssClass = "mapping" }; mappingPanel.Controls.Add(CreateHeaderPanel()); foreach (IField formItem in formInfo.ItemsList) { FormFieldInfo formField = formItem as FormFieldInfo; if (formField != null) { EntityMappingItem mappingItem = mapping.GetItem(formField.Name); if (mappingItem != null) { EntityAttributeInfo entityAttribute = entityInfo.GetAttributeInfo(mappingItem.EntityAttributeName); if (entityAttribute != null) { Panel row = new Panel { CssClass = "control-group-inline" }; mappingPanel.Controls.Add(row); Panel formFieldPanel = new Panel { CssClass = "input-width-60 cms-form-group-text" }; row.Controls.Add(formFieldPanel); formFieldPanel.Controls.Add(new Literal { Text = ResHelper.LocalizeString(formField.GetDisplayName(MacroContext.CurrentResolver)) }); Panel entityAttributePanel = new Panel { CssClass = "input-width-60 cms-form-group-text" }; row.Controls.Add(entityAttributePanel); entityAttributePanel.Controls.Add(new Literal { Text = ResHelper.LocalizeString(entityAttribute.DisplayName) }); } } } } return(mappingPanel); }
/// <summary> /// Creates and initializes a new instance of the Panel class with the specified Data.com contact mapping, and returns it. /// </summary> /// <param name="formInfo">The CMS contact form info.</param> /// <param name="entityInfo">The Data.com contact entity info.</param> /// <param name="mapping">The Data.com contact mapping.</param> /// <returns>A new instance of the Panel class initialized with the specified Data.com contact mapping.</returns> private Panel CreateMappingPanel(FormInfo formInfo, EntityInfo entityInfo, EntityMapping mapping) { Panel mappingPanel = new Panel { CssClass = "mapping" }; HtmlTable mappingTable = new HtmlTable(); mappingTable.Controls.Add(CreateHeaderPanel()); mappingPanel.Controls.Add(mappingTable); foreach (IDataDefinitionItem formItem in formInfo.ItemsList) { FormFieldInfo formField = formItem as FormFieldInfo; if (formField != null) { EntityMappingItem mappingItem = mapping.GetItem(formField.Name); if (mappingItem != null) { EntityAttributeInfo entityAttribute = entityInfo.GetAttributeInfo(mappingItem.EntityAttributeName); if (entityAttribute != null) { HtmlTableRow row = new HtmlTableRow(); mappingTable.Controls.Add(row); HtmlTableCell formFieldCell = new HtmlTableCell(); formFieldCell.Controls.Add(new Literal { Text = ResHelper.LocalizeString(formField.GetDisplayName(MacroContext.CurrentResolver)) }); HtmlTableCell entityAttributeCell = new HtmlTableCell(); entityAttributeCell.Controls.Add(new Literal { Text = ResHelper.LocalizeString(entityAttribute.DisplayName) }); row.Controls.Add(formFieldCell); row.Controls.Add(entityAttributeCell); } } } } return(mappingPanel); }
private void InitializeControls() { MappingItemRepeater.DataSource = mContext.FormInfo.GetFields(true, false); MappingItemRepeater.DataBind(); if (!RequestHelper.IsPostBack()) { foreach (FormFieldInfo fieldInfo in mContext.FormInfo.GetFields(true, false)) { CMSDropDownList dropDownList = mAttributeNamesDropDownLists[fieldInfo.Name]; EntityMappingItem item = SourceMapping.GetItem(fieldInfo.Name); if (item == null) { dropDownList.SelectedIndex = 0; } else { dropDownList.SelectedValue = item.EntityAttributeName; } } } }
/// <summary> /// Creates and initializes a new instance of the HtmlTable class with the specified Data.com company mapping, and returns it. /// </summary> /// <param name="formInfo">The CMS account form info.</param> /// <param name="entityInfo">The Data.com company entity info.</param> /// <param name="mapping">The Data.com company mapping.</param> /// <returns>A new instance of the HtmlTable class initialized with the specified Data.com company mapping.</returns> private HtmlTable CreateTable(FormInfo formInfo, EntityInfo entityInfo, EntityMapping mapping) { HtmlTable table = new HtmlTable(); table.Rows.Add(CreateHeaderRow()); foreach (IFormItem formItem in formInfo.ItemsList) { FormFieldInfo formField = formItem as FormFieldInfo; if (formField != null) { EntityMappingItem mappingItem = mapping.GetItem(formField.Name); if (mappingItem != null) { EntityAttributeInfo entityAttribute = entityInfo.GetAttributeInfo(mappingItem.EntityAttributeName); if (entityAttribute != null) { HtmlTableRow row = new HtmlTableRow(); table.Rows.Add(row); HtmlTableCell formFieldCell = new HtmlTableCell(); row.Cells.Add(formFieldCell); formFieldCell.InnerText = ResHelper.LocalizeString(formField.Caption); HtmlTableCell entityAttributeCell = new HtmlTableCell(); row.Cells.Add(entityAttributeCell); entityAttributeCell.InnerText = ResHelper.LocalizeString(entityAttribute.DisplayName); if (!Enabled) { formFieldCell.Style.Add("color", "#888888"); entityAttributeCell.Style.Add("color", "#888888"); } } } } } return(table); }