Example #1
0
        public void ContactSearchReturnsResults()
        {
            var mockConfig  = new MockConfig();
            var mockFactory = new MockClientFactory();

            var context = new T70Context(mockConfig, mockFactory);

            const string JSON_RESPONSE_DATA = "[]";

            var result = new MockResponse <List <Contact> >
            {
                Content         = JSON_RESPONSE_DATA,
                ContentType     = "application/json",
                ContentLength   = JSON_RESPONSE_DATA.Length,
                ContentEncoding = "utf-8",
                Data            = new List <Contact>(),
                StatusCode      = HttpStatusCode.OK
            };

            mockFactory.ClientStub.Stub(c => c.Execute(Arg <IRestRequest> .Is.Anything))
            .Return(result)
            ;

            var contacts = context.ContactSearch(25, "512*");

            Assert.IsTrue(mockFactory.WasCalled, "Create() not called on factory!");
            mockFactory.AssertCommonCalls();

            Assert.IsEmpty(contacts);
        }
Example #2
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);
        }
Example #3
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();
            }
        }
        [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);
        }
Example #5
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;
        }
Example #6
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();
            }
        }
Example #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");
        }
Example #8
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");
        }
Example #9
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);
        }
Example #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();
        }
Example #11
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();
        }
Example #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);
        }
Example #13
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);
        }
Example #14
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);
            }
        }
Example #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);
            }
        }
Example #16
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();
            }
        }
Example #17
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");
        }
Example #18
0
        static void ContactSearchExample(T70Context context)
        {
            Console.WriteLine("Searching for contacts matching: {0}", SEARCH_PATTERN);
            var contacts = context.ContactSearch(ACCOUNT_ID, SEARCH_PATTERN);

            Console.WriteLine("Found:");

            foreach (var c in contacts)
            {
                Console.WriteLine("  {0}: {1}", c.Id, c.PhoneNumber);
            }
        }
Example #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");
        }
Example #20
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();
            }
        }
Example #21
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);
        }
Example #22
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);
        }
Example #23
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);
        }
Example #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);
        }
Example #25
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);
        }
Example #26
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);
        }
Example #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);
        }
Example #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);
        }
Example #29
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);
        }
Example #30
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;
        }
Example #31
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);
        }
Example #32
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);
        }
Example #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);
        }
Example #34
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);
        }
Example #35
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);
        }
Example #36
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();
        }
Example #37
0
        private const int CHANNEL_ID = 11;      // This is the 370370 short code

        static void Main(string[] args)
        {
            // Uncomment out the following line to see more details about what is going on durring execution.
            //InitLogging();

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

            Keyword keyword = KeywordSetup(context);

            Console.WriteLine("Keyword {0} (ID: {1}) setup on channel {2}", keyword.Name, keyword.Id, CHANNEL_ID);

            Console.WriteLine();
            Console.WriteLine("Done, press a key to quit.");
            Console.ReadKey();
        }
Example #38
0
        static void Main(string[] args)
        {
            // Uncomment out the following line to see more details about what is going on durring execution.
            //InitLogging();

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

            Keyword keyword = KeywordSetup(context);

            Console.WriteLine("Keyword {0} (ID: {1}) setup on channel {2}", keyword.Name, keyword.Id, CHANNEL_ID);

            Console.WriteLine();
            Console.WriteLine("Done, press a key to quit.");
            Console.ReadKey();
        }
Example #39
0
        static void Main(string[] args)
        {
            // Uncomment out the following line to see more details about what is going on durring execution.
            //InitLogging();

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

            Campaign campaign = CampaignSetup(context);

            Console.WriteLine("Campaign {0} has been created", campaign);

            Console.WriteLine();
            Console.WriteLine("Done, press a key to quit.");
            Console.ReadKey();
        }
Example #40
0
        private const int ACCOUNT_ID = 0; // TODO: Fill in with your account ID

        static void Main(string[] args)
        {
            // Uncomment out the following line to see more details about what is going on durring execution.
            //InitLogging();

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

            Campaign campaign = CampaignSetup(context);

            Console.WriteLine("Campaign {0} has been created", campaign);

            Console.WriteLine();
            Console.WriteLine("Done, press a key to quit.");
            Console.ReadKey();
        }
Example #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();
            }
        }
Example #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();
            }
        }
Example #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;
        }
Example #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();
        }
Example #45
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;
        }
Example #46
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;
        }
Example #47
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;
        }
Example #48
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");
            //}
        }
Example #49
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();
        }
Example #50
0
 public void C_AccountGet()
 {
     var context = new T70Context();
     var accountRepo = context.Repository<Account>(new { ParentId = PARENT_ID });
     accountRepo.Get(LookupTable.AccountId);
 }
Example #51
0
 public void D_AccountGetAll()
 {
     var context = new T70Context();
     var accountRepo = context.Repository<Account>(new { ParentId = PARENT_ID });
     List<Account> contactlist = (accountRepo.GetAll()).ToList();
 }
Example #52
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);
        }
Example #53
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();
            }
        }
Example #54
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);
        }
Example #55
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();

            DetailsExample(context);
            GetAllExample(context);

            // The following examples make changes to the accounts, use with care.
            //CreateAccountExample(context);
            //UpdateAccountExample(context);

            Console.WriteLine();
            Console.WriteLine("Done, press a key to quit.");
            Console.ReadKey();
        }
Example #56
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;
        }
Example #57
0
        static void Main(string[] args)
        {
            // Uncomment out the following line to see more details about what is going on durring execution.
            //InitLogging();

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

            //CreateContent(context);
            //ContentAddRange(context);
            //ContentDetails(context);
            //ContentGetAll(context);
            //ContentUpdate(context);
            //ContactDeleteExample(context);
            //ContentUpdateRange(context);

            Console.WriteLine();
            Console.WriteLine("Done, press a key to quit.");
            Console.ReadKey();
        }
Example #58
0
 public void Setup()
 {
     m_context = new T70Context(new MockConfig());
     m_contactRepo = m_context.Repository<Contact>(new { AccountId = m_accountId });
 }
Example #59
0
        static void Main(string[] args)
        {
            // Uncomment out the following line to see more details about what is going on durring execution.
            //InitLogging();

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

            Campaign campaign = CampaignSetup(context);

            Console.WriteLine("Campaign {0} has been created.", campaign.Id);
            Console.WriteLine("You can attach a keyword to this campaign or you can push it directly via a push event.");
            Console.WriteLine("For more details see the KeywordAttachExample and PushExample projects.");

            Console.WriteLine();
            Console.WriteLine("Done, press a key to quit.");
            Console.ReadKey();
        }
Example #60
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");
        }