Exemple #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="categoryId"></param>
        /// <param name="mailingListName"></param>
        /// <param name="useblackList"></param>
        /// <param name="mailingListLanguage"></param>
        /// <returns></returns>
        public int Create(string categoryId = null, string mailingListName = null, bool useblackList = true, string mailingListLanguage = "NL")
        {
            try
            {
                if (_create == null)
                {
                    var req = new CreateMailingListReq()
                    {
                        header = Client.RequestHeader
                    };

                    if (!string.IsNullOrWhiteSpace(categoryId))
                    {
                        req.categoryId = int.Parse(categoryId);
                    }

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

                    req.addUnsubscriptionsToBlacklist          = useblackList;
                    req.addUnsubscriptionsToBlacklistSpecified = true;

                    req.mailingListLanguage = mailingListLanguage;

                    _create = _client.API.CreateMailingList(req);
                }

                if (_create.errorCode == (int)errorCode.No_error)
                {
                    return(_create.mailingListId);
                }

                throw new FlexMailException(_create.errorMessage, _create.errorCode);
            }
            catch (Exception ex)
            {
                //telemetry.TrackException(ex, new Dictionary<string, string> { { "Flexmail", "MailingList.Create" } });
                if (ex is FlexMailException)
                {
                    throw (ex);
                }
            }
            finally
            {
                _create = null;
            }
            return(-1);
        }
Exemple #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;
                _mailingLists = null;
                _truncate     = null;
                _update       = null;

                disposedValue = true;
            }
        }