Difference between revisions of "How AutoCount Application Script Works"

From AutoCount Resource Center
Jump to navigation Jump to search
m
m
Line 1: Line 1:
==Introduction==
+
AutoCount Application Script provides flexibility and expandability for programmers to enhance application's (AutoCount Accounting) calculation, accessible, layout and etc. at runtime.<br />
AutoCount Application Script provides flexibility and expandability for programmers to enhance application's (AutoCount Accounting) calculation, accessible, layout and etc. at runtime.<br />
 
  
 
  '''How Application Script works?'''
 
  '''How Application Script works?'''
  When a specific action is called in the application, it fires events call.
+
  When a specific action is called in the application, it fires events call. Method that is matching the method's name and signature of the event will be fired.<br />
Method that is matching the method's name and signature of the event will be fired.<br />
 
 
<br />
 
<br />
  
==Example of '''OnNewDocument ''event method'''''==
+
'''Example of OnNewDocument ''event method'''''
  
Take OnNewDocument of Sale Invoice for example.
+
Take OnNewDocument for example.
  
 
<syntaxhighlight lang="csharp">
 
<syntaxhighlight lang="csharp">
Line 22: Line 20:
 
#The class that encapsulate OnNewDocument must be registered with correct '''script name''';<syntaxhighlight lang="csharp">BCE.AutoCount.Scripting.ScriptManager.GetOrCreate(dbSetting).RegisterByType("IV", typeof(InvoiceScript));</syntaxhighlight>The class '''InvoiceScript''' is registered with a script name of "IV", which the script name must be recognized in AutoCount Accounting.<br /><br />
 
#The class that encapsulate OnNewDocument must be registered with correct '''script name''';<syntaxhighlight lang="csharp">BCE.AutoCount.Scripting.ScriptManager.GetOrCreate(dbSetting).RegisterByType("IV", typeof(InvoiceScript));</syntaxhighlight>The class '''InvoiceScript''' is registered with a script name of "IV", which the script name must be recognized in AutoCount Accounting.<br /><br />
 
#'''Name of the method''' such as OnNewDocument, must be identical to the name that has been defined in AutoCount Accounting.<br /><br />
 
#'''Name of the method''' such as OnNewDocument, must be identical to the name that has been defined in AutoCount Accounting.<br /><br />
#'''Argument of the method''' must be same as the Argument that is defined in the Event Method.<br \>The event method of OnNewDocument's Event Argument is '''BCE.AutoCount.Invoicing.Sales.Invoice.InvoiceEventArgs'''.<br />The Event Arguments holds necessary objects and properties that are passed from application.
+
#'''Argument''' of the method must be same as the Argument that is defined in the Event Method.<br \>The event method of OnNewDocument's Event Argument is '''BCE.AutoCount.Invoicing.Sales.Invoice.InvoiceEventArgs'''.<br />The Event Arguments holds necessary objects and properties that are passed from application.
  
 
[[Category:Programmer]]
 
[[Category:Programmer]]
 
[[Category:AppScript]]
 
[[Category:AppScript]]
 
{{NavigateDeveloper}}
 
{{NavigateDeveloper}}

Revision as of 03:06, 17 July 2018

AutoCount Application Script provides flexibility and expandability for programmers to enhance application's (AutoCount Accounting) calculation, accessible, layout and etc. at runtime.
How Application Script works?
When a specific action is called in the application, it fires events call. Method that is matching the method's name and signature of the event will be fired.


Example of OnNewDocument event method

Take OnNewDocument for example.

public void OnNewDocument(BCE.AutoCount.Invoicing.Sales.Invoice.InvoiceEventArgs e)
{
    BCE.Application.AppMessage.ShowMessage("Hello AutoCount Application Script");
}
  • OnNewDocument event method is fired when the application opens a new document.

  • Which then statement (scripting) in OnNewDocument event method can be executed;
    In this example, a message "Hello AutoCount Application Script" is prompted, when OnNewDocument is fired.

  • In order for the application to fire OnNewDocument method, it requires:-
  1. The class that encapsulate OnNewDocument must be registered with correct script name;
    BCE.AutoCount.Scripting.ScriptManager.GetOrCreate(dbSetting).RegisterByType("IV", typeof(InvoiceScript));
    
    The class InvoiceScript is registered with a script name of "IV", which the script name must be recognized in AutoCount Accounting.

  2. Name of the method such as OnNewDocument, must be identical to the name that has been defined in AutoCount Accounting.

  3. Argument of the method must be same as the Argument that is defined in the Event Method.
    The event method of OnNewDocument's Event Argument is BCE.AutoCount.Invoicing.Sales.Invoice.InvoiceEventArgs.
    The Event Arguments holds necessary objects and properties that are passed from application.

Go to menu

IconAC81.png Go to top
ProgrammerGo.jpg Resources For AutoCount Software Developers