Type: BCS.Sym3.Operator.Runtime.IProductService
Product service
Properties
AllProducts
- Description: Gets list of product
- Type: ObservableCollection`1
- Access: Read
- Example:
This example shows you how to get the current number of product in the system.
print(Client.Products.AllProducts.Count);
Methods
Get(System.Int64)
Gets product by id. This is an internal unique id for a product. This is not a barcode value neither an official identifer. For internal use only.
- Parameters:
- id:
- Example:
This example shows you how to get a product by its id
var product = Client.Products.Get(235689547452);
SubscribeToPropertyChange(System.String)
Subscribe to a specific property change. The event ProductChanged will be fired if this property changed. Do not forget to unsubscribe if you don’t need to be notified anymore.
- Parameters:
- propertyName:
- Example:
This example shows you how to subscribe to a property change
//---- JAVASCRIPT:
Client.Products.SubscribeToPropertyChange("Identifier");
Client.Products.SubscribeToPropertyChange("MyUserDefinedProperty");
Client.Products.add_ProductChanged(OnProductChanged);
function OnProductChanged(product, propertyName, value) {
print(propertyName);
print(value);
print(product.Identifier);
}
//---- C#
Client.Products.SubscribeToPropertyChange("Identifier");
Client.Products.SubscribeToPropertyChange("MyUserDefinedProperty");
Client.Products.ProductChanged += new ProductChangedDelegate(Products_OnProductChanged);
...
private void Products_OnProductChanged(IProduct product, string propertyName, object value)
{
Console.Writeline(product.Identifed);
Console.Writeline(propertyName);
Console.Writeline(value);
}
UnsubscribeToPropertyChange(System.String)
Unsubscribe to a property change.
- Parameters:
- propertyName:
- Example:
This example shows you how to unsubscribe to a property change
//---- JAVASCRIPT:
Client.Products.SubscribeToPropertyChange("Identifier");
...
Client.Products.UnsubscribeToPropertyChange("Identifier");
//---- C#
Client.Products.SubscribeToPropertyChange("Identifier");
...
Client.Products.UnsubscribeToPropertyChange("Identifier");
Events
ProductChanged This event is fired when a product is changed. First you need to subscribe to a property using ‘SubscribeToPropertyChange’ method
- Example:
This example shows you how to subscribe to this event
//---- JAVASCRIPT:
Client.Products.SubscribeToPropertyChange("Identifier");
Client.Products.SubscribeToPropertyChange("MyUserDefinedProperty");
Client.Products.add_ProductChanged(OnProductChanged);
function OnProductChanged(product, propertyName, value) {
print(propertyName);
print(value);
print(product.Identifier);
}
//---- C#
Client.Products.SubscribeToPropertyChange("Identifier");
Client.Products.SubscribeToPropertyChange("MyUserDefinedProperty");
Client.Products.ProductChanged += new ProductChangedDelegate(Products_OnProductChanged);
...
private void Products_OnProductChanged(IProduct product, string propertyName, object value)
{
Console.Writeline(product.Identifed);
Console.Writeline(propertyName);
Console.Writeline(value);
}
ProductCreated This event is fired when a product is added
- Example:
This example shows you how to subscribe to this event
//---- JAVASCRIPT:
Client.Products.add_ProductCreated(OnProductCreated);
function OnProductCreated(product) {
print(product.Identifed);
print(product.Identifier);
}
//---- C#
Client.Products.ProductCreated += new ProductAddedDelegate(Products_OnProductCreated);
...
private void Products_OnProductCreated(IProduct product)
{
Console.Writeline(product.Identifed);
}
ProductDeleted This event is fired when a product is removed
- Example:
This example shows you how to subscribe to this event
//---- JAVASCRIPT:
Client.Products.add_ProductDeleted(OnProductDeleted);
function OnProductDeleted(product) {
print(product.Identifed);
print(product.Identifier);
}
//---- C#
Client.Products.ProductDeleted += new ProductDeletedDelegate(Products_OnProductDeleted);
...
private void Products_OnProductDeleted(IProduct product)
{
Console.Writeline(product.Identifed);
}