• Oracle Micros Point of Sale
  • Tools
    • QR Code Printing
    • ISLCrypt & ISLDecrypt
  • Blog
  • Contact
Micros POS Tools

SIM Scripts in Simphony

8/11/2020

1 Comment

 
If you are familiar with SIM Scripts (ISL Scripts) in the Oracle Micros Point of Sale product range then you will surely understand the pain of trying to do any complex work.

In Simphony versions 2 and above there have been some major enhancements to how SIM scripts can be written. We can now directly interact with .NET class libraries. This gives us the ability to move our complex logic into external libraries, create rich and fully featured user interfaces, interface to 3rd party applications and API's.

How does this work I hear you ask. Read on and ill show an example.

Simple C# Class Library Code

We shall compile the below code into a library called SimTestExample.dll


using System.Collections.Generic;

namespace SimTestExample
{
    public class DoWork
    {
        public int Value { get; set; }

        public DoWork(int value)
        {
            Value = value;
        }

        public List<DataModel> DoSomeTask()
        {
            // You can do whatever you need here and return a result to SIM

            var ResultList = new List<DataModel>();

            ResultList.Add(new DataModel() { Name = "jim", Value = 100.00m });
            ResultList.Add(new DataModel() { Name = "mark", Value = 200.00m });

            return ResultList;
        }
    }

    public class DataModel
    {
        public string Name { get; set; }

        public decimal Value { get; set; }
    }
}



SIM script to use the SimTestExample.dll

The below script is a very simple example of how to call a .NET DLL from a SIM script.
// multiple namespaces can be imported by separating them with a comma
NetImport SimTestExample from "C:\MyLibrary\SimTestExample.dll"

Event Inq : 1

    var Worker : object
    var ResultList : object

    Worker = new DoWork(1)
    infomessage Worker.Value // This will display a message box with a value of 1.

    ResultList = Worker.DoSomeTask() // ResultList will be populated with the List<DataModel> from our library.
    infomessage ResultList[1].Name // This will display a message box with a value of mark. 

EndEvent





1 Comment

    Author

    Developer and Blogger about Micros POS Products.

    Archives

    August 2020
    June 2012

    Categories

    All
    3700
    9700
    E7
    Simphony

    RSS Feed

Powered by Create your own unique website with customizable templates.