HomeGuidesAPI ReferenceChangelogDiscussions
GuidesiMIS ProfessionaliMIS EnterpriseClient SupportLog In
Guides

Organization

Organization, ComboParty

Create an organization

Example of creating a new organization and setting it's communication preference and address.

using System;
using System.Linq;
using Asi.Soa.ClientServices;
using Asi.Soa.Core.DataContracts;
using Asi.Soa.Membership.DataContracts;

EntityManager entityManager = new EntityManager();

// Create a new organization
var organizationData = new OrganizationData
{
  OrganizationName = "New Non-Member Organization",
  AdditionalAttributes =
    new GenericPropertyDataCollection {new GenericPropertyData("CustomerTypeCode", "NMC")},

  Addresses = new FullAddressDataCollection
  {
    new FullAddressData
    {
      AddressPurpose = "Address",
      CommunicationPreferences = new CommunicationPreferenceDataCollection
      {
        new CommunicationPreferenceData
        {
          Reason = "mail"
        }
      },
      Address = new AddressData
      {
        AddressLines = new AddressLineDataCollection {"1000 Congress Ave."},
        CityName = "Austin",
        CountrySubEntityCode = "TX",
        CountyCode = "US",
        PostalCode = "78701"
      }
    }
  }
};

// Save
var results = entityManager.Add(organizationData);
if (results.IsValid)
{
  organizationData = results.Entity;
  Console.WriteLine("Organization - Id: {0}, Full Name: {1}", organizationData.PartyId,
                    organizationData.OrganizationName);
}
else
{
  Console.WriteLine(results.ValidationResults.Summary);
}
using System;
using System.Net.Http;
using System.Text;
using Newtonsoft.Json;

namespace RestDemo
{
    public class Program
    {
        public void CreateAnOrganizationRestfulExample()
        {
            // Instantiate new Organization object to be used in REST call to the Organization service 
            var organizationModel = new OrganizationModel
            {
                Type = "Asi.Soa.Membership.DataContracts.OrganizationData, Asi.Contracts",
                OrganizationName = "Versaton"
            };

            // Serialize above object to JSON, create HTTP content to be used in POST call
            var jsonObject = JsonConvert.SerializeObject(organizationModel, Formatting.None,
                new JsonSerializerSettings {NullValueHandling = NullValueHandling.Ignore});
            var httpContent = new StringContent(jsonObject, Encoding.UTF8, "application/json");
          
            HttpClient client = new HttpClient();

            /*
            Add proper authorization header to new HttpClient above 
            before making below request, see 
            https://developer.imis.com/v0.1/docs/accessing-the-rest-api#section-direct-access-oauth-20 
            for an example of how to perform this in C# project
            */

            var organization = client.PostAsync("api/organization", httpContent).Result;

            if (organization != null && organization.IsSuccessStatusCode)
            {
                Console.WriteLine("Organization: {0}", organization.Content.ReadAsStringAsync().Result);
            }
        }
    }

    internal class OrganizationModel
    {
        [JsonProperty("$type")]
        public string Type { get; set; }

        public string OrganizationName { get; set; }
    }
}

/*
Organization: {  
   "$type":"Asi.Soa.Membership.DataContracts.OrganizationData, Asi.Contracts",
   "OrganizationName":"Versaton",
   "AdditionalAttributes":{  
      "$type":"Asi.Soa.Core.DataContracts.GenericPropertyDataCollection, Asi.Contracts",
      "$values":[  
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"CustomerTypeDescription",
            "Value":"Non Member Company"
         },
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"IsMemberRecord",
            "Value":{  
               "$type":"System.Boolean",
               "$value":false
            }
         },
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"CustomerTypeCode",
            "Value":"NMC"
         },
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"IsMember",
            "Value":{  
               "$type":"System.Boolean",
               "$value":false
            }
         },
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"IsInactiveMember",
            "Value":{  
               "$type":"System.Boolean",
               "$value":false
            }
         },
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"AllowAdvanceRenewal",
            "Value":{  
               "$type":"System.Boolean",
               "$value":false
            }
         },
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"JoinDate",
            "Value":"0001-01-01T00:00:00"
         }
      ]
   },
   "Addresses":{  
      "$type":"Asi.Soa.Membership.DataContracts.FullAddressDataCollection, Asi.Contracts",
      "$values":[  
         {  
            "$type":"Asi.Soa.Membership.DataContracts.FullAddressData, Asi.Contracts",
            "AdditionalLines":{  
               "$type":"Asi.Soa.Membership.DataContracts.AddressLineDataCollection, Asi.Contracts",
               "$values":[  

               ]
            },
            "Address":{  
               "$type":"Asi.Soa.Membership.DataContracts.AddressData, Asi.Contracts",
               "AddressId":"13664",
               "VerificationStatus":0
            },
            "AddresseeText":"Versaton\r\n",
            "AddressPurpose":"Address",
            "CommunicationPreferences":{  
               "$type":"Asi.Soa.Membership.DataContracts.CommunicationPreferenceDataCollection, Asi.Contracts",
               "$values":[  
                  {  
                     "$type":"Asi.Soa.Membership.DataContracts.CommunicationPreferenceData, Asi.Contracts",
                     "Reason":"default"
                  },
                  {  
                     "$type":"Asi.Soa.Membership.DataContracts.CommunicationPreferenceData, Asi.Contracts",
                     "Reason":"mail"
                  },
                  {  
                     "$type":"Asi.Soa.Membership.DataContracts.CommunicationPreferenceData, Asi.Contracts",
                     "Reason":"bill"
                  },
                  {  
                     "$type":"Asi.Soa.Membership.DataContracts.CommunicationPreferenceData, Asi.Contracts",
                     "Reason":"ship"
                  }
               ]
            },
            "FullAddressId":"13664",
            "Salutation":{  
               "$type":"Asi.Soa.Membership.DataContracts.PartySalutationData, Asi.Contracts",
               "SalutationMethod":{  
                  "$type":"Asi.Soa.Membership.DataContracts.PartySalutationMethodSummaryData, Asi.Contracts",
                  "PartySalutationMethodId":"main"
               },
               "Text":"Versaton"
            }
         }
      ]
   },
   "AlternateIds":{  
      "$type":"Asi.Soa.Core.DataContracts.AlternateIdDataCollection, Asi.Contracts",
      "$values":[  
         {  
            "$type":"Asi.Soa.Core.DataContracts.AlternateIdData, Asi.Contracts",
            "Id":"23189",
            "IdType":"Id"
         }
      ]
   },
   "FinancialInformation":{  
      "$type":"Asi.Soa.Membership.DataContracts.FinancialInformationData, Asi.Contracts"
   },
   "Salutations":{  
      "$type":"Asi.Soa.Membership.DataContracts.PartySalutationDataCollection, Asi.Contracts",
      "$values":[  

      ]
   },
   "SocialNetworks":{  
      "$type":"Asi.Soa.Membership.DataContracts.PartySocialNetworkDataCollection, Asi.Contracts",
      "$values":[  

      ]
   },
   "CommunicationTypePreferences":{  
      "$type":"Asi.Soa.Membership.DataContracts.PartyCommunicationTypePreferenceDataCollection, Asi.Contracts",
      "$values":[  

      ]
   },
   "SortIsOverridden":false,
   "UpdateInformation":{  
      "$type":"Asi.Soa.Core.DataContracts.EntityUpdateInformationData, Asi.Contracts",
      "CreatedBy":"BRIANM",
      "CreatedOn":"2017-12-18T13:41:17.137",
      "UpdatedBy":"BRIANM",
      "UpdatedOn":"2017-12-18T13:41:17.137"
   },
   "PartyId":"23189",
   "Id":"23189",
   "UniformId":"0ff3f9c0-51e5-4b32-aeee-faa9815fc679",
   "Status":{  
      "$type":"Asi.Soa.Membership.DataContracts.PartyStatusData, Asi.Contracts",
      "PartyStatusId":"A",
      "Name":"Active",
      "Description":"Active"
   },
   "Name":"Versaton",
   "Sort":"Versaton"
}
*/

Add an individual to an organization

Add an individual to an existing to an organization

using System;
using System.Linq;
using Asi.Soa.ClientServices;
using Asi.Soa.Core.DataContracts;
using Asi.Soa.Membership.DataContracts;

EntityManager entityManager = new EntityManager();

// Existing Id for the Prodigy Makers International organization
var organizationPartyId = "101";

// Create a new person
var personData = new PersonData
{
  PersonName = new PersonNameData {FirstName = "Mike", LastName = "Smith"},
  Addresses = new FullAddressDataCollection
  {
    new FullAddressData
    {
      AddressPurpose = "Address",
      CommunicationPreferences = new CommunicationPreferenceDataCollection
      {
        new CommunicationPreferenceData
        {
          Reason = "mail"
        }
      },
      Address = new AddressData
      {
        AddressLines = new AddressLineDataCollection {"14233 Third Street"},
        CityName = "Austin",
        CountrySubEntityCode = "TX",
        CountyCode = "US",
        PostalCode = "78757"
      }
    }
  },

  // Add the new person to the existing organization
  PrimaryOrganization = new PrimaryOrganizationInformationData {OrganizationPartyId = organizationPartyId}
};

// Save
var results = entityManager.Add(personData);
if (results.IsValid)
{
  personData = results.Entity;
  Console.WriteLine("Person - Id: {0}, Full Name: {1}, Organization: {2}", personData.PartyId,
                    personData.PersonName.FullName, personData.PrimaryOrganization.Name);
}
else
{
  Console.WriteLine(results.ValidationResults.Summary);
}
using System;
using System.Net.Http;
using System.Text;
using Newtonsoft.Json;

namespace RestDemo
{
    public class Program
    {
        public void AddAnIndividualToOrganizationRestfulExample()
        {
            // Existing ID for the Western Municipalities organization
            const string organizationPartyId = "19762";

            // Instantiate new Party object to be used in REST call to the Party service with
            // an ID that references an existing Party
            var partyModel = new PartyModel
            {
                Type = "Asi.Soa.Membership.DataContracts.PersonData, Asi.Soa.Membership.Contracts",
                PartyId = "18052",
                PersonName = new PersonName
                {
                    Type = "Asi.Soa.Membership.DataContracts.PersonNameData, Asi.Soa.Membership.Contracts",
                    FirstName = "George",
                    InformalName = "William",
                    LastName = "Milburn",
                    NamePrefix = "Mr."
                },
                PrimaryOrganization = new PrimaryOrganization
                {
                    OrganizationPartyId = organizationPartyId
                }
            };

            // Serialize above object to JSON, create HTTP content to be used in PUT call
            var jsonObject = JsonConvert.SerializeObject(partyModel, Formatting.None,
                new JsonSerializerSettings {NullValueHandling = NullValueHandling.Ignore});
            var httpContent = new StringContent(jsonObject, Encoding.UTF8, "application/json");
          
            HttpClient client = new HttpClient();

            /*
            Add proper authorization header to new HttpClient above 
            before making below request, see 
            https://developer.imis.com/v0.1/docs/accessing-the-rest-api#section-direct-access-oauth-20 
            for an example of how to perform this in C# project
            */

            var party = client.PutAsync($"api/party/{partyModel.PartyId}", httpContent)
                .Result;

            if (party != null && party.IsSuccessStatusCode)
            {
                Console.WriteLine("Party: {0}", party.Content.ReadAsStringAsync().Result);
            }
        }
    }

    internal class PartyModel
    {
        [JsonProperty("$type")]
        public string Type { get; set; }

        public string PartyId { get; set; }

        public PersonName PersonName { get; set; }

        public PrimaryOrganization PrimaryOrganization { get; set; }
    }

    internal class PersonName
    {
        [JsonProperty("$type")]
        public string Type { get; set; }

        public string FirstName { get; set; }

        public string InformalName { get; set; }

        public string LastName { get; set; }

        public string NamePrefix { get; set; }
    }

    internal class PrimaryOrganization
    {
        [JsonProperty("$type")]
        public string Type { get; set; }

        public string OrganizationPartyId { get; set; }

        public string Name { get; set; }

        public string Title { get; set; }
    }
}

/*
Party: {  
   "$type":"Asi.Soa.Membership.DataContracts.PersonData, Asi.Contracts",
   "PersonName":{  
      "$type":"Asi.Soa.Membership.DataContracts.PersonNameData, Asi.Contracts",
      "FirstName":"George",
      "InformalName":"William",
      "LastName":"Milburn",
      "NamePrefix":"Mr.",
      "FullName":"Mr. Brian Murphy"
   },
   "PrimaryOrganization":{  
      "$type":"Asi.Soa.Membership.DataContracts.PrimaryOrganizationInformationData, Asi.Contracts",
      "OrganizationPartyId":"19762"
   },
   "AdditionalAttributes":{  
      "$type":"Asi.Soa.Core.DataContracts.GenericPropertyDataCollection, Asi.Contracts",
      "$values":[  
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"CustomerTypeDescription",
            "Value":"Staff"
         },
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"IsMemberRecord",
            "Value":{  
               "$type":"System.Boolean",
               "$value":false
            }
         },
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"CustomerTypeCode",
            "Value":"STF"
         },
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"IsMember",
            "Value":{  
               "$type":"System.Boolean",
               "$value":false
            }
         },
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"IsInactiveMember",
            "Value":{  
               "$type":"System.Boolean",
               "$value":false
            }
         },
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"AllowAdvanceRenewal",
            "Value":{  
               "$type":"System.Boolean",
               "$value":false
            }
         },
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"JoinDate",
            "Value":"0001-01-01T00:00:00"
         },
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"ParentPartyId",
            "Value":"18013"
         }
      ]
   },
   "Addresses":{  
      "$type":"Asi.Soa.Membership.DataContracts.FullAddressDataCollection, Asi.Contracts",
      "$values":[  
         {  
            "$type":"Asi.Soa.Membership.DataContracts.FullAddressData, Asi.Contracts",
            "AdditionalLines":{  
               "$type":"Asi.Soa.Membership.DataContracts.AddressLineDataCollection, Asi.Contracts",
               "$values":[  

               ]
            },
            "Address":{  
               "$type":"Asi.Soa.Membership.DataContracts.AddressData, Asi.Contracts",
               "AddressId":"8444",
               "AddressLines":{  
                  "$type":"Asi.Soa.Membership.DataContracts.AddressLineDataCollection, Asi.Contracts",
                  "$values":[  
                     "8910 Sylvan Rdg"
                  ]
               },
               "CityName":"Eden Prairie",
               "CountryCode":"US",
               "CountryName":"United States",
               "CountrySubEntityCode":"MN",
               "CountrySubEntityName":"Minnesota",
               "FullAddress":"8910 Sylvan Rdg\rEden Prairie, MN  55347-3336\rUNITED STATES",
               "PostalCode":"55347-3336",
               "VerificationStatus":0
            },
            "AddresseeText":"Mr. Brian Murphy\r\n8910 Sylvan Rdg\rEden Prairie, MN  55347-3336\rUNITED STATES",
            "AddressPurpose":"Address",
            "CommunicationPreferences":{  
               "$type":"Asi.Soa.Membership.DataContracts.CommunicationPreferenceDataCollection, Asi.Contracts",
               "$values":[  
                  {  
                     "$type":"Asi.Soa.Membership.DataContracts.CommunicationPreferenceData, Asi.Contracts",
                     "Reason":"default"
                  },
                  {  
                     "$type":"Asi.Soa.Membership.DataContracts.CommunicationPreferenceData, Asi.Contracts",
                     "Reason":"mail"
                  },
                  {  
                     "$type":"Asi.Soa.Membership.DataContracts.CommunicationPreferenceData, Asi.Contracts",
                     "Reason":"bill"
                  },
                  {  
                     "$type":"Asi.Soa.Membership.DataContracts.CommunicationPreferenceData, Asi.Contracts",
                     "Reason":"ship"
                  }
               ]
            },
            "Email":"[email protected]",
            "Fax":"(516) 987-0000",
            "FullAddressId":"8444",
            "Note":"P.S.I. Code 9450",
            "Phone":"(516) 987-2222",
            "Salutation":{  
               "$type":"Asi.Soa.Membership.DataContracts.PartySalutationData, Asi.Contracts",
               "SalutationMethod":{  
                  "$type":"Asi.Soa.Membership.DataContracts.PartySalutationMethodSummaryData, Asi.Contracts",
                  "PartySalutationMethodId":"main"
               },
               "Text":"Mr. Brian Murphy"
            },
            "DisplayName":"Brian",
            "DisplayOrganizationTitle":"System Administrator",
            "DisplayOrganizationName":"iMIS International"
         },
         {  
            "$type":"Asi.Soa.Membership.DataContracts.FullAddressData, Asi.Contracts",
            "AdditionalLines":{  
               "$type":"Asi.Soa.Membership.DataContracts.AddressLineDataCollection, Asi.Contracts",
               "$values":[  

               ]
            },
            "Address":{  
               "$type":"Asi.Soa.Membership.DataContracts.AddressData, Asi.Contracts",
               "AddressId":"13516",
               "AddressLines":{  
                  "$type":"Asi.Soa.Membership.DataContracts.AddressLineDataCollection, Asi.Contracts",
                  "$values":[  
                     "3554 Maple Street"
                  ]
               },
               "CityName":"Edina",
               "CountryCode":"US",
               "CountryName":"United States",
               "CountrySubEntityCode":"MN",
               "CountrySubEntityName":"Minnesota",
               "FullAddress":"3554 Maple Street\rEdina, MN  \rUNITED STATES",
               "VerificationStatus":0
            },
            "AddresseeText":"Mr. Brian Murphy\r\n3554 Maple Street\rEdina, MN  \rUNITED STATES",
            "AddressPurpose":"Home Address",
            "CommunicationPreferences":{  
               "$type":"Asi.Soa.Membership.DataContracts.CommunicationPreferenceDataCollection, Asi.Contracts",
               "$values":[  

               ]
            },
            "FullAddressId":"13516",
            "Phone":"(917) 555-3434",
            "Salutation":{  
               "$type":"Asi.Soa.Membership.DataContracts.PartySalutationData, Asi.Contracts",
               "SalutationMethod":{  
                  "$type":"Asi.Soa.Membership.DataContracts.PartySalutationMethodSummaryData, Asi.Contracts",
                  "PartySalutationMethodId":"main"
               },
               "Text":"Mr. Brian Murphy"
            },
            "DisplayName":"Brian",
            "DisplayOrganizationTitle":"System Administrator",
            "DisplayOrganizationName":"iMIS International"
         }
      ]
   },
   "AlternateIds":{  
      "$type":"Asi.Soa.Core.DataContracts.AlternateIdDataCollection, Asi.Contracts",
      "$values":[  
         {  
            "$type":"Asi.Soa.Core.DataContracts.AlternateIdData, Asi.Contracts",
            "Id":"18052",
            "IdType":"Id"
         }
      ]
   },
   "Emails":{  
      "$type":"Asi.Soa.Membership.DataContracts.EmailDataCollection, Asi.Contracts",
      "$values":[  
         {  
            "$type":"Asi.Soa.Membership.DataContracts.EmailData, Asi.Contracts",
            "Address":"[email protected]",
            "EmailType":"_Primary",
            "IsPrimary":true
         },
         {  
            "$type":"Asi.Soa.Membership.DataContracts.EmailData, Asi.Contracts",
            "Address":"[email protected]",
            "EmailType":"Address"
         }
      ]
   },
   "FinancialInformation":{  
      "$type":"Asi.Soa.Membership.DataContracts.FinancialInformationData, Asi.Contracts"
   },
   "Phones":{  
      "$type":"Asi.Soa.Membership.DataContracts.PhoneDataCollection, Asi.Contracts",
      "$values":[  
         {  
            "$type":"Asi.Soa.Membership.DataContracts.PhoneData, Asi.Contracts",
            "Number":"(516) 987-2222",
            "PhoneType":"_Work Phone"
         },
         {  
            "$type":"Asi.Soa.Membership.DataContracts.PhoneData, Asi.Contracts",
            "Number":"(791) 829-6838",
            "PhoneType":"Mobile"
         },
         {  
            "$type":"Asi.Soa.Membership.DataContracts.PhoneData, Asi.Contracts",
            "Number":"(516) 987-2222",
            "PhoneType":"Address"
         },
         {  
            "$type":"Asi.Soa.Membership.DataContracts.PhoneData, Asi.Contracts",
            "Number":"(516) 987-0000",
            "PhoneType":"Address Fax"
         },
         {  
            "$type":"Asi.Soa.Membership.DataContracts.PhoneData, Asi.Contracts",
            "Number":"(917) 555-3434",
            "PhoneType":"Home Address"
         }
      ]
   },
   "Salutations":{  
      "$type":"Asi.Soa.Membership.DataContracts.PartySalutationDataCollection, Asi.Contracts",
      "$values":[  
         {  
            "$type":"Asi.Soa.Membership.DataContracts.PartySalutationData, Asi.Contracts",
            "SalutationId":"18052",
            "SalutationMethod":{  
               "$type":"Asi.Soa.Membership.DataContracts.PartySalutationMethodSummaryData, Asi.Contracts",
               "PartySalutationMethodId":"LIST_AS"
            },
            "Text":"Elaine Beauchamp"
         }
      ]
   },
   "SortIsOverridden":false,
   "UpdateInformation":{  
      "$type":"Asi.Soa.Core.DataContracts.EntityUpdateInformationData, Asi.Contracts",
      "CreatedBy":"AMOORE",
      "CreatedOn":"2011-04-07T09:52:19.65",
      "UpdatedBy":"AMOORE",
      "UpdatedOn":"2012-01-12T11:25:44.787"
   },
   "PartyId":"18052",
   "UniformId":"e2124f8b-39fa-4690-be19-0cfab0a1def5",
   "Name":"Mr. Brian Murphy",
   "Sort":"Milburn, George"
}
*/

Create a new ComboParty

using System;
using System.Linq;
using Asi.Soa.ClientServices;
using Asi.Soa.Core.DataContracts;
using Asi.Soa.Membership.DataContracts;

EntityManager entityManager = new EntityManager();

// Create a new combo party
var comboParty = new ComboPartyData
{
  OrganizationName = "New ComboParty Organization",
  PersonName = {FirstName = "William", LastName = "Smith"},
  // Set the customer type code to "Company Member"
  AdditionalAttributes = new GenericPropertyDataCollection {{"CustomerTypeCode", "CM"}}
};

// Save
ValidateResultsData results = entityManager.Add(comboParty);
if (results.IsValid)
{
  comboParty = (ComboPartyData) results.Entity;
  Console.WriteLine("ComboParty - Id: {0}, Organization: {1}, Full Name: {2}", comboParty.PartyId,
                    comboParty.OrganizationName, comboParty.PersonName.FullName);
}
else
{
  Console.WriteLine(results.ValidationResults.Summary);
}

Join an organization

using System;
using System.Collections.Generic;
using System.Linq;
using Asi.Soa.ClientServices;
using Asi.Soa.Commerce.DataContracts;
using Asi.Soa.Core.DataContracts;

public void JoinAnOrganizationExample()
{
  // Initiailize entity and combo order managers, party ID that will be joining
  EntityManager entityManager = new EntityManager();

  string partyId = "18052"; // Brian Murphy

  ComboOrderManager comboOrderManager = new ComboOrderManager(entityManager, partyId);

  var findResultsData =
    entityManager.Find(
    new QueryData(ItemData.EntityTypeName)
    .AddCriteria(new CriteriaData("ItemCode",
                                  OperationData.Equal, "REGULAR_MEMBERSHIP_FEES"))).Result;

  // Get membership fees item, set item quantities and construct order line using helper method
  ItemData item = findResultsData[0] as ItemData;

  Dictionary<string, int> quantities = new Dictionary<string, int>
  {
    {"REGULAR_MEMBERSHIP_FEES/REG", 1},
    {"REGULAR_MEMBERSHIP_FEES/PAC", 1},
    {"REGULAR_MEMBERSHIP_FEES/NORTH", 1}
  };

  OrderLineData orderLine = ConstructOrderLine(item, quantities);

  // Add line to combo order manager, and update associated pricing
  comboOrderManager.AddLine(orderLine);
  comboOrderManager.UpdatePricing();

  // Add payment based off of order total
  comboOrderManager.ComboOrder.Payments = new RemittanceDataCollection
  {
    new RemittanceData
    {
      Amount = new MonetaryAmountData(comboOrderManager.ComboOrder.Order.OrderTotal.Value.Amount,
                                      comboOrderManager.ComboOrder.Order.Currency),
      PaymentMethod = new PaymentMethodData {PaymentMethodId = "CASH"}
    }
  };

  // Submit the order, and validate
  ValidateResultsData<ComboOrderData> results = comboOrderManager.Submit();

  if (results.IsValid)
  {
    Console.WriteLine("Grand total: {0}", comboOrderManager.ComboOrder.Order.OrderTotal);
  }
  else
  {
    Console.WriteLine(results.ValidationResults.Summary);
  }
}

/// <summary>
/// Construct an order line from a product
/// </summary>
/// <param name="item"></param>
/// <param name="quantitiesOrdered"></param>
internal static OrderLineData ConstructOrderLine(ItemSummaryData item,
                                                 Dictionary<string, int> quantitiesOrdered)
{
  OrderLineData orderLine = new OrderLineData
  {
    Item = item
  };

  ItemSetItemData itemSet = item as ItemSetItemData;

  if (itemSet != null)
  {
    orderLine.ChildOrderLines = new OrderLineDataCollection();

    foreach (ItemSetComponentData component in itemSet.Components)
    {
      orderLine.ChildOrderLines.Add(ConstructOrderLine(component.Item, quantitiesOrdered));
    }

    if (orderLine.ChildOrderLines.Any(
      x => x.QuantityOrdered.HasValue && x.QuantityOrdered.Value.Amount > 0m))
    {
      orderLine.QuantityOrdered = new QuantityData(1m);
    }
  }
  else
  {
    int quantity;

    if (quantitiesOrdered.TryGetValue(item.ItemCode, out quantity))
    {
      orderLine.QuantityOrdered = new QuantityData(quantity);
    }
  }

  return orderLine;
}

📘

Note:

If you need to create a child organization and attach it to a parent, you have the option to disable flow down by adding the following additional attribute FlowDownInstituteName. By setting this attribute to false, this attribute will disable flow down of the parent organization’s name and keeps the original name of the organization.

Disable Institute Name Flow Down

"AdditionalAttributes": {
        "$type": "Asi.Soa.Core.DataContracts.GenericPropertyDataCollection, Asi.Contracts",
        "$values": [,
              {
                "$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
                "Name": "FlowDownInstituteName",
                "Value": {
                    "$type": "System.Boolean",
                    "$value": false
                }
            }
        ]
    },

FlowDownInstituteName Attribute Included with an Organization

Party: {
    "$type": "Asi.Soa.Membership.DataContracts.PersonData, Asi.Contracts",
    "PersonName": {
        "$type": "Asi.Soa.Membership.DataContracts.PersonNameData, Asi.Contracts",
        "FirstName": "George",
        "InformalName": "William",
        "LastName": "Milburn",
        "NamePrefix": "Mr.",
        "FullName": "Mr. Brian Murphy"
    },
    "PrimaryOrganization": {
        "$type": "Asi.Soa.Membership.DataContracts.PrimaryOrganizationInformationData, Asi.Contracts",
        "OrganizationPartyId": "19762"
    },
    "AdditionalAttributes": {
        "$type": "Asi.Soa.Core.DataContracts.GenericPropertyDataCollection, Asi.Contracts",
        "$values": [{
                "$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
                "Name": "CustomerTypeDescription",
                "Value": "Staff"
            },
            {
                "$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
                "Name": "IsMemberRecord",
                "Value": {
                    "$type": "System.Boolean",
                    "$value": false
                }
            },
            {
                "$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
                "Name": "CustomerTypeCode",
                "Value": "STF"
            },
            {
                "$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
                "Name": "IsMember",
                "Value": {
                    "$type": "System.Boolean",
                    "$value": false
                }
            },
            {
                "$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
                "Name": "IsInactiveMember",
                "Value": {
                    "$type": "System.Boolean",
                    "$value": false
                }
            },
            {
                "$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
                "Name": "AllowAdvanceRenewal",
                "Value": {
                    "$type": "System.Boolean",
                    "$value": false
                }
            },
            {
                "$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
                "Name": "JoinDate",
                "Value": "0001-01-01T00:00:00"
            },
            {
                "$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
                "Name": "ParentPartyId",
                "Value": "18013"
            },
            {
                "$type": "Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
                "Name": "FlowDownInstituteName",
                "Value": {
                    "$type": "System.Boolean",
                    "$value": false
                }
            }
        ]
    },
    "Addresses": {
        "$type": "Asi.Soa.Membership.DataContracts.FullAddressDataCollection, Asi.Contracts",
        "$values": [{
                "$type": "Asi.Soa.Membership.DataContracts.FullAddressData, Asi.Contracts",
                "AdditionalLines": {
                    "$type": "Asi.Soa.Membership.DataContracts.AddressLineDataCollection, Asi.Contracts",
                    "$values": [

                    ]
                },
                "Address": {
                    "$type": "Asi.Soa.Membership.DataContracts.AddressData, Asi.Contracts",
                    "AddressId": "8444",
                    "AddressLines": {
                        "$type": "Asi.Soa.Membership.DataContracts.AddressLineDataCollection, Asi.Contracts",
                        "$values": [
                            "8910 Sylvan Rdg"
                        ]
                    },
                    "CityName": "Eden Prairie",
                    "CountryCode": "US",
                    "CountryName": "United States",
                    "CountrySubEntityCode": "MN",
                    "CountrySubEntityName": "Minnesota",
                    "FullAddress": "8910 Sylvan Rdg\rEden Prairie, MN  55347-3336\rUNITED STATES",
                    "PostalCode": "55347-3336",
                    "VerificationStatus": 0
                },
                "AddresseeText": "Mr. Brian Murphy\r\n8910 Sylvan Rdg\rEden Prairie, MN  55347-3336\rUNITED STATES",
                "AddressPurpose": "Address",
                "CommunicationPreferences": {
                    "$type": "Asi.Soa.Membership.DataContracts.CommunicationPreferenceDataCollection, Asi.Contracts",
                    "$values": [{
                            "$type": "Asi.Soa.Membership.DataContracts.CommunicationPreferenceData, Asi.Contracts",
                            "Reason": "default"
                        },
                        {
                            "$type": "Asi.Soa.Membership.DataContracts.CommunicationPreferenceData, Asi.Contracts",
                            "Reason": "mail"
                        },
                        {
                            "$type": "Asi.Soa.Membership.DataContracts.CommunicationPreferenceData, Asi.Contracts",
                            "Reason": "bill"
                        },
                        {
                            "$type": "Asi.Soa.Membership.DataContracts.CommunicationPreferenceData, Asi.Contracts",
                            "Reason": "ship"
                        }
                    ]
                },
                "Email": "[email protected]",
                "Fax": "(516) 987-0000",
                "FullAddressId": "8444",
                "Note": "P.S.I. Code 9450",
                "Phone": "(516) 987-2222",
                "Salutation": {
                    "$type": "Asi.Soa.Membership.DataContracts.PartySalutationData, Asi.Contracts",
                    "SalutationMethod": {
                        "$type": "Asi.Soa.Membership.DataContracts.PartySalutationMethodSummaryData, Asi.Contracts",
                        "PartySalutationMethodId": "main"
                    },
                    "Text": "Mr. Brian Murphy"
                },
                "DisplayName": "Brian",
                "DisplayOrganizationTitle": "System Administrator",
                "DisplayOrganizationName": "iMIS International"
            },
            {
                "$type": "Asi.Soa.Membership.DataContracts.FullAddressData, Asi.Contracts",
                "AdditionalLines": {
                    "$type": "Asi.Soa.Membership.DataContracts.AddressLineDataCollection, Asi.Contracts",
                    "$values": [

                    ]
                },
                "Address": {
                    "$type": "Asi.Soa.Membership.DataContracts.AddressData, Asi.Contracts",
                    "AddressId": "13516",
                    "AddressLines": {
                        "$type": "Asi.Soa.Membership.DataContracts.AddressLineDataCollection, Asi.Contracts",
                        "$values": [
                            "3554 Maple Street"
                        ]
                    },
                    "CityName": "Edina",
                    "CountryCode": "US",
                    "CountryName": "United States",
                    "CountrySubEntityCode": "MN",
                    "CountrySubEntityName": "Minnesota",
                    "FullAddress": "3554 Maple Street\rEdina, MN  \rUNITED STATES",
                    "VerificationStatus": 0
                },
                "AddresseeText": "Mr. Brian Murphy\r\n3554 Maple Street\rEdina, MN  \rUNITED STATES",
                "AddressPurpose": "Home Address",
                "CommunicationPreferences": {
                    "$type": "Asi.Soa.Membership.DataContracts.CommunicationPreferenceDataCollection, Asi.Contracts",
                    "$values": [

                    ]
                },
                "FullAddressId": "13516",
                "Phone": "(917) 555-3434",
                "Salutation": {
                    "$type": "Asi.Soa.Membership.DataContracts.PartySalutationData, Asi.Contracts",
                    "SalutationMethod": {
                        "$type": "Asi.Soa.Membership.DataContracts.PartySalutationMethodSummaryData, Asi.Contracts",
                        "PartySalutationMethodId": "main"
                    },
                    "Text": "Mr. Brian Murphy"
                },
                "DisplayName": "Brian",
                "DisplayOrganizationTitle": "System Administrator",
                "DisplayOrganizationName": "iMIS International"
            }
        ]
    },
    "AlternateIds": {
        "$type": "Asi.Soa.Core.DataContracts.AlternateIdDataCollection, Asi.Contracts",
        "$values": [{
            "$type": "Asi.Soa.Core.DataContracts.AlternateIdData, Asi.Contracts",
            "Id": "18052",
            "IdType": "Id"
        }]
    },
    "Emails": {
        "$type": "Asi.Soa.Membership.DataContracts.EmailDataCollection, Asi.Contracts",
        "$values": [{
                "$type": "Asi.Soa.Membership.DataContracts.EmailData, Asi.Contracts",
                "Address": "[email protected]",
                "EmailType": "_Primary",
                "IsPrimary": true
            },
            {
                "$type": "Asi.Soa.Membership.DataContracts.EmailData, Asi.Contracts",
                "Address": "[email protected]",
                "EmailType": "Address"
            }
        ]
    },
    "FinancialInformation": {
        "$type": "Asi.Soa.Membership.DataContracts.FinancialInformationData, Asi.Contracts"
    },
    "Phones": {
        "$type": "Asi.Soa.Membership.DataContracts.PhoneDataCollection, Asi.Contracts",
        "$values": [{
                "$type": "Asi.Soa.Membership.DataContracts.PhoneData, Asi.Contracts",
                "Number": "(516) 987-2222",
                "PhoneType": "_Work Phone"
            },
            {
                "$type": "Asi.Soa.Membership.DataContracts.PhoneData, Asi.Contracts",
                "Number": "(791) 829-6838",
                "PhoneType": "Mobile"
            },
            {
                "$type": "Asi.Soa.Membership.DataContracts.PhoneData, Asi.Contracts",
                "Number": "(516) 987-2222",
                "PhoneType": "Address"
            },
            {
                "$type": "Asi.Soa.Membership.DataContracts.PhoneData, Asi.Contracts",
                "Number": "(516) 987-0000",
                "PhoneType": "Address Fax"
            },
            {
                "$type": "Asi.Soa.Membership.DataContracts.PhoneData, Asi.Contracts",
                "Number": "(917) 555-3434",
                "PhoneType": "Home Address"
            }
        ]
    },
    "Salutations": {
        "$type": "Asi.Soa.Membership.DataContracts.PartySalutationDataCollection, Asi.Contracts",
        "$values": [{
            "$type": "Asi.Soa.Membership.DataContracts.PartySalutationData, Asi.Contracts",
            "SalutationId": "18052",
            "SalutationMethod": {
                "$type": "Asi.Soa.Membership.DataContracts.PartySalutationMethodSummaryData, Asi.Contracts",
                "PartySalutationMethodId": "LIST_AS"
            },
            "Text": "Elaine Beauchamp"
        }]
    },
    "SortIsOverridden": false,
    "UpdateInformation": {
        "$type": "Asi.Soa.Core.DataContracts.EntityUpdateInformationData, Asi.Contracts",
        "CreatedBy": "AMOORE",
        "CreatedOn": "2011-04-07T09:52:19.65",
        "UpdatedBy": "AMOORE",
        "UpdatedOn": "2012-01-12T11:25:44.787"
    },
    "PartyId": "18052",
    "UniformId": "e2124f8b-39fa-4690-be19-0cfab0a1def5",
    "Name": "Mr. Brian Murphy",
    "Sort": "Milburn, George"
}