Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="campaignId"></param>
        /// <param name="mailingListId"></param>
        /// <param name="timestampSince"></param>
        /// <returns></returns>
        public async Task <List <BounceType> > BouncesAsync(string campaignId = null, string mailingListId = null, string timestampSince = null)
        {
            try
            {
                if (_bounces == null)
                {
                    var req = new GetBouncesReq()
                    {
                        header = Client.RequestHeader
                    };

                    if (!string.IsNullOrWhiteSpace(campaignId))
                    {
                        req.campaignId = int.Parse(campaignId);
                    }
                    req.campaignIdSpecified = true;

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

                    if (!string.IsNullOrWhiteSpace(timestampSince))
                    {
                        req.timestampSince = timestampSince;
                    }

                    GetBouncesResponse response = await _client.API.GetBouncesAsync(req);

                    _bounces = response.GetBouncesResp;
                }

                if (_bounces.errorCode == (int)errorCode.No_error)
                {
                    return(_bounces.bounceTypeItems.ToList <BounceType>());
                }

                throw new FlexMailException(_bounces.errorMessage, _bounces.errorCode);
            }
            catch (Exception ex)
            {
                ////telemetry.TrackException(ex, new Dictionary<string, string> { { "Flexmail", "Account.Bounces" } });
                if (ex is FlexMailException)
                {
                    throw (ex);
                }
            }
            finally
            {
                _bounces = null;
            }
            return(new List <BounceType>());
        }
Пример #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)
                {
                }

                _balance         = null;
                _bounces         = null;
                _profileUpdates  = null;
                _subscriptions   = null;
                _unsubscriptions = null;

                disposedValue = true;
            }
        }