Example #1
0
        static void Main(string[] args)
        {
            var manager = new GenericSubscriptionManager <string>();

            const int iterationCount = 2;

            var tagList = new HashSet <Tag>()
            {
                "2018", "java"
            };
            var subscriber = new GenericSubscriber <string>($"subscriber 1", tagList);

            manager.AddSubscriber(subscriber);

            var tagList2 = new HashSet <Tag>()
            {
                "2018", "путин", "splunk"
            };
            var subscriber2 = new GenericSubscriber <string>($"subscriber 2", tagList2);

            manager.AddSubscriber(subscriber2);

            var tagList3 = new HashSet <Tag>()
            {
                "путин", "утечка памяти", "linux kernel"
            };
            var subscriber3 = new GenericSubscriber <string>($"subscriber 3", tagList3);

            manager.AddSubscriber(subscriber3);

            var publisher = new InFilePublisher();

            manager.AddPublisher(publisher);
            //publisher.Create("input1.txt");

            var habrPublisher = new HabraHabrPublisher();

            manager.AddPublisher(habrPublisher);
            //habrPublisher.CreateRandom();
            habrPublisher.CreateFrom("https://habr.com/company/piter/blog/354532/");
            habrPublisher.CreateFrom("https://habr.com/company/spbau/blog/224589/");


            Console.ReadKey();
        }
Example #2
0
        private static string Create_TBN_Generic_Against_EI_API(string emailAddress, string body01, string body02)
        {
            var newSubscriber = new GenericSubscriber();

            newSubscriber.EmailAddress = emailAddress;

            // addition of custom attributes
            newSubscriber.Attributes = new AzureTBNClientSDK.AzureServiceReference.Attribute[2];
            var attribute = new AzureTBNClientSDK.AzureServiceReference.Attribute();

            attribute.Name              = "Param001";
            attribute.Value             = body01;
            newSubscriber.Attributes[0] = attribute;

            attribute                   = new AzureTBNClientSDK.AzureServiceReference.Attribute();
            attribute.Name              = "Param002";
            attribute.Value             = body02;
            newSubscriber.Attributes[1] = attribute;

            /* Creating a new request*/
            TriggeredRequestBase request = new TriggeredRequestBase();

            request.ApplicationName = "Generic";
            request.CustomerKey     = "AAD_Dashboard_Triggered_Send_001";

            request.DeliveryType      = EmailType.Html;
            request.TriggerDataSource = TriggerDataSource.None;
            request.TriggerType       = TriggeredSendType.NoDelay;

            request.Subscribers = new GenericSubscriber[1];
            // NOTE : the above can be changed to any other type of collection
            // by configuring the service reference to use
            // other collection types like List, Collection, ArrayList, etc
            request.Subscribers[0] = newSubscriber;

            EmailInterchangeResult results = EmailInterchangeResult.None;

            /*Instantiating the Proxy Class*/
            AzureTBNClientSDK.InterchangeConnect client = new AzureTBNClientSDK.InterchangeConnect();
            results = client.Send(request);

            return(results.ToString());
        }
Example #3
0
        private static bool SendTriggeredWelcomeEmail(string address)
        {
            if (address == null)
            {
                return(false);
            }

            // Create the subscriber
            GenericSubscriber newSubscriber = new GenericSubscriber();

            newSubscriber.EmailAddress = address;
            // Create the request
            TriggeredRequestBase request = new TriggeredRequestBase();

            request.ApplicationName   = "ResearchNews";
            request.CommunicationId   = 12345;
            request.DeliveryType      = EmailType.Html;
            request.TriggerDataSource = TriggerDataSource.None;
            request.TriggerType       = TriggeredSendType.NoDelay;
            request.Subscribers       = new GenericSubscriber[1];
            request.Subscribers[0]    = newSubscriber;

            EmailInterchangeResult result = EmailInterchangeResult.None;

            try
            {
                AzureTBNClientSDK.InterchangeConnect client = new AzureTBNClientSDK.InterchangeConnect();
                result = client.Send(request);

                return((result != EmailInterchangeResult.Success) ? false : true);
            }
            catch (Exception ex)
            {
                Console.WriteLine("An error occured sending the welcome email. " + ex);
            }

            return(false);
        }