Пример #1
0
        /// <summary>
        /// Subscribes <paramref name="contact"/> to the specified <paramref name="newsletter"/> using <paramref name="subscriptionSettings"/>.
        /// If a given contact hasn't been saved into database yet the method does so.
        /// </summary>
        /// <param name="contact">Subscriber to be subscribed</param>
        /// <param name="newsletter">Newsletter to subscribe to</param>
        /// <param name="subscriptionSettings">Subscription configuration</param>
        /// <returns>True if contact was subscribed by current call, false when contact had already been subscribed.</returns>
        /// <exception cref="ArgumentNullException"><paramref name="contact"/> or <paramref name="newsletter"/> is null.</exception>
        public virtual bool Subscribe(ContactInfo contact, NewsletterInfo newsletter, NewsletterSubscriptionSettings subscriptionSettings)
        {
            if (contact == null)
            {
                throw new ArgumentNullException(nameof(contact));
            }

            if (newsletter == null)
            {
                throw new ArgumentNullException(nameof(newsletter));
            }

            var subscriptionService = Service.Resolve <ISubscriptionService>();

            if (!subscriptionService.IsSubscribed(contact, newsletter))
            {
                if (contact.ContactID <= 0)
                {
                    ContactInfoProvider.SetContactInfo(contact);
                }

                subscriptionService.Subscribe(contact, newsletter, subscriptionSettings);
                return(true);
            }

            return(false);
        }
Пример #2
0
        private ContactInfo GenerateDustinEvans(int contactStatusId, int contactOwneruserId)
        {
            var contact = GenerateContact("Dustin", "Evans", "*****@*****.**", "(808)-139-4639");

            contact.ContactBirthday    = DateTime.Today.AddYears(-40);
            contact.ContactGender      = 1;
            contact.ContactJobTitle    = CeoContactRole;
            contact.ContactStatusID    = contactStatusId;
            contact.ContactMobilePhone = "+420123456789";
            contact.ContactCampaign    = ContactCampaign;
            contact.ContactOwnerUserID = contactOwneruserId;
            contact.ContactNotes       = "Willing to participate in the partnership program - materials sent";
            contact.ContactCity        = "South Yarra";
            contact.ContactAddress1    = "163 Commercial Road";
            contact.ContactZIP         = "VIC 3141";
            contact.ContactCompanyName = "Jasper Coffee";
            contact.ContactCountryID   = CountryInfoProvider.GetCountryInfo("Australia").CountryID;
            contact.ContactNotes       = "Willing to participate in the partnership program - materials sent";
            ContactInfoProvider.SetContactInfo(contact);
            GeneratePageVisitActivity(_mHomeDocument, contact);
            GenerateInternalSearchActivity(_mHomeDocument, contact, "wholesale");
            GeneratePageVisitActivity(_mPartnershipDocument, contact);
            CreateFormSubmission(_mPartnershipDocument, BusinessCustomerRegistationFormCodeName, contact);
            return(contact);
        }
        private void GenerateStacyStewart()
        {
            var stacyStewart = GenerateContact("Stacy", "Stewart", "*****@*****.**", null);

            stacyStewart.ContactCountryID = CountryInfoProvider.GetCountryInfo("Germany").CountryID;
            stacyStewart.ContactCity      = "Berlin";
            stacyStewart.ContactNotes     = "Contact acquired at CoffeeExpo2015";
            ContactInfoProvider.SetContactInfo(stacyStewart);
        }
Пример #4
0
        private ContactInfo CreateContact()
        {
            var contact = new ContactInfo
            {
                ContactLastName = "contactlastname" + Guid.NewGuid(),
            };

            ContactInfoProvider.SetContactInfo(contact);
            return(contact);
        }
        private void GenerateHaroldLarson()
        {
            var haroldLarson = GenerateContact("Harold", "Larson", "*****@*****.**", "(742)-343-5223");

            haroldLarson.ContactGender    = (int)UserGenderEnum.Male;
            haroldLarson.ContactCountryID = CountryInfoProvider.GetCountryInfo("USA").CountryID;
            haroldLarson.ContactCity      = "Bedford";
            haroldLarson.ContactBounces   = 5;
            haroldLarson.ContactStateID   = StateInfoProvider.GetStateInfo("NewHampshire").StateID;
            ContactInfoProvider.SetContactInfo(haroldLarson);
        }
Пример #6
0
        private void CreateAnonymousContact(DateTime contactCreated)
        {
            var contactInfo = new ContactInfo
            {
                ContactLastName  = "Anonymous - " + contactCreated.ToString("yyyy-MM-dd HH:mm:ss.fff"),
                ContactMonitored = true,
                ContactCreated   = contactCreated
            };

            ContactInfoProvider.SetContactInfo(contactInfo);
            GeneratePageVisitActivity(_mHomeDocument, contactInfo);
        }
        private ContactInfo CreateContact(string firstName, string lastName, string subscriberEmail)
        {
            var contact = new ContactInfo
            {
                ContactFirstName = firstName,
                ContactLastName  = lastName,
                ContactEmail     = subscriberEmail
            };

            ContactInfoProvider.SetContactInfo(contact);
            return(contact);
        }
        private ContactInfo CreateContact(
            string firstName,
            string lastName,
            string subscriberEmail)
        {
            var contactObj = new ContactInfo();

            contactObj.ContactFirstName = firstName;
            contactObj.ContactLastName  = lastName;
            contactObj.ContactEmail     = subscriberEmail;
            ContactInfoProvider.SetContactInfo(contactObj);
            return(contactObj);
        }
Пример #9
0
        private void GenerateStacyStewart()
        {
            var contact = GenerateContact("Stacy", "Stewart", "*****@*****.**", null);

            contact.ContactCountryID = CountryInfoProvider.GetCountryInfo("Germany").CountryID;
            contact.ContactCity      = "Berlin";
            contact.ContactCampaign  = ContactCampaign;
            contact.ContactNotes     = "Contact acquired at CoffeeExpo2015";
            ContactInfoProvider.SetContactInfo(contact);
            GeneratePageVisitActivity(_mHomeDocument, contact);
            GeneratePageVisitActivity(_mPartnershipDocument, contact);
            CreateFormSubmission(_mPartnershipDocument, TryFreeSampleFormCodeName, contact);
        }
Пример #10
0
 private void GenerateContacts()
 {
     for (var i = 0; i < NUMBER_OF_GENERATED_CONTACTS; i++)
     {
         var contact = new ContactInfo()
         {
             ContactFirstName = mContactFirstNamePrefix + i,
             ContactLastName  = mContactLastNamePrefix + i,
             ContactEmail     = string.Format("{0}{1}@localhost.local", mContactFirstNamePrefix, i)
         };
         ContactInfoProvider.SetContactInfo(contact);
     }
 }
Пример #11
0
        private void GenerateHaroldLarson()
        {
            var contact = GenerateContact("Harold", "Larson", "*****@*****.**", "(742)-343-5223");

            contact.ContactGender    = 1;
            contact.ContactCountryID = CountryInfoProvider.GetCountryInfo("USA").CountryID;
            contact.ContactCity      = "Bedford";
            contact.ContactBounces   = 5;
            contact.ContactStateID   = StateInfoProvider.GetStateInfo("NewHampshire").StateID;
            ContactInfoProvider.SetContactInfo(contact);
            GeneratePageVisitActivity(_mPartnershipDocument, contact);
            CreateFormSubmission(_mPartnershipDocument, TryFreeSampleFormCodeName, contact);
            CreateFormSubmission(_mPartnershipDocument, ContactUsFormCodeName, contact);
        }
        private ContactInfo GenerateContact(string firstName, string lastName, string email, string businessPhone)
        {
            var contact = new ContactInfo
            {
                ContactFirstName     = firstName,
                ContactLastName      = lastName,
                ContactEmail         = email,
                ContactBusinessPhone = businessPhone,
                ContactMonitored     = true
            };

            ContactInfoProvider.SetContactInfo(contact);
            return(contact);
        }
Пример #13
0
    /// <summary>
    /// Saves merge changes.
    /// </summary>
    private void SaveChanges()
    {
        mParentContact.ContactFirstName     = cmbContactFirstName.Text.Trim();
        mParentContact.ContactMiddleName    = cmbContactMiddleName.Text.Trim();
        mParentContact.ContactLastName      = cmbContactLastName.Text.Trim();
        mParentContact.ContactSalutation    = cmbContactSalutation.Text.Trim();
        mParentContact.ContactTitleBefore   = cmbContactTitleBefore.Text.Trim();
        mParentContact.ContactTitleAfter    = cmbContactTitleAfter.Text.Trim();
        mParentContact.ContactCompanyName   = cmbContactCompanyName.Text.Trim();
        mParentContact.ContactJobTitle      = cmbContactJobTitle.Text.Trim();
        mParentContact.ContactAddress1      = cmbContactAddress1.Text.Trim();
        mParentContact.ContactAddress2      = cmbContactAddress2.Text.Trim();
        mParentContact.ContactCity          = cmbContactCity.Text.Trim();
        mParentContact.ContactZIP           = cmbContactZIP.Text.Trim();
        mParentContact.ContactStateID       = countrySelector.StateID;
        mParentContact.ContactCountryID     = countrySelector.CountryID;
        mParentContact.ContactMobilePhone   = cmbContactMobilePhone.Text.Trim();
        mParentContact.ContactHomePhone     = cmbContactHomePhone.Text.Trim();
        mParentContact.ContactBusinessPhone = cmbContactBusinessPhone.Text.Trim();
        mParentContact.ContactEmail         = cmbContactEmail.Text.Trim();
        mParentContact.ContactWebSite       = cmbContactWebSite.Text.Trim();
        mParentContact.ContactBirthday      = ValidationHelper.GetDateTime(calendarControl.Value, DateTimeHelper.ZERO_TIME);
        mParentContact.ContactGender        = genderSelector.Gender;
        mParentContact.ContactStatusID      = ValidationHelper.GetInteger(contactStatusSelector.Value, 0);
        mParentContact.ContactCampaign      = (string)cCampaign.Value;
        mParentContact.ContactNotes         = (string)htmlNotes.Value;
        mParentContact.ContactOwnerUserID   = MembershipContext.AuthenticatedUser.UserID;
        mParentContact.ContactMonitored     = chkContactMonitored.Checked;

        // Save cusotm fields
        foreach (string key in mCustomFields.Keys)
        {
            // Get value from
            object value    = ((object[])mCustomFields[key])[0];
            var    datatype = (string)((object[])mCustomFields[key])[1];
            string text     = ((TextBox)value).Text;

            if (!String.IsNullOrEmpty(text))
            {
                // Convert the value to a proper type
                var convertedValue = DataTypeManager.ConvertToSystemType(TypeEnum.Field, datatype, text);

                // Set the parent value
                mParentContact.SetValue(key, convertedValue);
            }
        }

        ContactInfoProvider.SetContactInfo(mParentContact, false);
    }
        private void GenerateContacts()
        {
            for (var index = 0; index < NumberOfGeneratedContacts; ++index)
            {
                var firstname = GetRandomName(_firstNames);
                var lastName  = GetRandomName(_lastNames);

                ContactInfoProvider.SetContactInfo(new ContactInfo
                {
                    ContactFirstName = firstname,
                    ContactLastName  = lastName,
                    ContactEmail     = $"{firstname}.{lastName}@localhost{index}.{_emailAddressPostfix}"
                });
            }
        }
        private void GenerateToddRay()
        {
            var toddRay = GenerateContact("Todd", "Ray", "*****@*****.**", "(808)-289-4459");

            toddRay.ContactBirthday    = DateTime.Today.AddYears(-42);
            toddRay.ContactGender      = (int)UserGenderEnum.Male;
            toddRay.ContactMobilePhone = "+420123456789";

            toddRay.ContactCity        = "Brno";
            toddRay.ContactAddress1    = "Benesova 13";
            toddRay.ContactZIP         = "612 00";
            toddRay.ContactCompanyName = "Air Cafe";
            toddRay.ContactCountryID   = CountryInfoProvider.GetCountryInfo("CzechRepublic").CountryID;
            toddRay.ContactNotes       = "Should be involved in every communication with Air Cafe.";
            ContactInfoProvider.SetContactInfo(toddRay);
        }
Пример #16
0
    /// <summary>
    /// Creates temporary contact management - contact. Called when the "Create contact" button is pressed.
    /// </summary>
    private bool CreateTemporaryObjects()
    {
        // Create new contact object
        ContactInfo newContact = new ContactInfo()
        {
            ContactLastName    = "My New Contact",
            ContactFirstName   = "My New Firstname",
            ContactSiteID      = SiteContext.CurrentSiteID,
            ContactIsAnonymous = true
        };

        // Save the contact
        ContactInfoProvider.SetContactInfo(newContact);

        return(true);
    }
        private ContactInfo CreateContact(string fullName)
        {
            var words     = fullName.Trim().Split(' ');
            var firstName = words[0];
            var lastName  = words[1];

            var contact = new ContactInfo
            {
                ContactEmail     = $"{firstName.ToLowerInvariant()}@{lastName.ToLowerInvariant()}.local",
                ContactFirstName = firstName,
                ContactLastName  = lastName
            };

            ContactInfoProvider.SetContactInfo(contact);
            return(contact);
        }
        private void GenerateDustinEvans()
        {
            var dustinEvans = GenerateContact("Dustin", "Evans", "*****@*****.**", "(808)-139-4639");

            dustinEvans.ContactBirthday    = DateTime.Today.AddYears(-40);
            dustinEvans.ContactGender      = (int)UserGenderEnum.Male;
            dustinEvans.ContactJobTitle    = CEO_CONTACT_ROLE;
            dustinEvans.ContactMobilePhone = "+420123456789";
            dustinEvans.ContactNotes       = "Willing to participate in the partnership program - materials sent";

            dustinEvans.ContactCity        = "South Yarra";
            dustinEvans.ContactAddress1    = "163 Commercial Road";
            dustinEvans.ContactZIP         = "VIC 3141";
            dustinEvans.ContactCompanyName = "Jasper Coffee";
            dustinEvans.ContactCountryID   = CountryInfoProvider.GetCountryInfo("Australia").CountryID;
            dustinEvans.ContactNotes       = "Willing to participate in the partnership program - materials sent";
            ContactInfoProvider.SetContactInfo(dustinEvans);
        }
Пример #19
0
        private ContactInfo GenerateToddRay(int contactStatusId, int contactOwneruserId)
        {
            var contact = GenerateContact("Todd", "Ray", "*****@*****.**", "(808)-289-4459");

            contact.ContactBirthday    = DateTime.Today.AddYears(-42);
            contact.ContactGender      = 1;
            contact.ContactJobTitle    = OwnerContactRole;
            contact.ContactStatusID    = contactStatusId;
            contact.ContactMobilePhone = "+420123456789";
            contact.ContactCampaign    = ContactCampaign;
            contact.ContactOwnerUserID = contactOwneruserId;
            contact.ContactCity        = "Brno";
            contact.ContactAddress1    = "Benesova 13";
            contact.ContactZIP         = "612 00";
            contact.ContactCompanyName = "Air Cafe";
            contact.ContactCountryID   = CountryInfoProvider.GetCountryInfo("CzechRepublic").CountryID;
            contact.ContactNotes       = "Should be involved in every communication with Air Cafe.";
            ContactInfoProvider.SetContactInfo(contact);
            GeneratePageVisitActivity(_mPartnershipDocument, contact);
            CreateFormSubmission(_mPartnershipDocument, BusinessCustomerRegistationFormCodeName, contact);
            return(contact);
        }
        private void GenerateMonicaKing()
        {
            var monicaKing = GenerateContact("Monica", "King", "*****@*****.**", "(595)-721-1648");

            monicaKing.ContactBirthday    = DateTime.Today.AddYears(-35);
            monicaKing.ContactGender      = (int)UserGenderEnum.Female;
            monicaKing.ContactJobTitle    = BARISTA_CONTACT_ROLE;
            monicaKing.ContactMobilePhone = "+420123456789";

            monicaKing.ContactCity        = "Brno";
            monicaKing.ContactAddress1    = "New Market 187/5";
            monicaKing.ContactZIP         = "602 00";
            monicaKing.ContactCompanyName = "Air Cafe";
            monicaKing.ContactCountryID   = CountryInfoProvider.GetCountryInfo("CzechRepublic").CountryID;
            monicaKing.ContactNotes       = "Should be involved in every communication with Air Cafe.";
            ContactInfoProvider.SetContactInfo(monicaKing);

            GeneratePageVisitActivity(contactsDocument, monicaKing);
            GeneratePageVisitActivity(coffeeSamplesDocument, monicaKing);
            CreateFormSubmission(coffeeSamplesDocument, COFFEE_SAMPLE_LIST_FORM_CODE_NAME, monicaKing);
            CreateFormSubmission(contactsDocument, CONTACT_US_FORM_CODE_NAME, monicaKing);
            GeneratePurchaseActivity(20, monicaKing);
        }
Пример #21
0
        private ContactInfo GenerateMonicaKing(int contactStatusId, int contactOwneruserId)
        {
            var contact = GenerateContact("Monica", "King", "*****@*****.**", "(595)-721-1648");

            contact.ContactBirthday    = DateTime.Today.AddYears(-35);
            contact.ContactGender      = 2;
            contact.ContactJobTitle    = BaristaContactRole;
            contact.ContactStatusID    = contactStatusId;
            contact.ContactMobilePhone = "+420123456789";
            contact.ContactCampaign    = ContactCampaign;
            contact.ContactOwnerUserID = contactOwneruserId;
            contact.ContactCity        = "Brno";
            contact.ContactAddress1    = "New Market 187/5";
            contact.ContactZIP         = "602 00";
            contact.ContactCompanyName = "Air Cafe";
            contact.ContactCountryID   = CountryInfoProvider.GetCountryInfo("CzechRepublic").CountryID;
            contact.ContactNotes       = "Should be involved in every communication with Air Cafe.";
            ContactInfoProvider.SetContactInfo(contact);
            GeneratePageVisitActivity(_mPartnershipDocument, contact);
            CreateFormSubmission(_mPartnershipDocument, TryFreeSampleFormCodeName, contact);
            CreateFormSubmission(_mPartnershipDocument, ContactUsFormCodeName, contact);
            GeneratePurchaseActivity(20.0, contact);
            return(contact);
        }