示例#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();
            }
        }
示例#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();
            }
        }
示例#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);
        }
示例#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;
        }
示例#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);
        }
示例#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");
        }
示例#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");
        }
示例#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);
        }
示例#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();
        }
示例#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();
        }
示例#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);
        }
示例#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);
        }
示例#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;
        }
示例#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);
        }
示例#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);
            }
        }
示例#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);
            }
        }
示例#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();
            }
        }
示例#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();
            }
        }
示例#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");
        }
示例#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");
        }
示例#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);
        }
示例#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;
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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;
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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();
        }
示例#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);
        }
示例#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);
        }
示例#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();
            }
        }
示例#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();
            }
        }
示例#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();
            }
        }
示例#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;
        }
示例#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();
        }
示例#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;
        }
示例#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");
            //}
        }
示例#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");
        }
示例#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);
        }
示例#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);
        }
示例#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();
            }
        }
示例#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();
            }
        }
示例#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();
            }
        }
示例#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);
        }
示例#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();
 }
示例#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();
        }
示例#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);
 }
示例#57
0
 public void Setup()
 {
     m_context = new T70Context(new MockConfig());
     m_contactRepo = m_context.Repository<Contact>(new { AccountId = m_accountId });
 }
示例#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);
 }
示例#59
0
 public void C_AccountGet()
 {
     var context = new T70Context();
     var accountRepo = context.Repository<Account>(new { ParentId = PARENT_ID });
     accountRepo.Get(LookupTable.AccountId);
 }
示例#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;
        }