.NET with IKVM
Using Capitex Boendekalkyl in a .NET project
Capitex Boendekalkyl is Java application but can be used in a .NET project using a tool like IKVM.
This article will explain how you can use the Capitex Boendekalkyl-JAR in your .NET project.
There are different ways to use IKVM in your project which is documented on the nuget IKVM page https://www.nuget.org/packages/IKVM/. Below is an example of how you can use the .NET CLI to include the Capitex Boendekalkyl-JAR in your .NET project.
Installing IKVM
Using .NET CLI
Go to your solution folder
cd <path-to-solution>
Add IKVM package
dotnet add
package
IKVM --version
8.10
.
3
Add JRE Runtime if needed
dotnet add
package
IKVM.Image.JRE --version
8.10
.
3
Using Package Manager
Open the Package Manager Console in Visual Studio.
Install IKVM using:
Install-Package IKVM
Add Capitex Boendekalkyl using IKVM
Add Capitex Boendekalkyl JAR to the csproj file
<ItemGroup>
<IkvmReference Include=
"<path-to-jar>\boendekalkyl.ber-xx.x.x.jar"
></IkvmReference>
</ItemGroup>
Now you can use Capitex Boendekalkyl like a normal DLL
Example of a call to KomplettBeraekning:
using capitex.boendekalkyl.datastrukturer.
@in
;
using capitex.boendekalkyl.datastrukturer.
@ut
;
using capitex.boendekalkyl.beraekningsdel;
using capitex.datastrukturer.
@in
;
clsIn indata =
new
clsIn();
clsPerson person =
new
clsPerson();
person.Inkomster =
new
clsInkomster();
clsBruttoloenKrPerAAr bruttoloenKrPerAAr =
new
clsBruttoloenKrPerAAr();
bruttoloenKrPerAAr.Bruttoloen_Kr_Per_AAr =
400000
;
person.Inkomster.Bruttoloen = bruttoloenKrPerAAr;
clsKomskattKommunkod komskattKommunkod =
new
clsKomskattKommunkod();
komskattKommunkod.Laenskod =
1
;
komskattKommunkod.Kommunkod =
80
;
person.Kommunalskatt = komskattKommunkod;
indata.Personer =
new
clsPerson[]{person};
Kalkyl kalkyl =
new
Kalkyl();
clsUt utdata = kalkyl.KomplettBeraekning(indata);
Console.WriteLine(utdata.Resultat[
0
].Resultat.OEverskott_Underskott_Kr_Per_Maanad);