コード例 #1
0
        /// <summary>
        /// Add or updates a list of contacts in Bronto
        /// </summary>
        /// <param name="contact">The contacts to add or update</param>
        /// <returns>The result of the add or update operation <seealso cref="BrontoResult"/></returns>
        public BrontoResult AddOrUpdateIncremental(IEnumerable <contactObject> contacts)
        {
            using (BrontoSoapPortTypeClient client = BrontoSoapClient.Create(Timeout))
            {
                foreach (contactObject contact in contacts)
                {
                    var address = new stringValue {
                        value = contact.email
                    };

                    var emailAddressArray = new[] { address };

                    var filter = new contactFilter
                    {
                        email = emailAddressArray
                    };

                    var options = new readContacts()
                    {
                        includeLists          = true,
                        includeListsSpecified = true
                    };
                    var readResults     = Read(filter, options);
                    var existingContact = readResults.FirstOrDefault();

                    if (existingContact != null)
                    {
                        contact.listIds = contact.listIds.Concat(existingContact.listIds).ToArray();
                    }
                }
                writeResult response = client.addOrUpdateContacts(session.SessionHeader, contacts.ToArray());
                return(BrontoResult.Create(response));
            }
        }
コード例 #2
0
 public BrontoResult Add(IEnumerable <deliveryObject> deliveries)
 {
     using (BrontoSoapPortTypeClient client = BrontoSoapClient.Create(Timeout))
     {
         writeResult response = client.addDeliveries(session.SessionHeader, deliveries.ToArray());
         return(BrontoResult.Create(response));
     }
 }
コード例 #3
0
ファイル: MailLists.cs プロジェクト: willroscoe/BrontoSharp
 public BrontoResult Delete(IEnumerable <mailListObject> mailLists)
 {
     using (BrontoSoapPortTypeClient client = BrontoSoapClient.Create(Timeout))
     {
         writeResult response = client.deleteLists(session.SessionHeader, mailLists.ToArray());
         return(BrontoResult.Create(response));
     }
 }
コード例 #4
0
 /// <summary>
 /// Updates a list of contacts in Bronto
 /// </summary>
 /// <param name="contacts">the list of contacts to update</param>
 /// <returns>The result of the add operation <seealso cref="BrontoResult"/></returns>
 public BrontoResult Update(IEnumerable <contactObject> contacts)
 {
     using (BrontoSoapPortTypeClient client = BrontoSoapClient.Create(Timeout))
     {
         writeResult response = client.updateContacts(session.SessionHeader, contacts.ToArray());
         return(BrontoResult.Create(response));
     }
 }
コード例 #5
0
ファイル: MailLists.cs プロジェクト: willroscoe/BrontoSharp
        public async Task <BrontoResult> DeleteAsync(IEnumerable <mailListObject> mailLists)
        {
            using (BrontoSoapPortTypeClient client = BrontoSoapClient.Create(Timeout))
            {
                deleteListsResponse response = await client.deleteListsAsync(session.SessionHeader, mailLists.ToArray());

                return(BrontoResult.Create(response.@return));
            }
        }
コード例 #6
0
        /// <summary>
        /// Add or updates a list of contact in Bronto
        /// </summary>
        /// <param name="contact">The contacts to add or update</param>
        /// <returns>The result of the add or update operation <seealso cref="BrontoResult"/></returns>
        public async Task <BrontoResult> AddOrUpdateAsync(IEnumerable <contactObject> contacts)
        {
            using (BrontoSoapPortTypeClient client = BrontoSoapClient.Create(Timeout))
            {
                addOrUpdateContactsResponse response = await client.addOrUpdateContactsAsync(session.SessionHeader, contacts.ToArray());

                return(BrontoResult.Create(response.@return));
            }
        }
コード例 #7
0
 /// <summary>
 /// Adds a list of contacts to a mailing list
 /// </summary>
 /// <param name="list">the list to add</param>
 /// <param name="contacts">the list of contacts to add</param>
 /// <returns>The result of the addToList operation <seealso cref="BrontoResult"/></returns>
 public BrontoResult AddToList(mailListObject list, contactObject[] contacts)
 {
     using (BrontoSoapPortTypeClient client = BrontoSoapClient.Create(Timeout))
     {
         addToList addToList = new addToList()
         {
             list     = list,
             contacts = contacts
         };
         writeResult response = client.addToList(session.SessionHeader, addToList);
         return(BrontoResult.Create(response));
     }
 }