...
Often used to store SQL Scripts for deployment, but can be any binary file store.
Code
...
General coding guidelines
Be Tidy
Delete any classes automatically created that you are not usingused
Delete any using (or Imports in VB) statements you are not usingthat are not necessary
Don’t comment out code, delete it
Align code blocks consistently
Don’t leave multiple blank lines - there is no reason to have two or more consecutive blank lines.
Group like things together - such as event handlers together
Use regions to group related classes, methods or properties together
Be Consistent
Use consistent case conventions - ours have evolved to:
PascalCase for Class, Property and Method names
camelCase for local variables or anything not publicly accessible
Use consistent plural / singular
Tables and classes are singular - eg: SalesOrder not SalesOrders
Lists and Collections are plural - eg: SalesOrders
Be Clear
Comment what the code is doing, but sensibly.
Don’t use overly terse names - invemadd is not acceptable, invoiceEmailAddress is.
Understanding Plugin Classes
It is important to understand that some plugin classes are created and instantiated at logon time, and the same instance is used to invoke the methods within the class.
...
Each time the sales order form or quote form is loaded, a messagebox displays an incrementing number - illustrating that the variable Counter and hence the class is not created when the form is, but the same class instance is invoked when forms are loaded.
FormPlugin class
The FormPlugin class implements the IJiwaFormPlugin interface - it contains two methods of interest - SetupBeforeHandlers and Setup.
SetupBeforeHandlers
When a form is created via the FormFactory (as all forms in Jiwa are), if the form is registered on the Forms tab of the plugin, then the SetupBeforeHandlers method of the FormPlugin class is invoked after the form is created, but before the form has added any event handlers for the control or business logic.
...
Code Block | ||
---|---|---|
| ||
public void SetupBeforeHandlers(JiwaFinancials.Jiwa.JiwaApplication.IJiwaForm JiwaForm, JiwaFinancials.Jiwa.JiwaApplication.Plugin.Plugin Plugin) { if (JiwaForm is JiwaFinancials.Jiwa.JiwaPurchaseOrdersUI.MainForm) { // the Purchase Order form } else { // some other form } } |
Setup
The Setup method, like the SetupBeforeHandlers method, is only invoked if the form is registered on the Forms tab of the plugin, but the Setup method is invoked after the form has added its event handlers for controls and business logic.
Typically this is where custom controls are defined and added to the form, and where handlers to business logic or form control events are added.
BusinessLogicPlugin class
The BusinessLogicPlugin class implements the IJiwaBusinessLogicPlugin interface, and has only one method of interest - Setup.
...