Programmer:Simple program to test connection to AutoCount Accounting: Difference between revisions

From AutoCount Resource Center
Content added Content deleted
mNo edit summary
No edit summary
Line 4: Line 4:
In order to connect to one of the account book in AutoCount Accounting, there are few steps to start with.
In order to connect to one of the account book in AutoCount Accounting, there are few steps to start with.
To understand each of the step, a program is written to test the result of each step.
To understand each of the step, a program is written to test the result of each step.
<br />
STEP 1. Create DBSetting
STEP 1. Create DBSetting
STEP 2. Create SubProjectStartup
STEP 2. Create SubProjectStartup
Line 42: Line 41:
<br />
<br />
{{Note|Success of created '''DBSetting''' does not justify whether the provided information connecting to SQL Server is correct.<br />'''DBSetting''' merely hold the information that is essential to connect SQL Server.}}
{{Note|Success of created '''DBSetting''' does not justify whether the provided information connecting to SQL Server is correct.<br />'''DBSetting''' merely hold the information that is essential to connect SQL Server.}}

<br />
<br />
==SubProjectStartup==
==SubProjectStartup==
'''SubProjectStartup''' is to initialize AutoCount Accounting system, while it also perform below two important tasks:-
#Whether to load plug-in
#Load account book Licensing.

4 overloading methods of '''SubProjectStartup'''
<syntaxhighlight lang="csharp">
//Does not load Plug-In
//Load license control by license code
void BCE.AutoCount.MainEntry.Startup.Default.SubProjectStartup(DBSetting dbSetting);

//Programmer define whether plug-in will be loaded
//Load license control by license code
void BCE.AutoCount.MainEntry.Startup.Default.SubProjectStartup(DBSetting dbSetting, BCE.AutoCount.MainEntry.StartupPlugInOption loadPlugInOption);

//Programmer define whether plug-in will be loaded
//Programmer define which type of license control to be loaded, either License Code or Dongle
void BCE.AutoCount.MainEntry.Startup.Default.SubProjectStartup(DBSetting dbSetting, BCE.AutoCount.MainEntry.StartupPlugInOption loadPlugInOption,
BCE.AutoCount.MainEntry.StartupLicenseControlType slcType);

//Programmer define whether plug-in will be loaded
//Programmer define which type of license control to be loaded, either License Code or Dongle
//and define the dongle server
void BCE.AutoCount.MainEntry.Startup.Default.SubProjectStartup(DBSetting dbSetting, BCE.AutoCount.MainEntry.StartupPlugInOption loadPlugInOption,
BCE.AutoCount.MainEntry.StartupLicenseControlType slcType, string dgServerName, int dgServerPort);
</syntaxhighlight>


===InvalidLCPFileException===
'''Invalid LCP File Exception''' is common error when calling SubProjectStartup or SubProjectStartupWithLogin when loading from a ''standalone program'' or ''web application''.

Exception Namespace: BCE.LCP.InvalidLCPDecryptFileException
[[File:ProgramInvalidLCP.png|link=]]

====Solution====
Include LCP files together with your exe or dll which is calling SubProjectStartup.<br /><br />
*To let Visual Studio copy these files to output folder for debugging, follow steps below:
# Find these files in AutoCount Accounting folder.
#* LCPDecrypt.wdl
#* LCPDecrypt2.exe
#* LCPDecrypt2.wdl
#* LCPDecryptApp.exe
#Add these files to your Project as existing items.
#* Set Build Action = none (empty)
#* Copy to Output = Copy if newer
:So that these files will be copied to your project output folder.

<br />
==Login to AutoCount Accounting==





Revision as of 09:41, 2 March 2018

Under Construction


Introduction

In order to connect to one of the account book in AutoCount Accounting, there are few steps to start with.
To understand each of the step, a program is written to test the result of each step.
STEP 1. Create DBSetting
STEP 2. Create SubProjectStartup
STEP 3. Login to AutoCount Accounting
[ Download Sample Project] (Visual Studio 2015)

Sample project to test connection to AutoCount Accounting.


DBSetting

DBSetting is one of the most frequently use class in AutoCount Accounting, whether it is plug-in or integrating system.
Even when writing scripting for report script or application script, you may find the information of DBSetting is provided.

During its creation, two pieces of information is important, they are the server name and database name.
Namespace: BCE.Data

Create DBSetting with AutoCount default configuration

DBSetting object can be created with new operator, or via SubProjectStartupWithLogin method.
Below example code shows the DBSetting is created with new operator.

BCE.Data.DBSetting dbSetting = new BCE.Data.DBSetting(DBServerType.SQL2000, serverName, dbName);
  • DBServerType which is the First parameter is always DBServerType.SQL2000, regardless of which Microsoft SQL Server version is being applied.
  • Server name and database name can be obtain at the login screen of AutoCount Accounting.

Create DBSetting while specifying SQL sa password

BCE.Data.DBSetting dbSetting = new BCE.Data.DBSetting(DBServerType.SQL2000, serverName, "sa", "mYsApAsSwOrD", dbName);
  • sa login password can be omitted when the password is using AutoCount default sa login password.
  • Specify the sa password only when System Administrator has changed the sa password.


Success of created DBSetting does not justify whether the provided information connecting to SQL Server is correct.
DBSetting merely hold the information that is essential to connect SQL Server.


SubProjectStartup

SubProjectStartup is to initialize AutoCount Accounting system, while it also perform below two important tasks:-

  1. Whether to load plug-in
  2. Load account book Licensing.

4 overloading methods of SubProjectStartup

//Does not load Plug-In
//Load license control by license code
void BCE.AutoCount.MainEntry.Startup.Default.SubProjectStartup(DBSetting dbSetting);

//Programmer define whether plug-in will be loaded
//Load license control by license code
void BCE.AutoCount.MainEntry.Startup.Default.SubProjectStartup(DBSetting dbSetting, BCE.AutoCount.MainEntry.StartupPlugInOption loadPlugInOption);

//Programmer define whether plug-in will be loaded
//Programmer define which type of license control to be loaded, either License Code or Dongle
void BCE.AutoCount.MainEntry.Startup.Default.SubProjectStartup(DBSetting dbSetting, BCE.AutoCount.MainEntry.StartupPlugInOption loadPlugInOption,
    BCE.AutoCount.MainEntry.StartupLicenseControlType slcType);

//Programmer define whether plug-in will be loaded
//Programmer define which type of license control to be loaded, either License Code or Dongle
//and define the dongle server
void BCE.AutoCount.MainEntry.Startup.Default.SubProjectStartup(DBSetting dbSetting, BCE.AutoCount.MainEntry.StartupPlugInOption loadPlugInOption,
    BCE.AutoCount.MainEntry.StartupLicenseControlType slcType, string dgServerName, int dgServerPort);


InvalidLCPFileException

Invalid LCP File Exception is common error when calling SubProjectStartup or SubProjectStartupWithLogin when loading from a standalone program or web application.

Exception Namespace: BCE.LCP.InvalidLCPDecryptFileException

Solution

Include LCP files together with your exe or dll which is calling SubProjectStartup.

  • To let Visual Studio copy these files to output folder for debugging, follow steps below:
  1. Find these files in AutoCount Accounting folder.
    • LCPDecrypt.wdl
    • LCPDecrypt2.exe
    • LCPDecrypt2.wdl
    • LCPDecryptApp.exe
  2. Add these files to your Project as existing items.
    • Set Build Action = none (empty)
    • Copy to Output = Copy if newer
So that these files will be copied to your project output folder.


Login to AutoCount Accounting


Go to menu

Go to top
Resources For AutoCount Software Developers