private OpRes genQueryCond(ParamQueryOpLog p, GMUser user, ref string resultCond) { QueryCondGenerator gen = new QueryCondGenerator(); if (p.m_logType != 0) { gen.addCondition(string.Format("opType={0}", p.m_logType)); } if (!string.IsNullOrEmpty(p.m_time)) { DateTime mint = DateTime.Now, maxt = DateTime.Now; bool res = Tool.splitTimeStr(p.m_time, ref mint, ref maxt); if (!res) { return(OpRes.op_res_time_format_error); } string cond = string.Format("opTime>='{0}' and opTime<'{1}'", mint, maxt); gen.addCondition(cond); } gen.addCondition(string.Format("opAcc=acc and createCode like '{0}%' ", user.m_createCode)); resultCond = gen.and(); return(OpRes.opres_success); }
protected void onSearchLog(object sender, EventArgs e) { ParamQueryOpLog param = new ParamQueryOpLog(); param.m_logType = int.Parse(opType.SelectedValue); param.m_time = m_time.Text; param.m_curPage = m_gen.curPage; param.m_countEachPage = m_gen.rowEachPage; GMUser user = (GMUser)Session["user"]; genTable(user, param); }
protected void onSearchLog(object sender, EventArgs e) { PageViewLog gen = m_view.getPageViewFoot(); ParamQueryOpLog param = new ParamQueryOpLog(); param.m_logType = int.Parse(opType.SelectedValue); param.m_time = m_time.Text; param.m_curPage = gen.curPage; param.m_countEachPage = gen.rowEachPage; GMUser user = (GMUser)Session["user"]; m_view.genTable(user, param, @"/appaspx/account/AccountApiLogViewer.aspx"); }
public override void genPage(ParamQueryBase query_param, string url, ref string page_link, ref string foot, GMUser user) { ParamQueryOpLog dparam = (ParamQueryOpLog)query_param; PageBrowseGenerator p = new PageBrowseGenerator(); long total_page = 0; Dictionary <string, object> url_param = new Dictionary <string, object>(); url_param["opType"] = dparam.m_logType; url_param["time"] = dparam.m_time; page_link = p.genPageFoot(query_param.m_curPage, m_rowEachPage, url, ref total_page, user, url_param); if (total_page != 0) { foot = query_param.m_curPage + "/" + total_page; } }
private void genTable(GMUser user, ParamQueryOpLog param) { LogTable.GridLines = GridLines.Both; // 添加标题行 TableRow tr = new TableRow(); LogTable.Rows.Add(tr); int col = s_head.Length; int i = 0; for (; i < col; i++) { TableCell td = new TableCell(); tr.Cells.Add(td); td.Text = s_head[i]; } QueryMgr mgr = user.getSys <QueryMgr>(SysType.sysTypeQuery); OpRes res = mgr.doQuery(param, QueryType.queryTypeOpLog, user); List <Dictionary <string, object> > result = (List <Dictionary <string, object> >)mgr.getQueryResult(QueryType.queryTypeOpLog); if (result != null) { bool css = true; foreach (Dictionary <string, object> data in result) { fillTable(data, css); css = !css; } } m_page.InnerHtml = ""; m_foot.InnerHtml = ""; string page_html = "", foot_html = ""; param.m_logType = opType.SelectedIndex; m_gen.genPage(param, @"/appaspx/LogViewer.aspx", ref page_html, ref foot_html, user); m_page.InnerHtml = page_html; m_foot.InnerHtml = foot_html; }
public override OpRes doQuery(object param, GMUser user) { ParamQueryOpLog p = (ParamQueryOpLog)param; string cond = null; OpRes res = genQueryCond(p, user, ref cond); if (res != OpRes.opres_success) { return(res); } m_result.Clear(); string sqlCount = string.Format(SQL_COUNT, TableName.OPLOG, TableName.GM_ACCOUNT, cond); // 查看满足条件的记当个数 user.totalRecord = user.sqlDb.getRecordCount(sqlCount, user.getMySqlServerID(), MySqlDbName.DB_XIANXIA); string cmd = string.Format(SQL_QUERY_LOG, TableName.OPLOG, TableName.GM_ACCOUNT, cond, (p.m_curPage - 1) * p.m_countEachPage, p.m_countEachPage); List <Dictionary <string, object> > dataList = user.sqlDb.queryList(cmd, user.getMySqlServerID(), MySqlDbName.DB_XIANXIA); if (dataList == null) { return(OpRes.op_res_failed); } for (int i = 0; i < dataList.Count; i++) { ResultOpLogItem info = new ResultOpLogItem(); m_result.Add(info); Dictionary <string, object> data = dataList[i]; info.m_id = Convert.ToInt64(data["opId"]); info.m_opAcc = Convert.ToString(data["opAcc"]); info.m_opAccIP = Convert.ToString(data["opAccIP"]); info.m_opDateTime = Convert.ToDateTime(data["opTime"]).ToString(); info.m_comment = Convert.ToString(data["opComment"]); OpInfo opInfo = OpLogMgr.getInstance().getOpInfo(Convert.ToInt32(data["opType"])); if (opInfo != null) { info.m_opName = opInfo.m_opName; info.m_opDesc = opInfo.m_param.getDescription(opInfo, Convert.ToString(data["opParam"])); } else { info.m_opName = info.m_opDesc = ""; } } return(OpRes.opres_success); }