105 lines
4.2 KiB
C#
105 lines
4.2 KiB
C#
/*
|
|
* 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 06.11.2018 11:07:38
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
namespace com.itac.oib.siplacesetupcenter.contracts.data
|
|
{
|
|
// source: assembly 5.1.0.84
|
|
// 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 Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.Table get(Table itacTable)
|
|
{
|
|
if (itacTable == null) { return null; }
|
|
Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.Table asmTable = new Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.Table();
|
|
mapItac2Asm(asmTable, itacTable);
|
|
return asmTable;
|
|
}
|
|
|
|
public static void mapItac2Asm(Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.Table asmTable, Table itacTable)
|
|
{
|
|
asmTable.TableID = itacTable.TableID;
|
|
// complex property ComponentLocationStates, isArray:False, isGeneric:True
|
|
asmTable.ComponentLocationStates = ComponentLocationStateMapper.getList(itacTable.ComponentLocationStates);
|
|
asmTable.TableType = itacTable.TableType;
|
|
}
|
|
|
|
// maps iTAC namespace conform array to ASM namespace array
|
|
public static Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.Table[] get(Table[] itacTable)
|
|
{
|
|
if (itacTable == null) { return null; }
|
|
Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.Table[] asmTable = new Asm.As.Oib.SiplaceSetupCenter.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<Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.Table> getList(Table[] asmTable)
|
|
{
|
|
if (asmTable == null) { return null; }
|
|
List<Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.Table> itacTable = new List<Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.Table>();
|
|
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(Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.Table asmTable)
|
|
{
|
|
if (asmTable == null) { return null; }
|
|
Table itacTable = new Table();
|
|
mapAsm2Itac(asmTable, itacTable);
|
|
return itacTable;
|
|
}
|
|
|
|
public static void mapAsm2Itac(Asm.As.Oib.SiplaceSetupCenter.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<Asm.As.Oib.SiplaceSetupCenter.Contracts.Data.Table> 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(Asm.As.Oib.SiplaceSetupCenter.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;
|
|
}
|
|
}
|
|
}
|