/* * Copyright (c) 2018 iTAC Software AG, Germany. All Rights Reserved. * * This software is protected by copyright. Under no circumstances may any part of this file in any form be copied, * printed, edited or otherwise distributed, be stored in a retrieval system, or be translated into another language * without the written permission of iTAC Software AG. */ // created 05.11.2018 15:39:46 // skip property ExtensionDataObject, declared in PrinterTool using System; using System.Collections.Generic; namespace com.itac.oib.traceability.contracts.data { // source: assembly 3.0.0.0 // source: assembly ASM.AS.OIB.Client public class PrinterToolMapper { // used for itac->asm: True // used for asm->itac: True // maps iTAC namespace conform type to ASM namespace type public static www.siplace.com.OIB._2012._03.Traceability.Contracts.Data.PrinterTool get(PrinterTool itacPrinterTool) { if (itacPrinterTool == null) { return null; } www.siplace.com.OIB._2012._03.Traceability.Contracts.Data.PrinterTool asmPrinterTool = new www.siplace.com.OIB._2012._03.Traceability.Contracts.Data.PrinterTool(); mapItac2Asm(asmPrinterTool, itacPrinterTool); return asmPrinterTool; } public static void mapItac2Asm(www.siplace.com.OIB._2012._03.Traceability.Contracts.Data.PrinterTool asmPrinterTool, PrinterTool itacPrinterTool) { // skip property ExtensionDataObject, declared in PrinterTool asmPrinterTool.Barcode = itacPrinterTool.Barcode; asmPrinterTool.Name = itacPrinterTool.Name; asmPrinterTool.VerificationItemId = itacPrinterTool.VerificationItemId; } // maps iTAC namespace conform array to ASM namespace array public static www.siplace.com.OIB._2012._03.Traceability.Contracts.Data.PrinterTool[] get(PrinterTool[] itacPrinterTool) { if (itacPrinterTool == null) { return null; } www.siplace.com.OIB._2012._03.Traceability.Contracts.Data.PrinterTool[] asmPrinterTool = new www.siplace.com.OIB._2012._03.Traceability.Contracts.Data.PrinterTool[itacPrinterTool.Length]; for (int i = 0; i < itacPrinterTool.Length; i++) { // to itac array asmPrinterTool[i] = PrinterToolMapper.get(itacPrinterTool[i]); } return asmPrinterTool; } // maps iTAC namespace conform array to ASM namespace list public static List getList(PrinterTool[] asmPrinterTool) { if (asmPrinterTool == null) { return null; } List itacPrinterTool = new List(); for (int i = 0; i < asmPrinterTool.Length; i++) { itacPrinterTool.Add(PrinterToolMapper.get(asmPrinterTool[i])); } return itacPrinterTool; } // map type from ASM namespace to iTAC namespace public static PrinterTool get(www.siplace.com.OIB._2012._03.Traceability.Contracts.Data.PrinterTool asmPrinterTool) { if (asmPrinterTool == null) { return null; } PrinterTool itacPrinterTool = new PrinterTool(); mapAsm2Itac(asmPrinterTool, itacPrinterTool); return itacPrinterTool; } public static void mapAsm2Itac(www.siplace.com.OIB._2012._03.Traceability.Contracts.Data.PrinterTool asmPrinterTool, PrinterTool itacPrinterTool) { // skip property ExtensionDataObject, declared in PrinterTool itacPrinterTool.Barcode = asmPrinterTool.Barcode; itacPrinterTool.Name = asmPrinterTool.Name; itacPrinterTool.VerificationItemId = asmPrinterTool.VerificationItemId; } // maps ASM namespace conform list to iTAC namespace array public static PrinterTool[] getArray(IList asmPrinterTool) { if (asmPrinterTool == null) { return null; } PrinterTool[] itacPrinterTool = new PrinterTool[asmPrinterTool.Count]; for (int i = 0; i < asmPrinterTool.Count; i++) { itacPrinterTool[i] = PrinterToolMapper.get(asmPrinterTool[i]); } return itacPrinterTool; } // maps ASM namespace conform array to iTAC namespace array public static PrinterTool[] getArray(www.siplace.com.OIB._2012._03.Traceability.Contracts.Data.PrinterTool[] asmPrinterTool) { if (asmPrinterTool == null) { return null; } PrinterTool[] itacPrinterTool = new PrinterTool[asmPrinterTool.Length]; for (int i = 0; i < asmPrinterTool.Length; i++) { itacPrinterTool[i] = PrinterToolMapper.get(asmPrinterTool[i]); } return itacPrinterTool; } } }