/* * 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 23.11.2018 08:02:34 using System; using System.Collections.Generic; using www.siplace.com.OIB._2008._05.SetupCenter.Contracts.Data; namespace com.itac.oib.siplacesetupcenter.contracts.data { // source: assembly 3.2.0.152 // source: assembly ASM.AS.OIB.SIPLACESetupCenter.Contracts public class TableMapper { // 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._2008._05.SetupCenter.Contracts.Data.Table get(Table itacTable) { if (itacTable == null) { return null; } www.siplace.com.OIB._2008._05.SetupCenter.Contracts.Data.Table asmTable = new www.siplace.com.OIB._2008._05.SetupCenter.Contracts.Data.Table(); mapItac2Asm(asmTable, itacTable); return asmTable; } public static void mapItac2Asm(www.siplace.com.OIB._2008._05.SetupCenter.Contracts.Data.Table asmTable, Table itacTable) { asmTable.TableID = itacTable.TableID; // complex property ComponentLocationStates, isArray:False, isGeneric:True asmTable.ComponentLocationStates = ComponentLocationStateMapper.get(itacTable.ComponentLocationStates); asmTable.TableType = itacTable.TableType; } // maps iTAC namespace conform array to ASM namespace array public static www.siplace.com.OIB._2008._05.SetupCenter.Contracts.Data.Table[] get(Table[] itacTable) { if (itacTable == null) { return null; } www.siplace.com.OIB._2008._05.SetupCenter.Contracts.Data.Table[] asmTable = new www.siplace.com.OIB._2008._05.SetupCenter.Contracts.Data.Table[itacTable.Length]; for (int i = 0; i < itacTable.Length; i++) { // to itac array asmTable[i] = TableMapper.get(itacTable[i]); } return asmTable; } // maps iTAC namespace conform array to ASM namespace list public static List getList(Table[] asmTable) { if (asmTable == null) { return null; } List itacTable = new List(); for (int i = 0; i < asmTable.Length; i++) { itacTable.Add(TableMapper.get(asmTable[i])); } return itacTable; } // map type from ASM namespace to iTAC namespace public static Table get(www.siplace.com.OIB._2008._05.SetupCenter.Contracts.Data.Table asmTable) { if (asmTable == null) { return null; } Table itacTable = new Table(); mapAsm2Itac(asmTable, itacTable); return itacTable; } public static void mapAsm2Itac(www.siplace.com.OIB._2008._05.SetupCenter.Contracts.Data.Table asmTable, Table itacTable) { itacTable.TableID = asmTable.TableID; // maps ASM list 2 iTAC array itacTable.ComponentLocationStates = ComponentLocationStateMapper.getArray(asmTable.ComponentLocationStates); itacTable.TableType = asmTable.TableType; } // maps ASM namespace conform list to iTAC namespace array public static Table[] getArray(IList asmTable) { if (asmTable == null) { return null; } Table[] itacTable = new Table[asmTable.Count]; for (int i = 0; i < asmTable.Count; i++) { itacTable[i] = TableMapper.get(asmTable[i]); } return itacTable; } // maps ASM namespace conform array to iTAC namespace array public static Table[] getArray(www.siplace.com.OIB._2008._05.SetupCenter.Contracts.Data.Table[] asmTable) { if (asmTable == null) { return null; } Table[] itacTable = new Table[asmTable.Length]; for (int i = 0; i < asmTable.Length; i++) { itacTable[i] = TableMapper.get(asmTable[i]); } return itacTable; } } }