|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using HcUtility.Core;
|
|
|
|
|
|
|
|
|
|
namespace DSWeb.MvcShipping.Helper
|
|
|
|
|
{
|
|
|
|
|
public class ModelObjectConvert<T> where T:ModelObjectBase
|
|
|
|
|
{
|
|
|
|
|
private static ModelObjectBase Converter(T inputObject)
|
|
|
|
|
{
|
|
|
|
|
return inputObject;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static List<ModelObjectBase> ToModelObjectList(List<T> objList)
|
|
|
|
|
{
|
|
|
|
|
if (objList == null)
|
|
|
|
|
return null;
|
|
|
|
|
return objList.ConvertAll<ModelObjectBase>(new Converter<T, ModelObjectBase>(Converter));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static List<Dictionary<string, string>> ToExtendList(List<T> objList)
|
|
|
|
|
{//将扩展数据属性的对象列表中的扩展属性值转化为List<Dictionary<string, string>>
|
|
|
|
|
if (objList == null)
|
|
|
|
|
return null;
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
var result = new List<Dictionary<string, string>>();
|
|
|
|
|
|
|
|
|
|
foreach (var obj in objList)
|
|
|
|
|
{
|
|
|
|
|
result.Add(obj.ExtendDic);
|
|
|
|
|
}
|
|
|
|
|
return result;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|