HomeGuidesAPI ReferenceChangelogDiscussions
GuidesiMIS ProfessionaliMIS EnterpriseClient SupportLog In
Guides

Commerce Manager

Get item data

using System;
using Asi.Soa.ClientServices;
using Asi.Soa.Commerce.DataContracts;

// Initialize Entity and Commerce managers, item and party IDs
EntityManager entityManager = new EntityManager();

CommerceManager commerceManager = new CommerceManager(entityManager);

string itemId = "G15"; // Product code

// Use CommerceManager to return the item data by ID 
ItemData item = commerceManager.FindItemByItemId(itemId);

if (item != null)
{
  Console.WriteLine("Product Name: {0}", item.Name); // Modern Mug
  Console.WriteLine("Product Description: {0}",
                    item.Description); //A distinctive new shape keeps your coffee fresh and bright in this 14 oz mug!
}
using System;
using System.Net.Http;

const string itemId = "G15"; // Product code

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 item = Client.GetAsync($"api/item/{itemId}").Result;

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

/*
Product: {  
   "$type":"Asi.Soa.Commerce.DataContracts.ProductItemData, Asi.Contracts",
   "Weight":{  
      "$type":"System.Nullable`1[[Asi.Soa.Commerce.DataContracts.QuantityData, Asi.Contracts]], mscorlib",
      "Amount":0.50
   },
   "Image":{  
      "$type":"Asi.Soa.Core.DataContracts.VirtualFileData, Asi.Contracts",
      "VirtualPath":"~/images/samples/products/G15.png",
      "ThumbnailVirtualPath":"~/images/samples/products/G15_50x50.png"
   },
   "ImageUrl":"~/images/samples/products/G15.png",
   "ThumbnailUrl":"~/images/samples/products/G15.png",
   "HasPhysicalInventory":false,
   "PublishingInformation":{  
      "$type":"Asi.Soa.Core.DataContracts.PublishingInformationData, Asi.Contracts",
      "StartDate":null,
      "ExpirationDate":null,
      "Keywords":{  
         "$type":"System.Collections.ObjectModel.Collection`1[[System.String, mscorlib]], mscorlib",
         "$values":[  

         ]
      },
      "PublishingState":0
   },
   "TempDefaultPrice":6.2000,
   "ItemFinancialInformation":{  
      "$type":"Asi.Soa.Commerce.DataContracts.ItemFinancialInformationData, Asi.Contracts",
      "FinancialEntity":{  
         "$type":"Asi.Soa.Commerce.DataContracts.FinancialEntityData, Asi.Contracts",
         "EntityCode":""
      },
      "TaxCategory":{  
         "$type":"Asi.Soa.Commerce.DataContracts.TaxCategorySummaryData, Asi.Contracts",
         "Name":"Taxable",
         "TaxCategoryId":"Taxable",
         "Description":"Taxable"
      },
      "IncursShipping":true,
      "ItemFinancialAccounts":{  
         "$type":"Asi.Soa.Commerce.DataContracts.ItemFinancialAccountsData, Asi.Contracts",
         "AccountsReceivable":{  
            "$type":"Asi.Soa.Commerce.DataContracts.FinancialAccountData, Asi.Contracts"
         },
         "Income":{  
            "$type":"Asi.Soa.Commerce.DataContracts.FinancialAccountData, Asi.Contracts",
            "GLAccount":{  
               "$type":"Asi.Soa.Commerce.DataContracts.GLAccountData, Asi.Contracts",
               "GLAccountId":"",
               "GLAccountCode":"",
               "Name":""
            }
         },
         "Inventory":{  
            "$type":"Asi.Soa.Commerce.DataContracts.FinancialAccountData, Asi.Contracts",
            "GLAccount":{  
               "$type":"Asi.Soa.Commerce.DataContracts.GLAccountData, Asi.Contracts",
               "GLAccountId":"",
               "GLAccountCode":"",
               "Name":""
            }
         },
         "CostOfGoodsSold":{  
            "$type":"Asi.Soa.Commerce.DataContracts.FinancialAccountData, Asi.Contracts",
            "GLAccount":{  
               "$type":"Asi.Soa.Commerce.DataContracts.GLAccountData, Asi.Contracts",
               "GLAccountId":"",
               "GLAccountCode":"",
               "Name":""
            }
         },
         "InventoryAdjustments":{  
            "$type":"Asi.Soa.Commerce.DataContracts.FinancialAccountData, Asi.Contracts",
            "GLAccount":{  
               "$type":"Asi.Soa.Commerce.DataContracts.GLAccountData, Asi.Contracts",
               "GLAccountId":"",
               "GLAccountCode":"",
               "Name":""
            }
         },
         "DamagedGoods":{  
            "$type":"Asi.Soa.Commerce.DataContracts.FinancialAccountData, Asi.Contracts"
         },
         "DeferredIncome":{  
            "$type":"Asi.Soa.Commerce.DataContracts.FinancialAccountData, Asi.Contracts",
            "GLAccount":{  
               "$type":"Asi.Soa.Commerce.DataContracts.GLAccountData, Asi.Contracts",
               "GLAccountId":"",
               "GLAccountCode":"",
               "Name":""
            }
         }
      }
   },
   "FairMarketValue":{  
      "$type":"Asi.Soa.Core.DataContracts.MonetaryAmountData, Asi.Contracts",
      "Amount":5.0000,
      "Currency":{  
         "$type":"Asi.Soa.Core.DataContracts.CurrencyData, Asi.Contracts",
         "CurrencyCode":"USD",
         "DecimalPositions":2,
         "ExtensionData":null
      },
      "IsAmountDefined":true
   },
   "AdditionalAttributes":{  
      "$type":"Asi.Soa.Core.DataContracts.GenericPropertyDataCollection, Asi.Contracts",
      "$values":[  
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"TAXABLE",
            "Value":{  
               "$type":"System.Boolean",
               "$value":true
            }
         },
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"PST_TAXABLE",
            "Value":{  
               "$type":"System.Boolean",
               "$value":false
            }
         },
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"TAX_AUTHORITY",
            "Value":""
         },
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"TAX_BY_LOCATION",
            "Value":{  
               "$type":"System.Boolean",
               "$value":false
            }
         },
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"TAXCATEGORY_CODE",
            "Value":""
         },
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"WEBOPTION",
            "Value":{  
               "$type":"System.Int32",
               "$value":2
            }
         },
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"IsBillingBaseItem",
            "Value":{  
               "$type":"System.Boolean",
               "$value":false
            }
         },
         {  
            "$type":"Asi.Soa.Core.DataContracts.GenericPropertyData, Asi.Contracts",
            "Name":"PayPriority",
            "Value":{  
               "$type":"System.Int32",
               "$value":0
            }
         }
      ]
   },
   "IsPremium":false,
   "PremiumInformation":{  
      "$type":"Asi.Soa.Commerce.DataContracts.PremiumInformationData, Asi.Contracts",
      "RequiredGiftAmount":{  
         "$type":"Asi.Soa.Core.DataContracts.MonetaryAmountData, Asi.Contracts",
         "Currency":{  
            "$type":"Asi.Soa.Core.DataContracts.CurrencyData, Asi.Contracts",
            "CurrencyCode":"USD",
            "DecimalPositions":2,
            "ExtensionData":null
         },
         "IsAmountDefined":true
      }
   },
   "AllowOrderLineNote":false,
   "Description":"A distinctive new shape keeps your coffee fresh and bright in this 14 oz mug!",
   "ItemClass":{  
      "$type":"Asi.Soa.Commerce.DataContracts.ItemClassSummaryData, Asi.Contracts",
      "ItemClassId":"SALES-GIFTS",
      "Name":"Gifts"
   },
   "ItemCode":"G15",
   "ItemId":"G15",
   "Name":"Modern Mug"
}
*/

Get item price for party

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

EntityManager entityManager = new EntityManager();

string itemId = "G15"; // Product code
string partyId = "18043"; // Chris Baker

// Use GetPartyItemPrice to return the price 
PartyItemPriceData partyItemPriceData = CommerceManager.GetPartyItemPrice(entityManager, itemId, partyId);
if (partyItemPriceData != null)
{
  Console.WriteLine("Product - Name: {0}, Price: {1}", partyItemPriceData.Item.Name,
                    partyItemPriceData.SelectedPrice);
}
using System;
using System.Net.Http;

const string itemId = "G15"; // Product code
const string partyId = "18052"; // Brian Murphy

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 partyItemPrice = client
  .GetAsync($"api/partyitemprice?Id={partyId}&ItemId={itemId}").Result;

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

/*
Party Item Price: {"$type":"Asi.Soa.Core.DataContracts.PagedResult`1[[Asi.Soa.Commerce.DataContracts.PartyItemPriceData, Asi.Contracts]], Asi.Contracts",
   "Items":{  
      "$type":"System.Collections.Generic.List`1[[Asi.Soa.Commerce.DataContracts.PartyItemPriceData, Asi.Contracts]], mscorlib",
      "$values":[  
         {  
            "$type":"Asi.Soa.Commerce.DataContracts.PartyItemPriceData, Asi.Contracts",
            "Party":{  
               "$type":"Asi.Soa.Membership.DataContracts.PartySummaryData, Asi.Contracts",
               "CityName":"Eden Prairie",
               "CountryName":"United States",
               "CountrySubEntityName":"MN",
               "Email":"[email protected]",
               "Phone":"(516) 987-2222",
               "PartyId":"18052",
               "Id":"18052",
               "Status":{  
                  "$type":"Asi.Soa.Membership.DataContracts.PartyStatusData, Asi.Contracts",
                  "PartyStatusId":"A",
                  "Name":"Active",
                  "Description":"Active"
               },
               "Name":"Mr. Brian Murphy",
               "Sort":"MURPHY, BRIAN",
               "IsMarkedForDelete":false
            },
            "Item":{  
               "$type":"Asi.Soa.Commerce.DataContracts.ItemSummaryData, Asi.Contracts",
               "Description":"A distinctive new shape keeps your coffee fresh and bright in this 14 oz mug!",
               "ItemClass":{  
                  "$type":"Asi.Soa.Commerce.DataContracts.ItemClassSummaryData, Asi.Contracts",
                  "ItemClassId":"SALES-GIFTS",
                  "Name":"SALES-GIFTS"
               },
               "ItemId":"G15",
               "Name":"Modern Mug"
            },
            "SelectedPriceSheet":{  
               "$type":"Asi.Soa.Commerce.DataContracts.PriceSheetSummaryData, Asi.Contracts",
               "Description":"Non-Member pricing",
               "Name":"Standard",
               "PriceSheetId":"Standard"
            },
            "SelectedPrice":{  
               "$type":"Asi.Soa.Core.DataContracts.MonetaryAmountData, Asi.Contracts",
               "Amount":6.2,
               "Currency":{  
                  "$type":"Asi.Soa.Core.DataContracts.CurrencyData, Asi.Contracts",
                  "CurrencyCode":"USD",
                  "DecimalPositions":2,
                  "ExtensionData":null
               },
               "IsAmountDefined":true
            },
            "StandardPriceSheet":{  
               "$type":"Asi.Soa.Commerce.DataContracts.PriceSheetSummaryData, Asi.Contracts",
               "Description":"Non-Member pricing",
               "Name":"Standard",
               "PriceSheetId":"Standard"
            },
            "StandardPrice":{  
               "$type":"Asi.Soa.Core.DataContracts.MonetaryAmountData, Asi.Contracts",
               "Amount":6.2,
               "Currency":{  
                  "$type":"Asi.Soa.Core.DataContracts.CurrencyData, Asi.Contracts",
                  "CurrencyCode":"USD",
                  "DecimalPositions":2,
                  "ExtensionData":null
               },
               "IsAmountDefined":true
            },
            "DiscountPriceSheet":{  
               "$type":"Asi.Soa.Commerce.DataContracts.PriceSheetSummaryData, Asi.Contracts",
               "Description":"Member pricing",
               "Name":"Member",
               "PriceSheetId":"Member"
            },
            "DiscountPrice":{  
               "$type":"Asi.Soa.Core.DataContracts.MonetaryAmountData, Asi.Contracts",
               "Amount":5.1,
               "Currency":{  
                  "$type":"Asi.Soa.Core.DataContracts.CurrencyData, Asi.Contracts",
                  "CurrencyCode":"USD",
                  "DecimalPositions":2,
                  "ExtensionData":null
               },
               "IsAmountDefined":true
            }
         }
      ]
   },
   "Offset":0,
   "Limit":100,
   "Count":1,
   "TotalCount":1,
   "NextPageLink":null,
   "HasNext":false,
   "NextOffset":0
}
*/