|
|
|
@@ -24,7 +24,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Consoles
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
// I n t e r f a c e O p t i o n D e f i n i t i o n s
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
public static List<SaItemOptionDfn> GetInterfaceItemOptionDfns(ISbmUserOrganisationContext userContext, SaInterfaceCategory interfaceCategory, short interfaceType)
|
|
|
|
|
public static List<SaItemOptionDfn> GetInterfaceItemOptionDfns(SbmInternals internals, SaInterfaceCategory interfaceCategory, short interfaceType)
|
|
|
|
|
{
|
|
|
|
|
switch (interfaceCategory)
|
|
|
|
|
{
|
|
|
|
@@ -34,7 +34,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Consoles
|
|
|
|
|
}
|
|
|
|
|
case SaInterfaceCategory.Accounts:
|
|
|
|
|
{
|
|
|
|
|
return new SbmAccountsDfn(userContext).GetInterfaceItemOptionDfns((Sbm.InterfaceType_Accounts)interfaceType);
|
|
|
|
|
return internals.AccountsConsole.GetInterfaceItemOptionDfns((Sbm.InterfaceType_Accounts)interfaceType);
|
|
|
|
|
}
|
|
|
|
|
case SaInterfaceCategory.System:
|
|
|
|
|
{
|
|
|
|
@@ -46,7 +46,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Consoles
|
|
|
|
|
{
|
|
|
|
|
if (interfaceType == (short)Sbm.InterfaceType_File.CommodityExport)
|
|
|
|
|
{
|
|
|
|
|
SbmInterfaceProcess_Commodity_Export.Config processConfig = new SbmInterfaceProcess_Commodity_Export.Config(userContext);
|
|
|
|
|
SbmInterfaceProcess_Commodity_Export.Config processConfig = new SbmInterfaceProcess_Commodity_Export.Config(internals.UserContext);
|
|
|
|
|
SbmInterfaceProcess_Commodity_Export process = new SbmInterfaceProcess_Commodity_Export(processConfig);
|
|
|
|
|
return process.GetInterfaceItemOptionDfns();
|
|
|
|
|
}
|
|
|
|
@@ -59,7 +59,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Consoles
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
// P r o c e s s i n g O p t i o n s
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
public static List<SaProcess_Base.GroupData> GetProcessingOptions(ISbmUserOrganisationContext userContext, SaInterface interfaceObj)
|
|
|
|
|
public static List<SaProcess_Base.GroupData> GetProcessingOptions(SbmInternals internals, SaInterface interfaceObj)
|
|
|
|
|
{
|
|
|
|
|
if (interfaceObj == null || !SysId.IsValid(interfaceObj.Id)) return new List<SaProcess_Base.GroupData>();
|
|
|
|
|
List<SaProcess_Base.GroupData> optionGroups = null;
|
|
|
|
@@ -80,7 +80,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Consoles
|
|
|
|
|
case SaInterfaceCategory.File:
|
|
|
|
|
{
|
|
|
|
|
if (interfaceObj.Type == (short)Sbm.InterfaceType_File.CommodityExport)
|
|
|
|
|
optionGroups = SbmInterfaceProcess_Commodity_Export.GetProcessingOptions(userContext, interfaceObj);
|
|
|
|
|
optionGroups = SbmInterfaceProcess_Commodity_Export.GetProcessingOptions(internals.UserContext, interfaceObj);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -90,7 +90,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Consoles
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
// C o n f i g u r e P r o c e s s
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
public static SbmInterfaceProcess ConfigureProcess(ISbmUserOrganisationContext userContext, SaInterface interfaceObj, SaProcess_Base.GroupData processGroup)
|
|
|
|
|
public static SbmInterfaceProcess ConfigureProcess(SbmInternals internals, SaInterface interfaceObj, SaProcess_Base.GroupData processGroup)
|
|
|
|
|
{
|
|
|
|
|
if (interfaceObj == null || !SysId.IsValid(interfaceObj.Id)) return null;
|
|
|
|
|
switch (interfaceObj.Category)
|
|
|
|
@@ -110,7 +110,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Consoles
|
|
|
|
|
case SaInterfaceCategory.File:
|
|
|
|
|
{
|
|
|
|
|
if (interfaceObj.Type == (short)Sbm.InterfaceType_File.CommodityExport)
|
|
|
|
|
return SbmInterfaceProcess_Commodity_Export.ConfigureProcess(userContext, interfaceObj, processGroup);
|
|
|
|
|
return SbmInterfaceProcess_Commodity_Export.ConfigureProcess(internals.UserContext, interfaceObj, processGroup);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@@ -120,7 +120,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Consoles
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
// P r o c e s s I n t e r f a c e
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
public static bool ProcessInterface(ISbmUserOrganisationContext userContext, SaInterface interfaceObj)
|
|
|
|
|
public static bool ProcessInterface(SbmInternals internals, SaInterface interfaceObj)
|
|
|
|
|
{
|
|
|
|
|
if (interfaceObj == null || !SysId.IsValid(interfaceObj.Id)) return false;
|
|
|
|
|
switch (interfaceObj.Category)
|
|
|
|
@@ -149,7 +149,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Consoles
|
|
|
|
|
// I n v o k e P r o c e s s D e f i n i t i o n
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
// Invoke process based on definition from command line argument.
|
|
|
|
|
public static bool InvokeProcessDefinition(ISbmUserOrganisationContext userContext, SacsProcessDefinition processDfn)
|
|
|
|
|
public static bool InvokeProcessDefinition(SbmInternals internals, SacsProcessDefinition processDfn)
|
|
|
|
|
{
|
|
|
|
|
//----------------------------------------------------------------
|
|
|
|
|
// Log process definition.
|
|
|
|
@@ -160,7 +160,7 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Consoles
|
|
|
|
|
if (processDfn.ProcessName.EqualsCI("ApplicationParameterName..."))
|
|
|
|
|
{
|
|
|
|
|
String caption = "System Interface ...";
|
|
|
|
|
SaInterface saInterface = GetSystemInterfaceByType(userContext, (short)Sbm.InterfaceType_System.MSOutlook, caption);
|
|
|
|
|
SaInterface saInterface = GetSystemInterfaceByType(internals, (short)Sbm.InterfaceType_System.MSOutlook, caption);
|
|
|
|
|
if (saInterface != null)
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
@@ -186,30 +186,27 @@ namespace Sarand.BusinessMgr.Net.Core.Procs.Consoles
|
|
|
|
|
|
|
|
|
|
//-------------------------------------------------------------------
|
|
|
|
|
// Retrieve interface.
|
|
|
|
|
private static SaInterface GetSystemInterfaceByType(ISbmUserOrganisationContext userContext, short interfaceType, String caption)
|
|
|
|
|
private static SaInterface GetSystemInterfaceByType(SbmInternals internals, short interfaceType, String caption)
|
|
|
|
|
{
|
|
|
|
|
return GetInterfaceByCategoryType(userContext, SaInterfaceCategory.System, interfaceType, caption);
|
|
|
|
|
return GetInterfaceByCategoryType(internals, SaInterfaceCategory.System, interfaceType, caption);
|
|
|
|
|
}
|
|
|
|
|
private static SaInterface GetInterfaceByCategoryType(ISbmUserOrganisationContext userContext, SaInterfaceCategory interfaceCategory, short interfaceType, String caption)
|
|
|
|
|
private static SaInterface GetInterfaceByCategoryType(SbmInternals internals, SaInterfaceCategory interfaceCategory, short interfaceType, String caption)
|
|
|
|
|
{
|
|
|
|
|
SaInterface saInterface = null;
|
|
|
|
|
SaInterface.Params prmInterface = new SaInterface.Params();
|
|
|
|
|
prmInterface.InterfaceCategory = interfaceCategory;
|
|
|
|
|
prmInterface.InterfaceTypesIncluded.Add(interfaceType);
|
|
|
|
|
prmInterface.StatusCat = SaInterface.StatusCat.Any;
|
|
|
|
|
using (SaInterfaceConsole interfaceConsole = SbmGlobals.System.CreateInterfaceConsole(userContext))
|
|
|
|
|
saInterface = internals.InterfaceConsole.GetInterface(prmInterface);
|
|
|
|
|
if (saInterface == null)
|
|
|
|
|
{
|
|
|
|
|
saInterface = interfaceConsole.GetInterface(prmInterface);
|
|
|
|
|
if (saInterface == null)
|
|
|
|
|
{
|
|
|
|
|
SaLogger.Warn("Unable to run " + caption + " - Interface not found", true);
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
if (!saInterface.Active)
|
|
|
|
|
{
|
|
|
|
|
SaLogger.Warn("Unable to run " + caption + " - Interface is not active", true);
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
SaLogger.Warn("Unable to run " + caption + " - Interface not found", true);
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
if (!saInterface.Active)
|
|
|
|
|
{
|
|
|
|
|
SaLogger.Warn("Unable to run " + caption + " - Interface is not active", true);
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
return saInterface;
|
|
|
|
|
}
|
|
|
|
|