201a.GettingStarted

From AutoCount Resource Center
Jump to navigation Jump to search

Go to menu

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


AutoCount Accounting 1.8 Plug-in Tutorial

Getting Started

Introduction

 AutoCount Accounting provides integration solution for Software Developers to build attachable module(s) to enhance or customise AutoCount Accounting for today’s market requirements.

 AutoCount provides this tutorial for software developers to learn to develop AutoCount Accounting Plug-in through exercises.


Objectives

This tutorial is a getting started for software developer to build Plug-in for AutoCount Accounting.

  • Learn the Tools and Applications to build AutoCount Accounting Plug-in
  • Add menu function for the Plug-in
  • Add Form and Dialog Box
  • Load AutoCount Data from Microsoft SQL Server

Requirements in this tutorial

  • Experience in programming, and C# (C Sharp) programming language.
  • AutoCount Accounting version 1.8.25.
  • AutoCount Plug-in Builder with AutoCount Developer ID.
  • Development Tools & Programs
Comparison of AutoCount Accounting Major versions
AutoCount Accounting 1.8.25
or Higher
AutoCount Accounting 2.0
Development Tool Microsoft Visual Studio 2015
or development tool that supports Microsoft .Net Framework 4.0
Database Server Microsoft SQL Server 2008R2 SP2 & higher Microsoft SQL Server 2012 SP3 & higher
Framework Microsoft .Net Framework 4.0 Microsoft .Net Framework 4.5
Assemblies DevExpress WinForms Components 13.1.10 DevExpress WinForms Components 17.1.4



5 Basic Steps to Build AutoCount Accounting Plug-in Package

5 steps to successfully create a plug-in for AutoCount Accounting.

5Steps.BuildPlugin.png





IconExercise0.png

Exercise 1: Build My First Plug-In

Objectives: Create a new Plug-in project for AutoCount Accounting


This exercise is to build an AutoCount Accounting Plug-in Package, and successfully load the Plug-in at AutoCount Accounting Plug-in Manager.
Start Exercise 1




Plug-In Company Info and Properties

Developer's Company Information

Insert Company Information at the constructor of the class that inherits BCE.AutoCount.PlugIn.BasePlugIn.
public Plugin() : base(new Guid("37125E27-65B4-4B1D-9E1D-6FA67838E2BE"),
    "My First Plugin", "1.0.1")
{
    SetManufacturer("Auto Count Sdn. Bhd.");
    SetManufacturerUrl("http://www.autocountsoft.com");
    SetCopyright("Copyright 2015 © Auto Count Sdn. Bhd.");
    SetSalesPhone("1-800-88-7766");
    SetSupportPhone("+60-3-3324-2148");
}

SetMinimumAccountVersionRequired

  • SetMinimumAccountingVersionRequired is to control version compatibility of AutoCount Accounting and the plug-in.
    The string value is the lowest version of AutoCount Accounting that is required to load this plug-in.
public Plugin() : base(new Guid("37125E27-65B4-4B1D-9E1D-6FA67838E2BE"),
    "My First Plugin", "1.0.1")
{
    SetMinimumAccountingVersionRequired("1.8.25");
}

SetMinimumAccountingVersionRequired(“1.8.25”) version control is added, when AutoCount Accounting version must be equal or higher than 1.8.25.


Plug-In License Mode

SetIsFreeLicense

  • SetIsFreeLicense method is to set the license status of this plugin.
    Default value is true, when not specified.
public Plugin() : base(new Guid("37125E27-65B4-4B1D-9E1D-6FA67838E2BE"),
    "My First Plugin", "1.0.1")
{
    SetIsFreeLicense(false);
}

SetSupportLicenseKey

201a.LicenseStatus.png
  • SetSupportLicenseKey method enables [Enter License Key] button at Plug-In Manager.
    Default value is false, when not specified.
 1 public Plugin() : base(new Guid("37125E27-65B4-4B1D-9E1D-6FA67838E2BE"),
 2     "My First Plugin", "1.0.1")
 3 {
 4     SetManufacturer("Auto Count Sdn. Bhd.");
 5     SetManufacturerUrl("http://www.autocountsoft.com");
 6     SetCopyright("Copyright 2015 © Auto Count Sdn. Bhd.");
 7     SetSalesPhone("1-800-88-7766");
 8     SetSupportPhone("+60-3-3324-2148");
 9 
10     SetMinimumAccountingVersionRequired("1.8.25");
11     SetIsFreeLicense(false);
12     SetSupportLicenseKey(true);
13 }

Set Custom License Status

  • Beside the existing License Status, such as PermanentLicense, TemporaryLicense, and Unregistered. Custom license status can be defined.
  1. Call the method SetIsFreeLicense, and set it to false.
  2. Set the LicenseStatus properties to LicenseStatus.Custom.
  3. Then, assign string to CustomLicenseStatus.

    201a.LicenseStatus Custom s.png License Status is updated to "Beta version.".
 1 public class Plugin : BCE.AutoCount.PlugIn.BasePlugIn
 2 {
 3     public Plugin() : base(new Guid("37125E27-65B4-4B1D-9E1D-6FA67838E2BE"),
 4         "My First Plugin", "1.0.1")
 5     {
 6         SetIsFreeLicense(false);
 7     }
 8 
 9     public override void TestLicenseKey(LicenseStatusArgs e, string licenseKey)
10     {
11         e.LicenseStatus = LicenseStatus.Custom;
12         e.CustomLicenseStatus = "Beta version.";
13     }
14 }


Plug-In Menu and Function

Main Menu Caption

  • Set Main Menu Caption in BeforeLoad override method
    Default menu caption is "Plug-Ins".
 1 public class Plugin : BCE.AutoCount.PlugIn.BasePlugIn
 2 {
 3     public Plugin() : base(new Guid("37125E27-65B4-4B1D-9E1D-6FA67838E2BE"),
 4         "My First Plugin", "1.0.1")
 5     {
 6     }
 7 
 8     public override bool BeforeLoad(BeforeLoadArgs e)
 9     {
10         e.MainMenuCaption = "MyFirstPlugin";
11 
12         return base.BeforeLoad(e);
13     }
14 }

Sub Menu and Functions

Add Sub Menu that uses MenuItemAttribute (Attribute Class)

Attribute Class is a declarative method that is declared before a class,
where the class properties can be defined.
The method of the attribute has overloading methods which it supports Optional Parameter.
Method: BCE.AutoCount.PlugIn.MenuItem

Examples of defining Attribute:

//Simple MenuItemAttribute
[BCE.AutoCount.PlugIn.MenuItem("Greetings", 1)]
//Overload methods with addition parameters [BCE.AutoCount.PlugIn.MenuItem("Greetings", 1, false, "CMD_VIEW_FORM1", "CMD_OPEN_FORM1")]
//Attribute contains Optional Parameter [BCE.AutoCount.PlugIn.MenuItem("Greetings", MenuOrder=1)]
//Attribute contain Optional Parameter [BCE.AutoCount.PlugIn.MenuItem("Greetings", 1, OpenAccessRight="CMD_OPEN_FORM1", VisibleAccessRight="CMD_VIEW_FORM1")]
//Attribute contains Optional Parameter [BCE.AutoCount.PlugIn.MenuItem("Greetings", MenuOrder=1, BeginNewGroup=true, ParentMenuCaption="Group Menu", ParentMenuOrder=1, OpenAccessRight="CMD_OPEN_FORM1", VisibleAccessRight="CMD_VIEW_FORM1")]

This sample code shows where to use the attribute.

[BCE.AutoCount.PlugIn.MenuItem("Greetings", 1)]
class FormAbout : Form
{
    public FormAbout(BCE.Data.DBSetting dbSetting)
    {
    }
}



Add Sub Menu that inherits BCE.AutoCount.PlugIn.BaseMenuItem

  • Create a class that inherits from BCE.AutoCount.PlugIn.BaseMenuItem
class SubMenuAbout : BCE.AutoCount.PlugIn.BaseMenuItem
{
    public SubMenuAbout(BCE.Data.DBSetting dbSetting) : base("BaseMenuItem Sample", 90, true, "", "")
    {
    }

    public override void MenuItemClick(
             ISimpleThreadFormLauncher threadFormLauncher, DBSetting dbSetting)
    {
        threadFormLauncher.LaunchAppForm(typeof(AboutBox1).AssemblyQualifiedName);
        base.MenuItemClick(threadFormLauncher, dbSetting);
    }
}


IconExercise0.png

Exercise 2: Create Dialog Box

Objectives: Create "About" Dialog Box to display information of this plug-in.


This exercise shows the steps to create Dialog Box using Class Attribute.
Start Exercise 2


IconExercise0.png

Exercise 3: Create Form

Objectives: Create a windows form to load A/R Invoice, A/R Debit Note, A/R Credit Note and A/R Payment.


An example to load data and display on the Form.
Start Exercise 3



Summary

In this tutorial, you have learned;

  1. Apply Plug-In Entry Point
  2. Create Menu Item
  3. Create and build AutoCount Accounting plug-in.
  4. Access to MS SQL Server instance with DBSetting.
    You will learn more on BCE.Data.DBSetting as we progress.
  5. Load AutoCount Accounting data to a System.Data.DataTable.

Next tutorial, we look at the presentation of user interface, and design the UI that look and feel like AutoCount Accounting.

See Also