Readme
Readme
Readme
05
Swissdec Lohnstandard
The guidelines for data transmission were developed in cooperation with the following parties:
• Suva
• eAHV / IV
Publisher
Verein Swissdec
Postfach 4358
6002 Luzern
http://www.swissdec.ch
.NET core Transmitter Sample 2020.05
Swissdec Lohnstandard
Revision History
Text Documentation
Text Code
<Text> XML-Element
Caution
Older schematic pictures are often sufficient for the conceptual understanding, i.e. only the
following are always binding the official XML files
Table of Contents
1. Getting started ....................................................................................................................... 1
1.1. Installation Prerequisites .................................................................................................... 1
1.2. Installation ........................................................................................................................ 1
2. Usage .................................................................................................................................... 2
2.1. Binding classes ................................................................................................................. 2
2.2. Saving SOAP-Messages ................................................................................................... 2
3. Remarks ................................................................................................................................ 3
3.1. Redistribution .................................................................................................................... 3
3.2. Password .......................................................................................................................... 3
3.3. Support ............................................................................................................................. 3
3.4. Issues ............................................................................................................................... 3
List of Tables
1. Binding nature of requirements ............................................................................................... iv
1.1. Projects in the solution and their usage ................................................................................ 1
1 Getting started
1.1. Installation Prerequisites
The following table lists the software requirements for the sample application
• Windows 10 or above
1.2. Installation
The TransmitterSample comes as a zipped .NET solution. Just unpack the archive to your preferred
folder. Once the application is unpacked, you can open the solution in Visual Studio or any other IDE
that masters .NET core 3.1 . You will find the solution file in the root folder of the unpacked archive.
The structure of the solution is as follows:
Project Usage
Swissdec.Transmitter.Common Common util classes
Swissdec.Transmitter._20130514 Common classes for ELM v4.0; contains ELM v4.0
transmitter
Swissdec.Transmitter._20180901 Common classes for KLE v1.0; contains KLE v1.0
transmitter
Swissdec.Transmitter._20190301 Common classes for SUA v1.0; contains SUA v1.0
transmitter
Swissdec.Transmitter._20200220 Common classes for ELM v5.0; contains ELM v5.0
transmitter
Swissdec.Transmitter._20130514.Test UnitTests for ELM v4.0. Tests show how to call the
transmitter method.
Swissdec.Transmitter._20180901.Test UnitTests for KLE v1.0. Tests show how to call the
transmitter method.
Swissdec.Transmitter._20190301.Test UnitTests for SUA v1.0. Tests show how to call the
transmitter method.
Swissdec.Transmitter._20200220.Test UnitTests for ELM v5.0. Tests show how to call the
transmitter method.
Swissdec.Transmitter Basic transmitter classes
Please note that you need at least the .NET core 3.1 in order to run the application properly.
2 Usage
2.1. Binding classes
As this sample only covers the communication part there is no backing tax accounting software with
different test data. Due to this reason this sample shows how to process a complete ELM-, KLE- or
SUA-XML file only. In your application you typically have to gather all data from your database and put
together the XML. The following code snippet shows how this can be done in ELM with the provided
proxy classes:
...
DeclareSalaryRequest request = new DeclareSalaryRequest();
PersonType person = new PersonType
{
Particulars = new ParticularsType
{
Lastname = -"Schmid",
Firstname ="Peter"
-}
};
Choice types in the XML schema can not be mapped straight forward and might need a second look
on how to use them:
...
if (workingStateType.Item is SuccessResponseType)
{
SuccessResponseType successResponseType = (SuccessResponseType) workingStateType.Item;
}
if (workingStateType.Item is ErrorResponseType)
{
ErrorResponseType errorResponseType = (ErrorResponseType)workingStateType.Item;
}
...
3 Remarks
3.1. Redistribution
You are free to redistribute any parts of this sample with your application.
3.2. Password
Password for client test certificate: testZertifikat
3.3. Support
If you need assistance in using this application you can contact the technical support by email:
<[email protected]>
3.4. Issues
• Not all XML schema aspects can be honoured by the proxy class. For instance there is a problem
with values which have a pattern defined (e.g. currency values with 2 decimal places). Depending on
the assignement the proxy class does not honour the defined pattern (0.00). A workaround for this
issue is to format the value explicitly as follows:
sd.Company.Staff[0].AHVAVSSalaries[0].AHVAVSIncome = Decimal.Parse(myNumber.ToString("0.00"));
Whenever you do a direct assignment you can use the shorter method:
sd.Company.Staff[0].AHVAVSSalaries[0].AHVAVSIncome = 125.00m
• If you regenerate the proxy class by using svcutil.exe you have to make sure that you annotate the
required classes again with XmlRootAttribute. For example:
...
[System.Xml.Serialization.XmlRootAttribute("SalaryDeclaration",
Namespace = -"http://www.swissdec.ch/schema/sd/20130514/SalaryDeclarationContainer", IsNullable = false)]
public partial class SalaryDeclarationType -: object, System.ComponentModel.INotifyPropertyChanged
...
This is only needed if you want to have the possibility to deserialize xml files into the object model
(as we do it in the sample). The normal use case for you will be to fill the objects directly from your
the database or input fields in the GUI.