Ejemplo n.º 1
0
        static void KeywordUpdateRange(T70Context context)
        {
            var keywordRepo = context.Repository <Keyword>(new { AccountId = ACCOUNT_ID, ChannelId = CHANNEL_ID });

            // TODO: Remove hard coded ID values!
            var keywordList = new List <Keyword>
            {
                new Keyword()
                {
                    Id = 0, Name = "Keyword_SDK_Test_update by add range"
                },
                new Keyword()
                {
                    Id = 0, Name = "Keyword_SDK_Test_update by add range"
                }
            };

            keywordRepo.UpdateRange(keywordList);

            foreach (Keyword aKeyword in keywordList)
            {
                Console.WriteLine("Update contact {0}: {1}", aKeyword.Id, aKeyword.Name);
                Console.WriteLine();
            }
        }
Ejemplo n.º 2
0
        static void ContactUpdateRangeExample(T70Context context)
        {
            var contactRepo = context.Repository <Contact>(new { AccountId = ACCOUNT_ID });

            // TODO: Remove hard coded phone numbers and contact IDs
            var contactList = new List <Contact>
            {
                new Contact()
                {
                    Id = 0, PhoneNumber = "+1", Email = ""
                },
                new Contact()
                {
                    Id = 0, PhoneNumber = "+1", Email = ""
                }
            };

            contactRepo.UpdateRange(contactList);

            foreach (Contact aContact in contactList)
            {
                Console.WriteLine("Update contact {0}: {1}", aContact.Id, aContact.PhoneNumber);
                Console.WriteLine();
            }
        }
Ejemplo n.º 3
0
        private static Keyword AttachKeyword(T70Context context)
        {
            var keywordRepo = context.Repository <Keyword>(new
            {
                AccountId = ACCOUNT_ID,
                ChannelId = CHANNEL_ID
            });

            var keyword = keywordRepo.Get(KEYWORD_ID);

            if (keyword.CampaignId.HasValue)
            {
                if (keyword.CampaignId == CAMPAIGN_ID)
                {
                    Console.WriteLine("Keyword {0} already attached to campaign {1}", keyword.Id, CAMPAIGN_ID);
                    return(keyword);
                }

                Console.WriteLine(
                    "NOTICE: Keyword {0} is already attached to campaign {1}, this will get changed.",
                    keyword.Id,
                    keyword.CampaignId);
            }

            context.AttachKeywordTo(keyword, CAMPAIGN_ID);

            return(keyword);
        }
Ejemplo n.º 4
0
        private const int KEYWORD_ID = 0; // TODO: Fill in with your keyword ID

        #endregion Fields

        #region Methods

        private static Keyword AttachKeyword(T70Context context)
        {
            var keywordRepo = context.Repository<Keyword>(new
            {
                AccountId = ACCOUNT_ID,
                ChannelId = CHANNEL_ID
            });

            var keyword = keywordRepo.Get(KEYWORD_ID);

            if (keyword.CampaignId.HasValue)
            {
                if (keyword.CampaignId == CAMPAIGN_ID)
                {
                    Console.WriteLine("Keyword {0} already attached to campaign {1}", keyword.Id, CAMPAIGN_ID);
                    return keyword;
                }

                Console.WriteLine(
                    "NOTICE: Keyword {0} is already attached to campaign {1}, this will get changed.",
                    keyword.Id,
                    keyword.CampaignId);
            }

            context.AttachKeywordTo(keyword, CAMPAIGN_ID);

            return keyword;
        }
Ejemplo n.º 5
0
        [Test]//Get details of created account
        public void C_AccountGet()
        {
            var context     = new T70Context();
            var accountRepo = context.Repository <Account>(new { ParentId = PARENT_ID });

            accountRepo.Get(LookupTable.AccountId);
        }
Ejemplo n.º 6
0
        static void ContactDeleteAllExample(T70Context context)
        {
            var contactRepo = context.Repository <Contact>(new { AccountId = ACCOUNT_ID });

            contactRepo.DeleteAll(contactRepo.GetAll().ToList());

            Console.WriteLine("Delete all contact successfully");
        }
Ejemplo n.º 7
0
        static void KeywordDeleteAll(T70Context context)
        {
            var keywordRepo = context.Repository <Keyword>(new { AccountId = ACCOUNT_ID, ChannelId = CHANNEL_ID });

            keywordRepo.DeleteAll(keywordRepo.GetAll().ToList());

            Console.WriteLine("Delete all keyword successfully");
        }
Ejemplo n.º 8
0
        private static Campaign CampaignSetup(T70Context context)
        {
            /*
             * NOTE: A campaign only needs to be setup once.
             *
             * After the initial setup you can send that campaign as many times as you would like.
             */
            var contentRepo = context.Repository <Content>(new { AccountId = ACCOUNT_ID });

            var content = new Content
            {
                Name = "SDK Test Content"
            };

            contentRepo.Add(content);

            var templateRepo =
                context.Repository <ContentTemplate>(new { AccountId = ACCOUNT_ID, ContentId = content.Id });

            var template = new ContentTemplate
            {
                LanguageType = LanguageType.English,
                ChannelType  = ChannelType.Sms,
                EncodingType = EncodingType.Text,
                Template     = "Hi there from our demo!"
            };

            templateRepo.Add(template);

            var sub = GetSubscription(context);

            var campaign = new Campaign
            {
                Name           = "SDK Test Campaign",
                SubscriptionId = sub.Id,
                CampaignType   = CampaignType.Basic,
                ContentId      = content.Id
            };

            var campaignRepo = context.Repository <Campaign>(new { AccountId = ACCOUNT_ID });

            campaignRepo.Add(campaign);

            return(campaign);
        }
Ejemplo n.º 9
0
        static void DetailsExample(T70Context context)
        {
            var accountRepo = context.Repository <Account>(new { ParentId = PARENT_ID });

            var account = accountRepo.Get(ACCOUNT_ID);

            ShowAccountDetails(account);
            Console.WriteLine();
        }
Ejemplo n.º 10
0
        static void DetailsExample(T70Context context)
        {
            var accountRepo = context.Repository<Account>(new { ParentId = PARENT_ID });

            var account = accountRepo.Get(ACCOUNT_ID);

            ShowAccountDetails(account);
            Console.WriteLine();
        }
Ejemplo n.º 11
0
        static void KeywordDetails(T70Context context)
        {
            var keywordRepo = context.Repository <Keyword>(new { AccountId = ACCOUNT_ID, ChannelId = CHANNEL_ID });

            var keyword = keywordRepo.Get(KEYWORD_ID);

            Console.WriteLine("Got Keyword:");
            DisplayKeyword(keyword);
        }
Ejemplo n.º 12
0
        static void ContactDetailsExample(T70Context context)
        {
            var contactRepo = context.Repository <Contact>(new { AccountId = ACCOUNT_ID });

            var contact = contactRepo.Get(CONTACT_ID);

            Console.WriteLine("Got contact:");
            DisplayContact(contact);
        }
Ejemplo n.º 13
0
        private const int ACCOUNT_ID = 0; // TODO: Fill in with your account ID

        #endregion Fields

        #region Methods

        private static Campaign CampaignSetup(T70Context context)
        {
            /*
             * NOTE: A campaign only needs to be setup once.
             *
             * After the initial setup you can send that campaign as many times as you would like.
             */
            var contentRepo = context.Repository<Content>(new { AccountId = ACCOUNT_ID });

            var content = new Content
            {
                Name = "SDK Test Content",
            };

            contentRepo.Add(content);

            var templateRepo = context.Repository<ContentTemplate>(new { AccountId = ACCOUNT_ID, ContentId = content.Id });

            var template = new ContentTemplate
            {
                LanguageType = LanguageType.English,
                ChannelType = ChannelType.Sms,
                EncodingType = EncodingType.Text,
                Template = "Hi there from our demo!"
            };

            templateRepo.Add(template);

            var campaign = new Campaign
            {
                Name = "SDK Test Campaign",
                SubscriptionId = 183,
                CampaignType = CampaignType.Basic,
                ContentId = content.Id
            };

            var campaignRepo = context.Repository<Campaign>(new { AccountId = ACCOUNT_ID });

            campaignRepo.Add(campaign);

            return campaign;
        }
Ejemplo n.º 14
0
        [Test]//Delete account
        public void G_AccountDelete()
        {
            var context     = new T70Context();
            var accountRepo = context.Repository <Account>(new { ParentId = PARENT_ID });
            var account     = new Account
            {
                Id = LookupTable.AccountId
            };

            accountRepo.Delete(account);
        }
Ejemplo n.º 15
0
        static void GetAllContactDetailsExample(T70Context context)
        {
            var contactRepo = context.Repository <Contact>(new { AccountId = ACCOUNT_ID });

            List <Contact> contactlist = (contactRepo.GetAll()).ToList();

            foreach (Contact contact in contactlist)
            {
                DisplayContact(contact);
            }
        }
Ejemplo n.º 16
0
        static void KeywordGetAll(T70Context context)
        {
            var keywordRepo = context.Repository <Keyword>(new { AccountId = ACCOUNT_ID, ChannelId = CHANNEL_ID });

            List <Keyword> keywordlist = (keywordRepo.GetAll()).ToList();

            foreach (var keyword in keywordlist)
            {
                DisplayKeyword(keyword);
            }
        }
Ejemplo n.º 17
0
        static void GetAllExample(T70Context context)
        {
            var accountRepo = context.Repository<Account>(new { ParentId = PARENT_ID });

            List<Account> contactlist = (accountRepo.GetAll()).ToList();

            foreach (Account account in contactlist)
            {
                ShowAccountDetails(account);
                Console.WriteLine();
            }
        }
Ejemplo n.º 18
0
        static void GetAllExample(T70Context context)
        {
            var accountRepo = context.Repository <Account>(new { ParentId = PARENT_ID });

            List <Account> contactlist = (accountRepo.GetAll()).ToList();

            foreach (Account account in contactlist)
            {
                ShowAccountDetails(account);
                Console.WriteLine();
            }
        }
Ejemplo n.º 19
0
        private const int CONTENT_ID = 0; // TODO: Fill in with an existing contact ID

        #endregion Fields

        #region Methods

        static void ContactDeleteExample(T70Context context)
        {
            var contentRepo = context.Repository<Content>(new { AccountId = ACCOUNT_ID });

            var content = new Content
            {
                Id = CONTENT_ID
            };

            contentRepo.Delete(content);
            Console.WriteLine("Content deleted successfully");
        }
Ejemplo n.º 20
0
        static void ContactDeleteExample(T70Context context)
        {
            var contentRepo = context.Repository <Content>(new { AccountId = ACCOUNT_ID });

            var content = new Content
            {
                Id = CONTENT_ID
            };

            contentRepo.Delete(content);
            Console.WriteLine("Content deleted successfully");
        }
Ejemplo n.º 21
0
        private static Content CreateContent(T70Context context)
        {
            /*
             * Content provides a grouping mechanisim that can be used to
             * hold multiple translations for a signel campaign.
             */
            var contentRepo = context.Repository <Content>(new { AccountId = ACCOUNT_ID });

            var content = new Content
            {
                Name = "SDK Test Content",
            };

            contentRepo.Add(content);

            var templateRepo = context.Repository <ContentTemplate>(new { AccountId = ACCOUNT_ID, ContentId = content.Id });

            var template = new ContentTemplate
            {
                LanguageType = LanguageType.English,
                ChannelType  = ChannelType.Sms,
                EncodingType = EncodingType.Text,
                Template     = "Hi there from our demo!"
            };

            templateRepo.Add(template);

            // Also provide a French translation (not required)
            template = new ContentTemplate
            {
                LanguageType = LanguageType.French,
                ChannelType  = ChannelType.Sms,
                EncodingType = EncodingType.Text,
                Template     = "Bonjour!"
            };

            templateRepo.Add(template);

            return(content);
        }
Ejemplo n.º 22
0
        private static Content CreateContent(T70Context context)
        {
            /*
             * Content provides a grouping mechanism that can be used to
             * hold multiple translations for a single campaign.
             */
            var contentRepo = context.Repository<Content>(new {AccountId = ACCOUNT_ID});

            var content = new Content
            {
                Name = "SDK Test Content",
            };

            contentRepo.Add(content);

            var templateRepo = context.Repository<ContentTemplate>(new {AccountId = ACCOUNT_ID, ContentId = content.Id});

            var template = new ContentTemplate
            {
                LanguageType = LanguageType.English,
                ChannelType = ChannelType.Sms,
                EncodingType = EncodingType.Text,
                Template = "Hi there from our demo!"
            };

            templateRepo.Add(template);

            // Also provide a French translation (not required)
            template = new ContentTemplate
            {
                LanguageType = LanguageType.French,
                ChannelType = ChannelType.Sms,
                EncodingType = EncodingType.Text,
                Template = "Bonjour!"
            };

            templateRepo.Add(template);

            return content;
        }
Ejemplo n.º 23
0
        [Test]//Update account
        public void E_AccountUpdate()
        {
            var context     = new T70Context();
            var accountRepo = context.Repository <Account>(new { ParentId = PARENT_ID });

            var account = new Account
            {
                Id   = LookupTable.AccountId,
                Name = RanGen.Str
            };

            accountRepo.Update(account);
        }
Ejemplo n.º 24
0
        static void CreateAccountExample(T70Context context)
        {
            var accountRepo = context.Repository <Account>();

            var account = new Account
            {
                ParentId = PARENT_ID,
                Name     = string.Format("APISDK_Test_{0}", Guid.NewGuid())
            };

            accountRepo.Add(account);
            Console.WriteLine("Added account {0}: {1}", account.Id, account.Name);
        }
Ejemplo n.º 25
0
        static void ContentDetails(T70Context context)
        {
            var contentRepo = context.Repository<Content>(new { AccountId = ACCOUNT_ID });

            var content = contentRepo.Get(CONTENT_ID);

            Console.WriteLine("Id: {0}", content.Id);
            Console.WriteLine("AccountId: {0}", content.AccountId);
            Console.WriteLine("Name: {0}", content.Name);
            Console.WriteLine("Description: {0}", content.Description);
            Console.WriteLine("Created: {0}", content.Created);
            Console.WriteLine("Modified: {0}", content.Modified);
        }
Ejemplo n.º 26
0
        static void CreateAccountExample(T70Context context)
        {
            var accountRepo = context.Repository <Account>(new { });

            var account = new Account
            {
                ParentId = PARENT_ID,
                Name     = "TestSubAccount"
            };

            accountRepo.Add(account);
            Console.WriteLine("Added account {0}: {1}", account.Id, account.Name);
        }
Ejemplo n.º 27
0
        static void CreateAccountExample(T70Context context)
        {
            var accountRepo = context.Repository<Account>(new { });

            var account = new Account
            {
                ParentId = PARENT_ID,
                Name = "TestSubAccount"
            };

            accountRepo.Add(account);
            Console.WriteLine("Added account {0}: {1}", account.Id, account.Name);
        }
Ejemplo n.º 28
0
        static void Createkeyword(T70Context context)
        {
            var keywordRepo = context.Repository <Keyword>(new { AccountId = ACCOUNT_ID, ChannelId = CHANNEL_ID });

            var keyword = new Keyword
            {
                Name             = "Keyword_SDK_Test1",
                CallbackRequired = false
            };

            keywordRepo.Add(keyword);
            Console.WriteLine("Added Keyword {0}: {1}", keyword.Id, keyword.Name);
        }
Ejemplo n.º 29
0
        static void ContentDetails(T70Context context)
        {
            var contentRepo = context.Repository <Content>(new { AccountId = ACCOUNT_ID });

            var content = contentRepo.Get(CONTENT_ID);

            Console.WriteLine("Id: {0}", content.Id);
            Console.WriteLine("AccountId: {0}", content.AccountId);
            Console.WriteLine("Name: {0}", content.Name);
            Console.WriteLine("Description: {0}", content.Description);
            Console.WriteLine("Created: {0}", content.Created);
            Console.WriteLine("Modified: {0}", content.Modified);
        }
Ejemplo n.º 30
0
        static void Createkeyword(T70Context context)
        {
            var keywordRepo = context.Repository<Keyword>(new { AccountId = ACCOUNT_ID, ChannelId = CHANNEL_ID });

            var keyword = new Keyword
            {
                Name = "Keyword_SDK_Test1",
                CallbackRequired = false
            };

            keywordRepo.Add(keyword);
            Console.WriteLine("Added Keyword {0}: {1}", keyword.Id, keyword.Name);
        }
Ejemplo n.º 31
0
        static void CreateContent(T70Context context)
        {
            var contentRepo = context.Repository <Content>(new { AccountId = ACCOUNT_ID });

            var content = new Content
            {
                Name        = "SDK_Test_Content190",
                Description = "Content 190 for test .net SDK by Ravi"
            };

            contentRepo.Add(content);
            Console.WriteLine("Added content {0}: {1}", content.Id, content.Name);
        }
Ejemplo n.º 32
0
        public void B_AccountAddRange()
        {
            var context = new T70Context();
            var accountRepo = context.Repository<Account>(new { });
            var accountList = new List<Account>
            {
                new Account { ParentId = PARENT_ID, Name = RanGen.Str },
                new Account { ParentId = PARENT_ID, Name = RanGen.Str }
            };

            accountRepo.AddRange(accountList);
            s_subSubAccount1 = accountList[0].Id;
            s_subSubAccount2 = accountList[1].Id;
        }
Ejemplo n.º 33
0
        static void ContactCreateExample(T70Context context)
        {
            var contactRepo = context.Repository <Contact>(new { AccountId = ACCOUNT_ID });

            var contact = new Contact
            {
                PhoneNumber = PHONE_NUMBER,
                Email       = EMAIL_ADDRESS
            };

            contactRepo.Add(contact);

            Console.WriteLine("Added contact:");
            DisplayContact(contact);
        }
Ejemplo n.º 34
0
        static void KeywordUpdate(T70Context context)
        {
            var keywordRepo = context.Repository <Keyword>(new { AccountId = ACCOUNT_ID, ChannelId = CHANNEL_ID });
            var keyword     = new Keyword
            {
                Id = KEYWORD_ID,
                CallbackRequired = true
            };

            keywordRepo.Update(keyword);
            var updateKeyword = keywordRepo.Get(KEYWORD_ID);

            Console.WriteLine("Updated Keyword:");
            DisplayKeyword(updateKeyword);
        }
Ejemplo n.º 35
0
        static void KeywordDelete(T70Context context)
        {
            var keywordRepo = context.Repository <Keyword>(new { AccountId = ACCOUNT_ID, ChannelId = CHANNEL_ID });

            var keyword = new Keyword
            {
                Id = KEYWORD_ID
            };

            keywordRepo.Delete(keyword);
            var deletekeyword = keywordRepo.Get(KEYWORD_ID);

            Console.WriteLine("Deleted Keyword");
            DisplayKeyword(keyword);
        }
Ejemplo n.º 36
0
        private static Subscription GetSubscription(T70Context context)
        {
            /*
             * The subscription provides a way for a contact to opt into or out of a group of campaigns.
             *
             * You might for example have one subscription for promotions related events and another for
             * contests.
             */
            var subRepo = context.Repository <Subscription>(new { AccountId = ACCOUNT_ID });

            //You dont have to create a subscription, a Default subscription is already created when the account is created
            var sub = subRepo.GetAll().FirstOrDefault(x => x.IsDefault && x.AccountId == ACCOUNT_ID);

            return(sub);
        }
Ejemplo n.º 37
0
        static void UpdateAccountExample(T70Context context)
        {
            var accountRepo = context.Repository <Account>(new { ParentId = PARENT_ID });

            var account = new Account
            {
                Id   = ACCOUNT_ID,
                Name = "UpdatedTestAccount"
            };

            accountRepo.Update(account);
            var updateAccount = accountRepo.Get(ACCOUNT_ID);

            ShowAccountDetails(updateAccount);
            Console.WriteLine();
        }
Ejemplo n.º 38
0
        static void ContactDeleteExample(T70Context context)
        {
            var contactRepo = context.Repository <Contact>(new { AccountId = ACCOUNT_ID });

            var contact = new Contact
            {
                Id = CONTACT_ID
            };

            contactRepo.Delete(contact);

            var deleteContact = contactRepo.Get(CONTACT_ID);

            Console.WriteLine("Deleted Contact:");
            DisplayContact(contact);
        }
Ejemplo n.º 39
0
        static void ContactUpdateExample(T70Context context)
        {
            var contactRepo = context.Repository <Contact>(new { AccountId = ACCOUNT_ID });

            var contact = new Contact
            {
                Id          = CONTACT_ID,
                PhoneNumber = PHONE_NUMBER,
                Email       = EMAIL_ADDRESS
            };

            contactRepo.Update(contact);
            var updateContact = contactRepo.Get(CONTACT_ID);

            Console.WriteLine("Updated contact:");
            DisplayContact(updateContact);
        }
Ejemplo n.º 40
0
        static void ContentGetAll(T70Context context)
        {
            var contentRepo = context.Repository<Content>(new { AccountId = ACCOUNT_ID });

            List<Content> contentlist = (contentRepo.GetAll()).ToList();

            foreach (Content content in contentlist)
            {
                Console.WriteLine("Id: {0}", content.Id);
                Console.WriteLine("AccountId: {0}", content.AccountId);
                Console.WriteLine("Name: {0}", content.Name);
                Console.WriteLine("Description: {0}", content.Description);
                Console.WriteLine("Created: {0}", content.Created);
                Console.WriteLine("Modified: {0}", content.Modified);
                Console.WriteLine();
            }
        }
Ejemplo n.º 41
0
        static void ContentGetAll(T70Context context)
        {
            var contentRepo = context.Repository <Content>(new { AccountId = ACCOUNT_ID });

            List <Content> contentlist = (contentRepo.GetAll()).ToList();

            foreach (Content content in contentlist)
            {
                Console.WriteLine("Id: {0}", content.Id);
                Console.WriteLine("AccountId: {0}", content.AccountId);
                Console.WriteLine("Name: {0}", content.Name);
                Console.WriteLine("Description: {0}", content.Description);
                Console.WriteLine("Created: {0}", content.Created);
                Console.WriteLine("Modified: {0}", content.Modified);
                Console.WriteLine();
            }
        }
Ejemplo n.º 42
0
        static void ContentAddRange(T70Context context)
        {
            var contentRepo = context.Repository<Content>(new { AccountId = ACCOUNT_ID });

            var contentList = new List<Content>
            {
                new Content { Name = "SDK_Test_Content2", Description = "Content 2 for test .net SDK." },
                new Content { Name = "SDK_Test_Content3", Description = "Content 3 for test .net SDK." }
            };

            contentRepo.AddRange(contentList);

            foreach (Content aContent in contentList)
            {
                Console.WriteLine("Added content {0}: {1}", aContent.Id, aContent.Name);
                Console.WriteLine();
            }
        }
Ejemplo n.º 43
0
        private static Keyword KeywordSetup(T70Context context)
        {
            /*
             * NOTE: You only need to create a keyword once.
             *
             * After it is created you can attach and detach campaigns from it as needed.
             */
            var keyword = new Keyword
            {
                Name = KEYWORD_NAME
            };

            var keywordRepo = context.Repository<Keyword>(new {AccountId = ACCOUNT_ID, ChannelId = CHANNEL_ID});

            keywordRepo.Add(keyword);

            return keyword;
        }
Ejemplo n.º 44
0
        static void Main(string[] args)
        {
            // Uncomment out the following line to see more details about what is going on during execution.
            //InitLogging();

            // User name and password are pulled from App.config by default.
            // (For web applications this will be Web.config)
            var context = new T70Context();

            var eventPushRepo = context.Repository<EventPushCampaign>(new {AccountId = ACCOUNT_ID});

            PushCampaignExample(eventPushRepo);

            //GetPushEventExample(eventPushRepo);

            Console.WriteLine();
            Console.WriteLine("Done, press a key to quit.");
            Console.ReadKey();
        }
Ejemplo n.º 45
0
        private static Campaign CampaignSetup(T70Context context)
        {
            var content = CreateContent(context);

            var sub = CreateSubscription(context);

            var campaign = new Campaign
            {
                Name = "SDK Test Campaign",
                SubscriptionId = sub.Id,
                CampaignType = CampaignType.Basic,
                ContentId = content.Id
            };

            var campaignRepo = context.Repository<Campaign>(new { AccountId = ACCOUNT_ID });

            campaignRepo.Add(campaign);

            return campaign;
        }
Ejemplo n.º 46
0
        public void A_AccountAdd()
        {
            var context = new T70Context();
            var accountRepo = context.Repository<Account>(new { });

            var account = new Account
            {
                ParentId = PARENT_ID,
                Name = RanGen.Str
            };
            accountRepo.Add(account);
            LookupTable.AccountId = account.Id;

            //try
            //{
            //    accountRepo.Add(account);
            //    Assert.IsInstanceOf(typeof(Account), account);
            //}
            //catch
            //{
            //    Assert.Fail("Test failed. Can't create Account");
            //}
        }
Ejemplo n.º 47
0
        static void ContentUpdate(T70Context context)
        {
            var contentRepo = context.Repository<Content>(new { AccountId = ACCOUNT_ID });

            var content = new Content
            {
                Id = CONTENT_ID,
                Name = "SDK_Test_Content3",
                Description = "Content 3 for test .net SDK."
            };

            contentRepo.Update(content);
            var updateContent = contentRepo.Get(CONTENT_ID);

            Console.WriteLine("Id: {0}", updateContent.Id);
            Console.WriteLine("AccountId: {0}", updateContent.AccountId);
            Console.WriteLine("Name: {0}", updateContent.Name);
            Console.WriteLine("Description: {0}", updateContent.Description);
            Console.WriteLine("Created: {0}", updateContent.Created);
            Console.WriteLine("Modified: {0}", updateContent.Modified);
            Console.WriteLine();
            Console.WriteLine("Content updated successfully");
        }
Ejemplo n.º 48
0
        static void CreateContent(T70Context context)
        {
            var contentRepo = context.Repository<Content>(new { AccountId = ACCOUNT_ID });

            var content = new Content
            {
                Name = "SDK_Test_Content190",
                Description = "Content 190 for test .net SDK by Ravi"
            };

            contentRepo.Add(content);
            Console.WriteLine("Added content {0}: {1}", content.Id, content.Name);
        }
Ejemplo n.º 49
0
        static void KeywordUpdate(T70Context context)
        {
            var keywordRepo = context.Repository<Keyword>(new { AccountId = ACCOUNT_ID, ChannelId = CHANNEL_ID });
            var keyword = new Keyword
            {
                Id = KEYWORD_ID,
                CallbackRequired = true
            };

            keywordRepo.Update(keyword);
            var updateKeyword = keywordRepo.Get(KEYWORD_ID);

            Console.WriteLine("Updated Keyword:");
            DisplayKeyword(updateKeyword);
        }
Ejemplo n.º 50
0
        static void KeywordUpdateRange(T70Context context)
        {
            var keywordRepo = context.Repository<Keyword>(new { AccountId = ACCOUNT_ID, ChannelId = CHANNEL_ID });

            // TODO: Remove hard coded ID values!
            var keywordList = new List<Keyword>
            {
                new Keyword() { Id = 0, Name = "Keyword_SDK_Test_update by add range" },
                new Keyword() { Id = 0, Name = "Keyword_SDK_Test_update by add range" }
            };

            keywordRepo.UpdateRange(keywordList);

            foreach (Keyword aKeyword in keywordList)
            {
                Console.WriteLine("Update contact {0}: {1}", aKeyword.Id, aKeyword.Name);
                Console.WriteLine();
            }
        }
Ejemplo n.º 51
0
        private static void ContentUpdateRange(T70Context context)
        {
            var contentRepo = context.Repository<Content>(new {AccountId = ACCOUNT_ID});

            // TODO: Remove hard coded ID values!
            var contentList = new List<Content>
            {
                new Content {Id = 0, Name = "Content 0", Description = "Content 0 for test content"},
                new Content {Id = 0, Name = "Content 0", Description = "Content 0 for test content"}
            };

            contentRepo.UpdateRange(contentList);

            foreach (Content aContent in contentList)
            {
                Console.WriteLine("Update content {0}: {1}", aContent.Id, aContent.Name);
                Console.WriteLine();
            }
        }
Ejemplo n.º 52
0
        static void KeywordAddRange(T70Context context)
        {
            var keywordRepo = context.Repository<Keyword>(new { AccountId = ACCOUNT_ID, ChannelId = CHANNEL_ID });

            var keywordList = new List<Keyword>
            {
                new Keyword { Name = "Keyword_SDK_Test1" },
                new Keyword { Name = "Keyword_SDK_Test2" }
            };

            keywordRepo.AddRange(keywordList);

            foreach (Keyword akeyword in keywordList)
            {
                Console.WriteLine("Added keyword {0}: {1}", akeyword.Id, akeyword.Name);
                Console.WriteLine();
            }
        }
Ejemplo n.º 53
0
        public void E_AccountUpdate()
        {
            var context = new T70Context();
            var accountRepo = context.Repository<Account>(new { ParentId = PARENT_ID });

            var account = new Account
            {
                Id = LookupTable.AccountId,
                Name = RanGen.Str
            };
            accountRepo.Update(account);
        }
Ejemplo n.º 54
0
 public void D_AccountGetAll()
 {
     var context = new T70Context();
     var accountRepo = context.Repository<Account>(new { ParentId = PARENT_ID });
     List<Account> contactlist = (accountRepo.GetAll()).ToList();
 }
Ejemplo n.º 55
0
        static void UpdateAccountExample(T70Context context)
        {
            var accountRepo = context.Repository<Account>(new { ParentId = PARENT_ID });

            var account = new Account
            {
                Id = ACCOUNT_ID,
                Name = "UpdatedTestAccount"
            };

            accountRepo.Update(account);
            var updateAccount = accountRepo.Get(ACCOUNT_ID);

            ShowAccountDetails(updateAccount);
            Console.WriteLine();
        }
Ejemplo n.º 56
0
 public void F_AccountUpdateRange()
 {
     var context = new T70Context();
     var accountRepo = context.Repository<Account>(new {});
     var accountList = new List<Account>
     {
         new Account() {Id = s_subSubAccount1, ParentId = PARENT_ID, Name = RanGen.Str},
         new Account() {Id = s_subSubAccount2, ParentId = PARENT_ID, Name = RanGen.Str}
     };
     accountRepo.UpdateRange(accountList);
 }
Ejemplo n.º 57
0
 public void Setup()
 {
     m_context = new T70Context(new MockConfig());
     m_contactRepo = m_context.Repository<Contact>(new { AccountId = m_accountId });
 }
Ejemplo n.º 58
0
 public void G_AccountDelete()
 {
     var context = new T70Context();
     var accountRepo = context.Repository<Account>(new { ParentId = PARENT_ID });
     var account = new Account
     {
         Id = LookupTable.AccountId
     };
     accountRepo.Delete(account);
 }
Ejemplo n.º 59
0
 public void C_AccountGet()
 {
     var context = new T70Context();
     var accountRepo = context.Repository<Account>(new { ParentId = PARENT_ID });
     accountRepo.Get(LookupTable.AccountId);
 }
Ejemplo n.º 60
0
        private static Subscription CreateSubscription(T70Context context)
        {
            /*
             * The subscription provides a way for a contact to opt into or out of a group of campaigns.
             *
             * You might for example have one subscription for promotions related events and another for
             * contests.
             */
            var subRepo = context.Repository<Subscription>(new { AccountId = ACCOUNT_ID });

            var sub = new Subscription
            {
                Name = SUBSCRIPTION_NAME,
                Label = SUBSCRIPTION_LABEL,
            };

            subRepo.Add(sub);
            return sub;
        }