static void LIL_ProjectElementAdd(Args _args)
{
TextIo inFile;
container line;
Counter records;
SysOperationProgress simpleProgress;
container fileContainer;
Counter loopCounter;
CustTable CustTable;
InventTable InventTable;
str filename,
properties,
objectType,
objectName,
aotType,aotPath;
TreeNode projectNode,
tempNode;
ProjectGroupNode groupNode;
boolean managed;
#OCCRetryCount
#AviFiles
#File
#aot
#DMF
filename = WinAPI::getOpenFileName(0,
[WinAPI::fileType(#csv),#AllFilesName + #csv],
strFmt(@'C:\users\%1\Desktop',WinApi::getUserName()),
"@SYS53008"
);
try
{
inFile = new TextIo(filename, 'r');
inFile.inRecordDelimiter('\n');
inFile.inFieldDelimiter(';');
while (inFile.status() == IO_Status::OK)
{
fileContainer += [infile.read()];
}
inFile = null;
}
catch
{
throw error(strFmt("@SYS18678", filename));
}
simpleProgress = SysOperationProgress::newGeneral(#aviUpdate, "Importazione...", conLen(fileContainer));
records = 0;
projectNode = SysTreeNode::createProject("MyPrivateProject");
groupNode = projectNode.AOTadd("Object");
properties = groupNode.AOTgetProperties();
for (loopCounter = 2; loopCounter <= conLen(fileContainer) - 1 ; loopCounter++)
{
line = conPeek(fileContainer,loopCounter);
objectType = conPeek(line,1);
objectName = conPeek(line,2);
switch(objectType)
{
case "BaseEnum" :
aotType = #BaseEnums;
aotPath = #BaseEnumsPath;
managed = true;
break;
case "Class" :
aotType = #Classes;
aotPath = #ClassesPath;
managed = true;
break;
case "ExtendedDataType" :
aotType = #ExtendedDataTypes;
aotPath = #ExtendedDataTypesPath;
managed = true;
break;
case "Form" :
aotType = "Forms";
aotPath = #FormsPath;
managed = true;
break;
case "Macro" :
aotType = "Macros";
aotPath = #MacrosPath;
managed = true;
break;
case "Menu" :
aotType = "Menus";
aotPath = #MenusPath;
managed = true;
break;
case "Table" :
aotType = "Tables";
aotPath = #TablesPath;
managed = true;
break;
case "Map" :
aotType = "Maps";
aotPath = #TableMapsPath;
managed = true;
break;
case "Query" :
aotType = #Queries;
aotPath = #QueriesPath;
managed = true;
break;
case "SecurityDuty" :
aotType = "SecDuties";
aotPath = #SecDutiesPath;
managed = true;
break;
case "SecurityPrivilege" :
aotType = "SecPrivileges";
aotPath = #SecPrivilegesPath;
managed = true;
break;
case "SecurityPrivilege" :
aotType = "SecPrivileges";
aotPath = #SecPrivilegesPath;
managed = true;
break;
case "SecurityProcessCycle" :
aotType = "SecProcessCycles";
aotPath = #SecProcessCyclesPath;
managed = true;
break;
case "SecurityRole" :
aotType = "SecRoles";
aotPath = #SecRolesPath;
managed = true;
break;
case "SSRSReport" :
aotType = "SSRSReports";
aotPath = #SSRSReportsPath;
managed = true;
break;
case "VisualStudioProjectCSharp" :
aotType = "VSProjectsCShar";
aotPath = #VSProjectsCSharpPath;
managed = true;
break;
default:
managed = false;
warning(strFmt("Unable to add %1, %2",objectType,objectName));
}
if(objectName && managed)
{
tempNode = TreeNode::findNode(aotPath);
groupNode.addNode(tempNode.AOTfindChild(objectName));
}
}
projectNode.AOTsave();
}
L'output sarà il seguente:
Nessun commento:
Posta un commento