/// <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); }
protected override void OnPreRender(EventArgs e) { if (Mapping != null) { try { FormInfo formInfo = DataComHelper.GetContactFormInfo(); EntityInfo entityInfo = DataComHelper.GetContactEntityInfo(); Panel mappingPanel = CreateMappingPanel(formInfo, entityInfo, Mapping); Controls.Add(mappingPanel); } 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)); }