Initiate UserSession and DBSetting
Initiate UserSession and Connect to AutoCount Accounting 2.1
There are 3 methods to establish connection to AutoCount Accounting 2.1.
- Unattended connection without loading UI components
- Unattended connection that load UI components
- User login to establish connection (needs UI components)
UI Components require System.Windows.Forms and DevExpress winForm components.
Unattended Connection without loading UI components
Nuget package: AutoCount2.Accounting
Assemblies : |
|
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 : |
|
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 : |
|
internal AutoCount.Authentication.UserSession InitiateUserSessionWithLogin()
{
return AutoCount.MainEntry.MainStartup.Default.SubProjectStartupWithLogin("", "");
}