protected void BuyButton_Click(object sender, EventArgs e)
 {
     if (Contact != null)
     {
         try
         {
             IDataComConfiguration configuration  = DataComHelper.GetConfiguration(SiteIdentifierParameter);
             NetworkCredential     userCredential = configuration.GetUserCredential();
             if (userCredential != null)
             {
                 DataComClient    client     = DataComHelper.CreateClient(configuration);
                 IContactProvider provider   = new UserContactProvider(client, userCredential);
                 Contact          contact    = provider.GetContact(Contact.ContactId, true);
                 JsonSerializer   serializer = new JsonSerializer();
                 ContactHiddenField.Value = serializer.Serialize(contact);
             }
             else
             {
                 ErrorSummary.Report(GetString("datacom.nousercredential"));
                 BuyButton.Enabled = false;
             }
         }
         catch (Exception exception)
         {
             HandleException(exception);
         }
     }
 }
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         RestoreParameters();
         InitializeContactPreview(Contact);
         if (!RequestHelper.IsPostBack())
         {
             IDataComConfiguration configuration  = DataComHelper.GetConfiguration(SiteIdentifierParameter);
             NetworkCredential     userCredential = configuration.GetUserCredential();
             if (userCredential != null)
             {
                 DataComClient client   = DataComHelper.CreateClient(configuration);
                 User          response = client.GetUser(userCredential);
                 InitializeAccountPoints(response.Points);
                 InitializePurchasePointsLink(response.PurchasePointsUrl);
             }
             else
             {
                 ErrorSummary.Report(GetString("datacom.nousercredential"));
                 BuyButton.Enabled = false;
             }
         }
     }
     catch (Exception exception)
     {
         HandleException(exception);
     }
 }
Beispiel #3
0
 protected void Page_Load(object sender, EventArgs e)
 {
     try
     {
         RestoreParameters();
         InitializeContactPreview(Contact);
         if (!RequestHelper.IsPostBack())
         {
             ICredentialProvider credentialProvider = new UserCredentialProvider(MembershipContext.AuthenticatedUser);
             NetworkCredential   userCredential     = credentialProvider.GetCredential();
             if (userCredential != null)
             {
                 DataComClient client   = DataComHelper.CreateClient();
                 User          response = client.GetUser(userCredential);
                 InitializeAccountPoints(response.Points);
                 InitializePurchasePointsLink(DATACOM_LOGIN_PAGE);
             }
             else
             {
                 ErrorSummary.Report(GetString("datacom.nousercredential"));
                 BuyButton.Enabled = false;
             }
         }
     }
     catch (Exception exception)
     {
         HandleException(exception);
     }
 }
Beispiel #4
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        var email    = txtEmail.Text;
        var password = txtPassword.Text;

        if (!ValidationHelper.IsEmail(email))
        {
            ShowError(GetString("datacom.invalidemail"));
            return;
        }

        if (string.IsNullOrEmpty(password))
        {
            ShowError(GetString("general.requirespassword"));
            return;
        }

        var networkCredetial = new NetworkCredential {
            UserName = email, Password = password
        };

        // Check if user is valid on data.com
        try
        {
            var client = DataComHelper.CreateClient();
            if (!client.UserIsValid(networkCredetial))
            {
                ShowError(GetString("datacom.invalidcredential"));
                return;
            }
        }
        catch (Exception ex)
        {
            ErrorSummary.Report(ex);
            return;
        }

        var redirectUrl = GetRedirectUrl();

        if (redirectUrl != null)
        {
            var provider = GetCredentialProvider();

            if (provider != null)
            {
                provider.SetCredential(networkCredetial);
                URLHelper.Redirect(UrlResolver.ResolveUrl(redirectUrl));
            }
            else
            {
                // Someone has changed url or step has been deleted, url is no longer valid
                ShowError(GetString("datacom.invalidreferring"));
            }
        }
        else
        {
            ShowError(GetString("datacom.invalidreferring"));
        }
    }
 /// <summary>
 /// Displays an error message and logs the specified exception to the event log.
 /// </summary>
 /// <param name="exception">The exception to handle.</param>
 private void HandleException(Exception exception)
 {
     ErrorSummary.Report(exception);
     ConfirmButton.Enabled = false;
     EventLogProvider.LogException("Data.com Connector", "SelectContactPage", exception);
 }
Beispiel #6
0
 /// <summary>
 /// Displays an error message and logs the specified exception to the event log.
 /// </summary>
 /// <param name="exception">The exception to handle.</param>
 private void HandleException(Exception exception)
 {
     ErrorSummary.Report(exception);
     EventLogProvider.LogException("Data.com Connector", "ContactMappingFormControl", exception);
 }
Beispiel #7
0
 /// <summary>
 /// Displays a default error message and logs the specified exception to the event log.
 /// </summary>
 /// <param name="exception">The exception to handle.</param>
 private void HandleException(Exception exception)
 {
     ErrorSummary.Report(exception);
     EventLogProvider.LogException("Data.com Connector", "EditMappingPage", exception);
 }
 /// <summary>
 /// Displays an error message and logs the specified exception to the event log.
 /// </summary>
 /// <param name="exception">The exception to handle.</param>
 private void HandleException(Exception exception)
 {
     ErrorSummary.Report(exception);
     StopProcessing = true;
     EventLogProvider.LogException("Data.com Connector", "ContactPage", exception);
 }
 /// <summary>
 /// Displays an error message and logs the specified exception to the event log.
 /// </summary>
 /// <param name="exception">The exception to handle.</param>
 private void HandleException(Exception exception)
 {
     ErrorSummary.Report(exception);
     EventLogProvider.LogException("Data.com Connector", "SelectCompanyPage", exception);
 }