• linq 实现对象映射


    public static string GetPrintList(string data)
    {
    string[] _data = data.Split(',');
    string Order_No = _data[0].ToString();
    string val = _data[1].ToString();
    var context = LEDAO.APIGateWay.GetEntityContext();
    var var = (from b in context.V_WorkOrder_Product where b.order_no == Order_No select b).ToList();
    if (var.Count() > 0)
    {
    V_WorkOrder_Product vtmp = new V_WorkOrder_Product();
    Type t = var[0].GetType();
    FieldInfo[] fields = t.GetFields(BindingFlags.NonPublic | BindingFlags.Instance);
    foreach (FieldInfo field in fields)
    {
    if (field.Name == ("_" + val.ToLower().ToString()))
    {
    if (field.Name != "_input_time")
    {
    return field.GetValue(var[0]).ToString();
    }
    else
    {
    return DateTime.Now.ToString("yyyy-MM-dd hh:mm");
    }
    }

    }
    }
    return null;
    }

    快乐而轻松的写代码
  • 相关阅读:
    代码希望HTML5初探CSS3新特性小示例
    myeclipse及eclipse的优化
    window7如何提高到最高权限
    大麦茶
    poj3292
    poj3278
    poj3100
    poj3117
    poj3299
    Presto性能调优的五大技巧
  • 原文地址:https://www.cnblogs.com/libei/p/6422657.html
Copyright © 2020-2023  润新知