IT Portal CompaniesPost

Create a company in IT Portal

C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.ServiceModel;

using DemoItPortal.ItPortalService;

namespace DemoItPortal
{
    class CompaniesPost
    {
        /*
         * Instructions
         * 
         * 1. Disable Authentication and SSL.
         * 2. Add a Service Reference to the ITPortal Service, name the reference ITPortalService.
         *    The uri will generally be http://localhost:11111/ITPortal.
         * 3. With new releases you may have to update the Service Reference.
         */
        public static void Main()
        {
            Console.WriteLine("CompaniesPost: Start");

            ItPortalClient client = new ItPortalClient();
            (client.ChannelFactory.Endpoint.Binding as BasicHttpBinding).MaxReceivedMessageSize = int.MaxValue;
            (client.ChannelFactory.Endpoint.Binding as BasicHttpBinding).MaxBufferSize = int.MaxValue;
            (client.ChannelFactory.Endpoint.Binding as BasicHttpBinding).ReceiveTimeout = new TimeSpan(0, 10, 0);

            CompaniesPostRequestBody requestBody = new CompaniesPostRequestBody
            {
                name = "Test Company",
                type = new CompaniesPostRequestBody_type
                {
                    name = "Other"
                },
                contact = new CompaniesPostRequestBody_contact
                {
                    firstName = "Test",
                    lastName = "Test"
                }
            };

            client.CompaniesPost(requestBody);

            Console.WriteLine("CompaniesPost: Finished");
            Console.ReadKey();
        }
    }
}