Example #1
0
        public void ContactsGetListTest()
        {
            Prompt.Ymlp.YmlpConnector target = InitializeApi();

            List <Contact> ContactList = null;
            int?           GroupID     = 1;
            List <int>     FieldID     = null;
            //            Nullable<int> Page = new Nullable<int>();
            //            Nullable<int> NumberPerPage = new Nullable<int>();
            //            Nullable<DateTime> StartDate = DateTime.Now;
            //            Nullable<DateTime> StopDate = DateTime.Now;

            bool expected = true;
            bool actual;

            actual = target.ContactsGetList(out ContactList, GroupID, FieldID);
            Assert.IsNotNull(ContactList);
            Assert.AreEqual(expected, actual);
        }
Example #2
0
        public static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");

            bool          secure = false;
            YmlpConnector proxy  = new Prompt.Ymlp.YmlpConnector(YmlpKey, YmlpUser, secure);

            Console.WriteLine("Available fields");
            List <Field> fl;

            if (proxy.FieldsGetList(out fl) == false)
            {
                Console.WriteLine("Error getting Field list");
                PrintExceptions(proxy.Exceptions);
                return;
            }
            else
            {
                foreach (var i in fl)
                {
                    Console.WriteLine("id: {0} / field: {1}", i.Id, i.FieldName);
                }
            }

            List <Group> grouplist;

            if (proxy.GroupsGetList(out grouplist) == false)
            {
                Console.WriteLine("Error getting groups, exit!");
                PrintExceptions(proxy.Exceptions);
                return;
            }

            foreach (var group in grouplist)
            {
                // Get all information about all contacts in a group
                Console.WriteLine("GROUP  ---  {0} (id: {1}, # contacts: {2})", group.GroupName, group.Id, group.NumberOfContacts);

                // Get all the available fields
                var            fieldlist = fl.Select(f => f.Id).ToList();
                List <Contact> cl;
                if (proxy.ContactsGetList(out cl, group.Id, fieldlist) == false)
                {
                    Console.WriteLine("Error getting contacts");
                    PrintExceptions(proxy.Exceptions);
                    return;
                }
                else
                {
                    // Loop all contacts
                    foreach (var contact in cl)
                    {
                        Console.WriteLine("contact e-mail: {0}", contact.EmailAddress);
                        Console.WriteLine("        state : {0}", contact.State);
                        Console.WriteLine("        create: {0}", contact.CreateDate);
                        if (contact.Fields.Count > 0)
                        {
                            Console.WriteLine("        Extra fields found");
                        }
                        foreach (var field in contact.Fields)
                        {
                            // For every contact print all fields from that contact
                            Console.WriteLine(" {0,22}: {1}", field.Key, field.Value);
                        }
                    }
                }
            }
            Console.Write("Press any key to continue . . . ");
            Console.ReadKey(true);
        }