Ejemplo n.º 1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="mailingListId"></param>
        /// <param name="emailAddressTypeItems"></param>
        /// <param name="allowDuplicates"></param>
        /// <param name="overwrite"></param>
        /// <param name="synchronise"></param>
        /// <param name="referenceField"></param>
        /// <param name="allowBouncedOut"></param>
        /// <returns></returns>
        internal List <ImportEmailAddressRespType> Import(string mailingListId = null, EmailAddressType[] emailAddressTypeItems = null, bool allowDuplicates = false, bool overwrite = false, bool synchronise = false, ReferenceFieldType referenceField = ReferenceFieldType.email, bool allowBouncedOut = true)
        {
            try
            {
                if (_import == null)
                {
                    var req = new ImportEmailAddressesReq()
                    {
                        header = Client.RequestHeader
                    };

                    if (!string.IsNullOrWhiteSpace(mailingListId))
                    {
                        req.mailingListId = int.Parse(mailingListId);
                    }
                    req.mailingListIdSpecified = true;

                    if (emailAddressTypeItems != null)
                    {
                        req.emailAddressTypeItems = emailAddressTypeItems;
                    }

                    req.allowBouncedOut          = allowBouncedOut;
                    req.allowBouncedOutSpecified = true;
                    req.allowDuplicates          = allowDuplicates;
                    req.allowDuplicatesSpecified = true;
                    req.overwrite               = overwrite;
                    req.overwriteSpecified      = true;
                    req.synchronise             = synchronise;
                    req.synchroniseSpecified    = true;
                    req.referenceField          = referenceField;
                    req.referenceFieldSpecified = true;

                    _import = _client.API.ImportEmailAddresses(req);
                }

                if (_import.errorCode == (int)errorCode.No_error)
                {
                    return(_import.importEmailAddressRespTypeItems.ToList <ImportEmailAddressRespType>());
                }

                throw new FlexMailException(_import.errorMessage, _import.errorCode);
            }
            catch (Exception ex)
            {
                //telemetry.TrackException(ex, new Dictionary<string, string> { { "Flexmail", "EmailAddress.Import" } });
                if (ex is FlexMailException)
                {
                    throw (ex);
                }
            }
            finally
            {
                _import = null;
            }
            return(new List <ImportEmailAddressRespType>());
        }
Ejemplo n.º 2
0
        private bool disposedValue = false; // To detect redundant calls



        /// <summary>
        ///
        /// </summary>
        /// <param name="disposing"></param>
        protected virtual void Dispose(bool disposing)
        {
            if (!disposedValue)
            {
                if (disposing)
                {
                }

                _create         = null;
                _delete         = null;
                _emailaddresses = null;
                _update         = null;
                _history        = null;
                _import         = null;

                disposedValue = true;
            }
        }