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

no edit summary
mNo edit summary
No edit summary
 
(17 intermediate revisions by the same user not shown)
Line 1:
==Version Applicable==
AutoCount Accounting '''1.8.30'''.136 and higher
 
==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 stepsteps, a program is written to test the result of each step.<br />
STEP 1. Create DBSetting
STEP 2. Call (Create) SubProjectStartup
STEP 3. Login to AutoCount Accounting
 
Line 11 ⟶ 14:
 
==DBSetting==
'''DBSetting''' is one of the most frequently useused 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 informationobject of DBSetting is provided.<br />
DBSetting is required by all transactions and documents when accessing to database server.<br />
<br />
Moreover, it provides methods such as GetDataTable(...), ExecuteScalar(...), ExecuteNonQuery(...) and more for programmer to easily access to currently connected account book.<br />
During its creation, two pieces of information is important, they are the '''server name''' and '''database name'''.
 
Line 31 ⟶ 35:
::[[File:ProgramLoginForm.png|450px|link=]]
<br />
===Create DBSetting while specifying SQL Server sa password===
<syntaxhighlight lang="csharp">
BCE.Data.DBSetting dbSetting = new BCE.Data.DBSetting(DBServerType.SQL2000, serverName, "sa", "mYsApAsSwOrD", dbName);
</syntaxhighlight>
* sa login password can be omitted when the password is using AutoCount default sa login password.
* Specify the sa password only when Systemsa Administratorpassword has been changed the sa password.
<br />
{{Warn|Success of created '''DBSetting''' does not justify whether the provided information connecting to SQL Server is correct.<br />'''DBSetting''' merely holdsstore the information that is essential to connect SQL Server.}}
 
<br />
==SubProjectStartupWithLogin==
 
==SubProjectStartupWithLogin==
*When using '''SubProjectStartupWithLogin''' it does the following tasks:
*#Return DBSetting upon success login. Whereas, return null when user '''clicks cancel'''.
*#Initiate AutoCount Accounting system
*#Login to AutoCount Accounting
<br />
<syntaxhighlight lang="csharp">
BCE.Data.DBSetting dbSetting = BCE.AutoCount.MainEntry.Startup.Default.SubProjectStartupWithLogin("", "");
 
//dbSetting is null when user did not login by pressing 'Cancel'
if (dbSetting != null)
{
Line 60 ⟶ 70:
 
{{Note|When calling '''SubProjectStartupWithLogin''', it prompts login form for user to input.<br />Upon successful login, it returns DBSetting, initialized AutoCount Accounting system and Login to AutoCount Accounting.<br />If user cancel login, the return value of DBSetting is null.}}
<br />
 
==SubProjectStartup==
When call SubProjectStartup, DBSetting object must be created before '''SubProjectStartup''' can be used.<br />
It does not return any result.
It throws exception, when error is encountered.
 
'''SubProjectStartup''' is to initialize AutoCount Accounting system, while it also perform below two important tasks:-
#Whether to load plug-in<br />Some plug-in may contain script that calculate the subtotal which may require to be loaded.
Line 69 ⟶ 83:
===Four 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
Line 81 ⟶ 98:
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
Line 87 ⟶ 105:
void BCE.AutoCount.MainEntry.Startup.Default.SubProjectStartup(DBSetting dbSetting, BCE.AutoCount.MainEntry.StartupPlugInOption loadPlugInOption,
BCE.AutoCount.MainEntry.StartupLicenseControlType slcType, string dgServerName, int dgServerPort);
 
</syntaxhighlight>
*There are 4 overloading methods when calling '''SubProjectStartup''' (Reference of version 1.8.30.186)
**Prior to version 1.8.30.186, '''SubProjectStatup''' does not include the parameter of '''StartupPlugInOption''';
**'''StartupPlugInOption''' allows programmer to set whether to load plug-in, when AutoCount Accounting is initialized.
*Dongle server name is the IP address of the computer where '''USB Key Server''' (windows service) is installed.
*The dongle's default server port is 9560.
Line 94 ⟶ 115:
**Default value is used when port is not defined in SubProjectStartup.
<br />
{{Warn|For inter-billing orand integration, if '''StartupPlugInOption.LoadStandardPlugIn''' is not stated in SubProjectStartup, the target account book will not load plug-in that has/have installed.}}
 
 
Line 115 ⟶ 136:
#* Copy to Output = Copy if newer
:So that these files will be copied to project output folder.
:Refer to [[Invalid LCPDecryptFileException was unhandled]]
 
<br />
Line 135 ⟶ 157:
<br/>
==See Also==
*[[Programmer:CreateSimple BCE.Data.DBSettingprogram withto Databasetest Infoconnection to AutoCount Accounting v2|CreateA BCE.Data.DBSettingsimple program withto Databasetest Infoconnection into AutoCount Accounting 12.80]]
*[[Programmer:Simple program to test connection to AutoCount Accounting|A simple program to test connection to AutoCount Accounting 1.8/1.9]]
 
*[[Programmer:Create BCE.Data.DBSetting with Database Info|Create BCE.Data.DBSetting with Database Info in AutoCount Accounting 1.8/1.9]]
*[[Invalid LCPDecryptFileException was unhandled]]
<br />
[[Category:Programmer]]