Пример #1
0
 internal static void UpdateContact(Contact contact)
 {
     if (DotMailerService.DotMailerEnabled)
     {
         try
         {
             // (hit 3: in guest signup journey, or hit 1 in donation journey)
             DotMailerService.GetApiService().UpdateContact(contact.ToApiContact());
         }
         catch (Exception exception)
         {
             LogHelper.Error(typeof(DotMailerService), "UpdateContact", exception);
         }
     }
 }
Пример #2
0
        /// <summary>
        /// add new contact (marked as a Party Guest)
        /// </summary>
        /// <param name="contact"></param>
        internal static void GuestRegistrationStarted(Contact contact)
        {
            if (DotMailerService.DotMailerEnabled)
            {
                try
                {
                    // create contact
                    ApiContact apiContact = DotMailerService.GetApiService().CreateContact(contact.ToApiContact());

                    // update local member with dotMailerId
                    contact.Partier.DotMailerId = apiContact.Id;
                }
                catch (Exception exception)
                {
                    LogHelper.Error(typeof(DotMailerService), "GuestRegistrationStarted", exception);
                }
            }
        }
Пример #3
0
        /// <summary>
        /// add contact to the Party Guest address book
        /// </summary>
        /// <param name="contac"></param>
        internal static void GuestRegistrationCompleted(Contact contact)
        {
            if (DotMailerService.DotMailerEnabled)
            {
                try
                {
                    ApiService apiService = DotMailerService.GetApiService();

                    // add guest to address book - dotMailer will fire off email 18
                    apiService.AddContactToAddressBook(DotMailerService.PartyGuestsAddressBookId, contact.ToApiContact());

                    contact.Partier.DotMailerRegistrationComplete = true;
                }
                catch (Exception exception)
                {
                    LogHelper.Error(typeof(DotMailerService), "GuestRegistrationCompleted", exception);
                }
            }
        }
Пример #4
0
        /// <summary>
        /// add contact to the Party Hosts address book
        /// </summary>
        /// <param name="contact"></param>
        internal static void HostRegistrationCompleted(Contact contact)
        {
            if (DotMailerService.DotMailerEnabled)
            {
                try
                {
                    ApiService apiService = DotMailerService.GetApiService();

                    // add host to address book (this also updates the contact details) - dotmailer will fire off email 2.
                    apiService.AddContactToAddressBook(DotMailerService.PartyHostsAddressBookId, contact.ToApiContact());

                    contact.Partier.DotMailerRegistrationComplete = true;
                }
                catch (Exception exception)
                {
                    LogHelper.Error(typeof(DotMailerService), "HostRegistrationCompleted", exception);
                }
            }
        }
Пример #5
0
        internal static void UpdatePartyDetails(PartyHost partyHost)
        {
            if (DotMailerEnabled)
            {
                // http://api.dotmailer.com/v2/api.svc#op.ApiService.ImportContacts

                StringBuilder stringBuilder = new StringBuilder();

                stringBuilder.AppendLine("Email, Party_Date, Party_Time, Party_Address_1, Party_Address_2, Party_Town_City, Party_Postcode");

                foreach (IPartier partier in new MembershipHelper(UmbracoContext.Current).GetPartiers(partyHost.PartyGuid))
                {
                    stringBuilder.AppendLine(
                        string.Join(
                            ", ",
                            new object[] {
                        partier.Email,
                        partyHost.PartyDateTime.ToString("dd/MM/yyyy"),
                        partyHost.PartyDateTime.ToString("HH:mm"),
                        partyHost.PartyAddress.Address1,
                        partyHost.PartyAddress.Address2,
                        partyHost.PartyAddress.TownCity,
                        partyHost.PartyAddress.Postcode
                    })
                        );
                }

                try
                {
                    DotMailerService.GetApiService().ImportContacts(Encoding.UTF8.GetBytes(stringBuilder.ToString()), "csv");
                }
                catch (Exception exception)
                {
                    LogHelper.Error(typeof(DotMailerService), "UpdatePartyDetails", exception);
                }
            }
        }