예제 #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);
    }
예제 #3
0
 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);
 }
예제 #4
0
 /// <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));
 }