zoukankan      html  css  js  c++  java
  • Controller层返回Json数据

    1.public JsonResult JudgeHisList(JqGridParameter jqGridParameter, string hid) 

    try 

    iPAL.Models.Pub.iPAL_ManagerDataContext Qualitydb = new iPAL_ManagerDataContext(); 
    var list = from a in Qualitydb.MANAGER_QUALITY_HIS_COMMENT join b in Qualitydb.MANAGER_CFG_QUALITY_HIS on a.hid equals b.Id where a.hid == Convert.ToInt32(hid) orderby a.id descending select new { remark = a.remark, userid = a.userid, addtime = a.addtime, state = b.State }; 
    var resultList = list.ToList().Select(item => new 

    userid=item.userid, 
    remark=item.remark, 
    state=item.state=="yes" ? "通过评审" : "未通过评审", 
    addtime=item.addtime 
    }); 

    if (list.Count() < 1) 

    return Json(ConvUtils.CreateNullJsonString(), JsonRequestBehavior.AllowGet); 

    var jsonData = JqGridHelper.ToJson(jqGridParameter, resultList.ToList<object>()); 
    return Json(jsonData, JsonRequestBehavior.AllowGet); 

    catch (System.Exception ex) 

    return Json(ex.Message, JsonRequestBehavior.AllowGet); 

    }


    2(easyui).public JsonResult ShowSheetData(string args,string rows,string page) 

    int pageSize = 30, pageIndex = 1; 
    CommonMethod.toInt(rows, ref pageSize); 
    CommonMethod.toInt(page, ref pageIndex); 
    int total = 0; 
    try 

    List<BIGT_ROW_DATA> lst = btModuel.GetBigTRow(args, pageSize, pageIndex - 1, ref total); 
    var jsonData = new 

    total = total, 
    rows = lst.ToArray() 
    }; 
    return Json(jsonData, JsonRequestBehavior.AllowGet); 

    catch 

    return Json("{}", JsonRequestBehavior.AllowGet); 

    }

  • 相关阅读:
    postgresql 53300错误
    linux su失败:无法设置用户ID:资源暂时不可用
    shell中使用带密码的方式直接pg_dump和psql
    pg数据库查询表大小
    linux安装postgresql简洁版
    检查linux版本命令
    博客园后台搜索自己的博客
    欧式洗车
    做生意
    无线AP隔离
  • 原文地址:https://www.cnblogs.com/cw_volcano/p/2216513.html
Copyright © 2011-2022 走看看