protected void genTable(Table table, GMUser user) { ParamTotalConsume param = new ParamTotalConsume(); param.m_time = m_time.Text; param.m_currencyType = moneyType.SelectedIndex + 1; OpRes res = user.doQuery(param, QueryType.queryTypeFishConsume); if (res != OpRes.opres_success) { return; } ResultTotalConsume qresult = (ResultTotalConsume)user.getQueryResult(QueryType.queryTypeFishConsume); var fields = from f in qresult.m_fields orderby f ascending select f; int i = 0, k = 0; TableCell td = new TableCell(); TableRow tr = new TableRow(); tr.Cells.Add(td); table.Rows.Add(tr); // 生成行标题 foreach (var reason in fields) { tr = new TableRow(); table.Rows.Add(tr); td = new TableCell(); td.Text = qresult.getFishReason(reason); tr.Cells.Add(td); } for (i = 0; i < qresult.getResultCount(); i++) { TotalConsumeItem item = qresult.m_result[i]; td = new TableCell(); td.Text = item.m_time.ToShortDateString(); k = 0; tr = table.Rows[k]; tr.Cells.Add(td); // 生成这个结果 foreach (var reason in fields) { k++; tr = table.Rows[k]; td = new TableCell(); td.Text = ItemHelp.showMoneyValue(item.getValue(reason)).ToString(); tr.Cells.Add(td); } } }
private void genTable(Table table, OpRes res, GMUser user, QueryMgr mgr) { table.GridLines = GridLines.Both; TableRow tr = new TableRow(); table.Rows.Add(tr); TableCell td = null; ResultTotalConsume qresult = (ResultTotalConsume)mgr.getQueryResult(QueryType.queryTypeTotalConsume); if (qresult.m_fields.Count == 0) { td = new TableCell(); tr.Cells.Add(td); td.Text = OpResMgr.getInstance().getResultString(res); return; } int i = 0, j = 0; s_head = new string[1 + qresult.m_fields.Count]; m_content = new string[1 + qresult.m_fields.Count]; s_head[0] = "日期"; foreach (var r in qresult.m_fields) { s_head[++i] = qresult.getReason(r); } // 表头 for (i = 0; i < s_head.Length; i++) { td = new TableCell(); tr.Cells.Add(td); td.Text = s_head[i]; } for (i = 0; i < qresult.m_result.Count; i++) { tr = new TableRow(); if ((i & 1) == 0) { tr.CssClass = "alt"; } table.Rows.Add(tr); m_content[0] = qresult.m_result[i].m_time.ToLongDateString(); j = 1; foreach (var reason in qresult.m_fields) { ConsumeOneItem citem = qresult.m_result[i].getValue(reason); if (citem != null) { m_content[j] = citem.m_totalValue.ToString(); if (citem.m_totalCount > 0) { m_content[j] = m_content[j] + "/" + citem.m_totalCount.ToString(); } } else { m_content[j] = ""; } j++; } for (j = 0; j < s_head.Length; j++) { td = new TableCell(); tr.Cells.Add(td); td.Text = m_content[j]; } } }