Initiate UserSession and DBSetting
Initiate UserSession and Connect to AutoCount Accounting 2.1
This document shows how programmer can create a new connection to AutoCount Accounting and initiate the system.
There are 3 methods to establish connection to AutoCount Accounting 2.1.
- Unattended connection without loading UI components
- Unattended connection that load UI components (needs UI components)
- User login to establish connection (needs UI components)
UI Components require System.Windows.Forms and DevExpress winForm components.
![]() |
UserSession must only initiate once in the application.
Do not create more than one instance in a running application. As it may consume system resource and has an impact on your application performance. |
![]() |
Plug-in development does not require to create new connection to AutoCount Accounting.
Because, user has already login to the account book. |
Unattended Connection without loading UI components
Nuget package: AutoCount2.Accounting
Assemblies : |
|
This MainEntry is commonly used for integration, or when no user login is required to access and initiate AutoCount Accounting, and it does not load UI components.
internal UserSession InitiateUserSessionUnattended(string serverName, string dbName, string userLogin, string userPasswd)
{
AutoCount.MainEntry.Startup startup = new AutoCount.MainEntry.Startup();
AutoCount.Data.DBSetting dbSetting = new AutoCount.Dadta.DBSetting(
DBServerType.SQL2000, serverName, dbName);
AutoCount.Authentication.UserSession userSession = new
AutoCount.Authentication.UserSession(dbSetting);
if (userSession.Login(userLogin, userPasswd))
{
//2nd parameter is to load plug-in when value is true.
//set 2nd parameter to false if do not want to load plug-in.
startup.SubProjectStartup(userSession, true);
}
return userSession;
}
Unattended connection that load UI components
Nuget package: AutoCount2.Accounting.UI
Assemblies : |
|
This MainEntry.UIStartup is similar to the MainEntry.Startup, except that it loads UI components. When MainEntry.UIStartup is used, AutoCount images and DevExpress are required.
internal UserSession InitiateUserSessionUnattendedWithUI(string serverName, string dbName, string userLogin, string userPasswd)
{
AutoCount.MainEntry.UIStartup startup = new AutoCount.MainEntry.UIStartup();
AutoCount.Data.DBSetting dbSetting = new AutoCount.Dadta.DBSetting(
DBServerType.SQL2000, serverName, dbName);
AutoCount.Authentication.UserSession userSession = new
AutoCount.Authentication.UserSession(dbSetting);
if (userSession.Login(userLogin, userPasswd))
{
//2nd parameter is to load plug-in when value is true.
//set 2nd parameter to false if do not want to load plug-in.
startup.SubProjectStartup(userSession, true);
}
return userSession;
}
User login to establish connection (needs UI components)
Nuget package: AutoCount2.MainEntry
Assemblies : |
|
This MainEntry opens the AutoCount Accounting user login form, and with successful login, it returns the object of the UserSession.
If user clicked [Cancel], the object of UserSession is null.
internal AutoCount.Authentication.UserSession InitiateUserSessionWithLogin()
{
return AutoCount.MainEntry.MainStartup.Default.SubProjectStartupWithLogin("", "");
}
![]() |
Go to top
|
![]() |
Resources For AutoCount Software Developers
|