Example #1
0
 public static void historyDataBind(DataGridAction dga) {
   QueryBuilder qb =
       new QueryBuilder(
           "select ZCMessage.*,case readFlag when 1 then '已读' else '未读' end as ReadFlagStr,case readFlag when 1 then '' else 'red' end as color from ZCMessage where fromuser=?",
           User.getUserName());
   qb.append(dga.getSortString());
   DataTable dt = qb.executePagedDataTable(dga.getPageSize(), dga.getPageIndex());
   dt.insertColumn("ReadFlagIcon");
   for (int i = 0; i < dt.getRowCount(); ++i) {
     String flag = dt.getString(i, "ReadFlag");
     if (!"1".equals(flag)) dt.set(i, "ReadFlagIcon", "<img src='../Icons/icon037a7.gif'>");
     else {
       dt.set(i, "ReadFlagIcon", "<img src='../Icons/icon037a17.gif'>");
     }
   }
   dga.setTotal(qb);
   dga.bindData(dt);
 }
Example #2
0
 public static void dg1PrintDataBind(DataGridAction dga) {
   String sql1 = "select * from ZSOrderItem where OrderID = ? order by GoodsID";
   DataTable dt = new QueryBuilder(sql1, dga.getParam("OrderID")).executeDataTable();
   Mapx factoryMap =
       new QueryBuilder(
               "select id,Factory from zsgoods where exists(select * from zsorderitem where orderID = ? and GoodsID = zsgoods.ID)",
               dga.getParam("OrderID"))
           .executeDataTable()
           .toMapx(0, 1);
   dt.insertColumn("Factory");
   for (int i = 0; (dt != null) && (i < dt.getRowCount()); ++i) {
     dt.set(i, "Factory", factoryMap.getString(dt.getString(i, "GoodsID")));
   }
   dga.bindData(dt);
 }