55 lines
1.8 KiB
C#
55 lines
1.8 KiB
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Web;
|
|||
|
|
|||
|
namespace Weee.DAL
|
|||
|
{
|
|||
|
public abstract class ParameterBuilder
|
|||
|
{
|
|||
|
protected List<MultiName> CunstructMultiNames(List<string> TwNames, List<string> CNNames, List<string> ENNames)
|
|||
|
{
|
|||
|
var result = new List<MultiName>() { };
|
|||
|
if (TwNames == null && CNNames == null && ENNames == null) return result;
|
|||
|
if (TwNames == null) TwNames = new List<string>();
|
|||
|
if (CNNames == null) CNNames = new List<string>();
|
|||
|
if (ENNames == null) ENNames = new List<string>();
|
|||
|
|
|||
|
var max = TwNames.Count() > CNNames.Count() ?
|
|||
|
TwNames.Count() :
|
|||
|
CNNames.Count();
|
|||
|
max = max > ENNames.Count() ?
|
|||
|
max :
|
|||
|
ENNames.Count();
|
|||
|
|
|||
|
for (int i = 0; i < max; i++)
|
|||
|
{
|
|||
|
var defaultname = TwNames.Count() > i ?
|
|||
|
TwNames[i] :
|
|||
|
null;
|
|||
|
defaultname = defaultname ??
|
|||
|
(CNNames.Count() > i ?
|
|||
|
CNNames[i] :
|
|||
|
null);
|
|||
|
defaultname = defaultname ??
|
|||
|
(ENNames.Count() > i ?
|
|||
|
ENNames[i] :
|
|||
|
null);
|
|||
|
result.Add(new MultiName()
|
|||
|
{
|
|||
|
TWName = TwNames.Count() > i ? TwNames[i] : defaultname,
|
|||
|
CNName = CNNames.Count() > i ? CNNames[i] : defaultname,
|
|||
|
ENName = ENNames.Count() > i ? ENNames[i] : defaultname
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
return result;
|
|||
|
}
|
|||
|
protected struct MultiName
|
|||
|
{
|
|||
|
public string TWName;
|
|||
|
public string CNName;
|
|||
|
public string ENName;
|
|||
|
}
|
|||
|
}
|
|||
|
}
|