// Prints list of filtered customers.
        static void PrintCustomerList(soap.Customer_Service service, List <soap.Customer_Filter> filter)
        {
            Msg("Printing Customer List");

            // Runs the actual search.
            soap.Customer[] list = service.ReadMultiple(filter.ToArray(), null, 100);
            foreach (soap.Customer c in list)
            {
                PrintCustomer(c);
            }
            Msg("End of List");
        }
        private static void TestDynamicsNavSoapWebService()
        {
            // Creates instance of service and sets credentials.
            soap.Customer_Service service = new soap.Customer_Service();
            service.UseDefaultCredentials = true;
            // Creates instance of customer.
            soap.Customer cust = new soap.Customer();
            cust.Name = "Customer Name";
            Msg("Pre Create");
            PrintCustomer(cust);

            // Inserts customer.
            service.Create(ref cust);
            Msg("Post Create");
            PrintCustomer(cust);

            // Creates filter for searching for customers.
            List <soap.Customer_Filter> filterArray = new List <soap.Customer_Filter>();

            soap.Customer_Filter nameFilter = new soap.Customer_Filter();
            nameFilter.Field    = soap.Customer_Fields.Name;
            nameFilter.Criteria = "C*";
            filterArray.Add(nameFilter);

            Msg("List before modification");
            PrintCustomerList(service, filterArray);

            // Creates filter for searching for customers.
            List <soap.Customer_Filter> filterArray1 = new List <soap.Customer_Filter>();

            soap.Customer_Filter noFilter = new soap.Customer_Filter();
            noFilter.Field    = soap.Customer_Fields.No;
            noFilter.Criteria = "01*";
            filterArray1.Add(noFilter);
            PrintCustomerList(service, filterArray1);

            cust.Name = cust.Name + "Updated";
            service.Update(ref cust);

            Msg("Post Update");
            PrintCustomer(cust);

            Msg("List after modification");
            PrintCustomerList(service, filterArray);
            //service.Delete(cust.Key);

            Msg("List after deletion");
            PrintCustomerList(service, filterArray);
        }