-
Notifications
You must be signed in to change notification settings - Fork 9
The Register Module file
Mauro Rogledi edited this page Feb 28, 2018
·
6 revisions
internal class RegisterModule : ERPFramework.Data.RegisterModule
{
public override string Application()
{
return "ERPA";
}
public override string Module()
{
return "ERPC";
}
public override int CurrentVersion()
{
return 1;
}
public override Version DllVersion
{
get
{
return System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
}
}
public override void RegisterCountersAndCodes()
{
GlobalInfo.AddCounter(Counters.Descriptions.Int(), Properties.Resources.CN_Descriptions);
GlobalInfo.AddCounter(Counters.Masters.Int(), Properties.Resources.CN_Masters);
}
public override void Addon(ERPFramework.Forms.IDocument frm, ERPFramework.NameSpace nameSpace)
{
}
public override ERPFramework.Preferences.PreferencePanel[] RegisterPreferences()
{
return new ERPFramework.Preferences.PreferencePanel[]
{
new MastersPreferencePanel("")
};
}
protected override bool CreateDBTables()
{
AddTable<CustomerTable>();
return true;
}
protected override bool UpdateDBTables()
{
if (dbVersion < 2)
{
if (!SearchColumn(CustomerTable.Email))
{
SqlCreateTable.AlterTable<CustomerTable>();
SqlCreateTable.AddColumn(CustomerTable.Email);
SqlCreateTable.Alter();
}
}
return true;
}
}With this file we are going to assign the characteristics of this module.
-
Application
It's the identify code of our application
ERPA in this case means ERPApplication -
Module
It's the identify code of our module
In this case ERPC means ERPCustomer module -
CurrentVersion
Is the database version ( to manage the upgrade ) -
DllVersion
Return the dll version -
RegisterCountersAndCodes
Allows you to register the Counters and the speaking codes - Addon Allows you to attach an Addon to a document or batch of another module. The addon is a code that usually locks itself to a dataentry. It receives events like new, save, delete and allows you to add functionality from another module.
-
RegisterPreferences
Allow you to add a preference panel for this module -
CreateDBTables
With methodAddTable<mytable>([bool toExport = true])we add the module tables to the framework.
At first connection, if the table not exists, the framework will create the missing table.
If the table is a temporary table, you can set the parameter to false. This way, when you export your database to xml, this table will not be exported. - UpdateDBTables Here you can put the code to upgrade the database as add column, update values.