Example #1
0
        public static LocationModel SendPOST(Lead customer)
        {
            LocationInputModel location = new LocationInputModel();

            location.Branch = customer.location.name.Substring(8);

            string[] names = Postman.ExtractMatches(PPRGX.NAMES.Match(customer.name));
            location.FirstName = names[0];
            location.LastName  = names[1];

            string[] locinfo = Postman.ExtractMatches(Regex.Match(customer.address, ModifiedLocInfoPat));
            location.State   = stateAbbrvs[locinfo[2]];
            location.Address = locinfo[0];
            location.City    = locinfo[1];
            location.Zip     = locinfo[3];
            location.TaxCode = PestPacGeoCoding.GetTaxCode(new Params(locinfo[0], locinfo[1], location.State, locinfo[3]));

            location.Phone       = customer.phone;
            location.EMail       = customer.email;
            location.EnteredDate = customer.created_at;

            location.UserDefinedFields = new List <UserDefinedField>()
            {
                new UserDefinedField("# Services", customer.services.ToString())
            };

            names   = null;
            locinfo = null;

            return(client.CreateLocation(location));
        }