clsImportExchangeRateSBO Class |
Please make sure, that SAP Business One DI-API in 32 or 64 bit is installed according to the usage of this interface. The logon user in MARIProject has to have a corresponding user linked to the selected company database.
Use MPInterface.bImportExchangeRateSBO(clsImportExchangeRateSBO, clsImportBaseeImportMode) to import.
Namespace: MARIInterface
The clsImportExchangeRateSBO type exposes the following members.
| Name | Description | |
|---|---|---|
| clsImportExchangeRateSBO | Initializes a new instance of the clsImportExchangeRateSBO class |
| Name | Description | |
|---|---|---|
| bSaveRSToMDB | (Overrides clsImportBasebSaveRSToMDB(MPInterface, DataRow, DataTable).) |
| Name | Description | |
|---|---|---|
| CompanyID |
Internal company id from the MARIProject Database. Default=1.
| |
| Currency | ISO Currency Code. Has to be different to the system currency of MARIProject. | |
| DateFrom |
Date for the new exchange rate. When DateTo is empty, only the this date is changed.
| |
| DateTo |
This date can be used to define a range for the new exchange rate. If null, only DateFrom is used.
| |
| ExchangeRate | ExchangeRate Between the Currency and the MARIProject System Currency |
/// <summary> /// Push daily rate to SBO via DI-API/Service Layer /// </summary> /// <param name="ISOCurrCode">ISO: EUR, USD, CAD</param> /// <param name="cRate">1.1</param> /// <param name="dtDayForRate">Day</param> /// <param name="nCompanyID">1,2,3 based on the MPSysConnections table in MARIProject</param> /// <returns></returns> private bool FillExchangeRate(string ISOCurrCode, decimal cRate, DateTime dtDayForRate, short nCompanyID) { clsImportExchangeRateSBO oNewRate = new clsImportExchangeRateSBO(); oNewRate.Currency = ISOCurrCode; // USD versus system currency EUR. or CAD versus system currency USD oNewRate.ExchangeRate = cRate; // Depending on the settings in the SBO database the rate has to be used as USD/EUR or EUR/USD oNewRate.DateFrom = dtDayForRate; oNewRate.DateTo = dtDayForRate; oNewRate.CompanyID = nCompanyID; // Linked company database to MARIProject (default=1) if (oMPInterface.bImportExchangeRateSBO(oNewRate, MARIInterface.clsImportBase.eImportMode.ValidateAndImport)) { Log($"FillExchangeRate({ISOCurrCode},{cRate},{dtDayForRate.ToShortDateString()}) Saved."); return true; } else { LogFail($"FillExchangeRate({ISOCurrCode},{cRate},{dtDayForRate.ToShortDateString()}): {oMPInterface.oErrors.PrintErrors()}"); return false; } }