示例#1
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)
                {
                }

                _campaigns    = null;
                _delete       = null;
                _history      = null;
                _report       = null;
                _summary      = null;
                disposedValue = true;
            }
        }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="campaignId"></param>
        /// <param name="sort"></param>
        /// <param name="timestampFrom"></param>
        /// <param name="timestampTill"></param>
        /// <param name="campaignHistoryOptionsType"></param>
        /// <returns></returns>
        public CampaignHistoryType History(string campaignId = null, string sort = null, string timestampFrom = null, string timestampTill = null, CampaignHistoryOptionsType campaignHistoryOptionsType = null)
        {
            try
            {
                if (_history == null)
                {
                    var req = new GetCampaignHistoryReq()
                    {
                        header = Client.RequestHeader
                    };

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

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

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

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

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

                    _history = _client.API.GetCampaignHistory(req);
                }

                if (_history != null && _history.errorCode == (int)errorCode.No_error)
                {
                    return(_history.campaignHistoryType);
                }
                else
                if (_history != null)
                {
                    throw new FlexMailException(FlexMail.Resources.Campaign.ResourceManager.GetString("History_" + _history.errorCode), _history.errorCode);
                }

                throw new FlexMailException(FlexMail.Resources.Blacklist.ResourceManager.GetString("History_" + _history.errorCode), _history.errorCode);
            }
            catch (Exception ex)
            {
                //telemetry.TrackException(ex, new Dictionary<string, string> { { "Flexmail", "Campaign.History" } });
                if (ex is FlexMailException)
                {
                    throw (ex);
                }
            }
            finally
            {
                _history = null;
            }
            return(new CampaignHistoryType());
        }