protected void Page_Load(object sender, EventArgs e) { string username = Request.QueryString["username"]; if (!userLogin.CheckLogin(username)) { string js = "alert('您没有登录或操作超时,请重新登录!');window.top.location.href='" + StaticInfo.LoginPage + "'"; System.Web.HttpContext.Current.Response.Write("<script type='text/javascript'>" + js + "</script>"); return; } if (!X.IsAjaxRequest) { Session["flowcaption"] = "流量统计"; Session["flowxlable"] = "小时"; this.WebChartViewer1.Visible = false; string kkid = Session["kkid"] as String; if (!string.IsNullOrEmpty(kkid)) { List <string> countkkid = GetList(kkid); if (countkkid.Count > 0) { DataTable dt = gisShow.GetFlow(countkkid, DateTime.Now.ToString("yyyy-MM-dd"), "0"); this.StoreFlow.RemoveFields(); this.GridFlow.ColumnModel.Columns.Clear(); this.GridFlow.Reconfigure(); for (int i = 0; i < dt.Columns.Count; i++) { RecordField field = new RecordField(dt.Columns[i].ColumnName, RecordFieldType.String); this.StoreFlow.AddField(field); Column col = new Column(); col.Header = dt.Columns[i].ColumnName; if (i == 0) { col.Width = 100; } else { if (i > 10) { col.Width = 38; } else { col.Width = 32; } } col.Sortable = true; col.DataIndex = dt.Columns[i].ColumnName; GridFlow.AddColumn(col); } this.StoreFlow.DataSource = dt; this.StoreFlow.DataBind(); GridFlow.Title = title; Session["Flow"] = dt; } } } }
private void AddDataTable(DataTable dt) { try { if (dt != null && dt.Rows.Count > 0) { this.StoreFlow.RemoveFields(); this.GridFlow.ColumnModel.Columns.Clear(); this.GridFlow.Reconfigure(); for (int i = 0; i < dt.Columns.Count; i++) { RecordField field = new RecordField(dt.Columns[i].ColumnName, RecordFieldType.String); this.StoreFlow.AddField(field); Column col = new Column(); col.Header = dt.Columns[i].ColumnName; if (i == 0) { col.Width = 250; } else { col.Width = 40; } col.Sortable = true; col.DataIndex = dt.Columns[i].ColumnName; GridFlow.AddColumn(col); } this.StoreFlow.DataSource = dt; this.StoreFlow.DataBind(); List <List <double> > datas; List <string> labels; List <string> xLabels; DataTable dtTemp = dt.Copy(); dtTemp.Columns.RemoveAt(dtTemp.Columns.Count - 1); tgsDataInfo.GetLineChartData(dtTemp, out datas, out labels, out xLabels); string flowdate = CmbYear.SelectedItem.Value + "-" + CmbMonth.SelectedItem.Value + "-" + CmbDay.SelectedItem.Value + "-"; switch (CmbCountType.SelectedItem.Value) { case "3": Session["flowcaption"] = DateTime.Parse(flowdate.Substring(0, flowdate.Length - 1)).ToString("yyyy年") + "12个月流量"; Session["flowxlable"] = "月"; break; case "2": Session["flowcaption"] = DateTime.Parse(flowdate.Substring(0, flowdate.Length - 1)).ToString("yyyy年") + "周流量"; Session["flowxlable"] = "周"; break; case "1": Session["flowcaption"] = DateTime.Parse(flowdate.Substring(0, flowdate.Length - 1)).ToString("yyyy年MM月") + "日流量"; Session["flowxlable"] = "日"; break; case "0": Session["flowcaption"] = DateTime.Parse(flowdate.Substring(0, flowdate.Length - 1)).ToString("yyyy年MM月dd日") + "24小时流量"; Session["flowxlable"] = "小时"; break; } TabStrip1.ActiveTabIndex = 0; GridFlow.Title = "统计结果[" + Session["flowcaption"].ToString() + "]"; MyNet.Atmcs.Uscmcp.Bll.Common.CreateLineChart(this.WebChartViewer1, datas, labels, xLabels, Session["flowxlable"].ToString(), "流量", Session["flowcaption"].ToString()); this.WebChartViewer1.Visible = true; pnlData.Render(this.WebChartViewer1, RenderMode.Auto); //ButPrint.Hidden = false; ButExcel.Hidden = false; //ButChart.Hidden = false; } else { //ButPrint.Hidden = true; ButExcel.Hidden = true; //ButChart.Hidden = true; } } catch (Exception ex) { ILog.WriteErrorLog(ex); logManager.InsertLogError("PassCarFlowCount.aspx-AddDataTable", ex.Message + ";" + ex.StackTrace, "AddDataTable has an exception"); } }
private void AddDataTable(DataTable dt) { try { if (dt != null) { this.StoreFlow.RemoveFields(); this.GridFlow.ColumnModel.Columns.Clear(); this.GridFlow.Reconfigure(); for (int i = 0; i < dt.Columns.Count - 1; i++) { RecordField field = new RecordField(dt.Columns[i].ColumnName, RecordFieldType.String); this.StoreFlow.AddField(field); Column col = new Column(); col.Header = dt.Columns[i].ColumnName; if (i == 0) { col.Width = 180; } else { col.Width = 35; } col.Sortable = true; col.DataIndex = dt.Columns[i].ColumnName; GridFlow.AddColumn(col); } this.StoreFlow.DataSource = dt; this.StoreFlow.DataBind(); List <List <double> > datas; List <string> labels; List <string> xLabels; DataTable dtTemp = dt.Copy(); dtTemp.Columns.RemoveAt(dtTemp.Columns.Count - 1); tgsDataInfo.GetLineChartData(dtTemp, out datas, out labels, out xLabels); string sdate = CmbYear.SelectedItem.Value + "-" + CmbMonth.SelectedItem.Value + "-" + CmbDay.SelectedItem.Value; Session["scaption"] = DateTime.Parse(sdate).ToString("yyyy年MM月dd日") + "识别率(%)统计"; Session["sxlable"] = "小时"; TabStrip1.ActiveTabIndex = 0; GridFlow.Title = "统计结果[" + Session["scaption"].ToString() + "]"; MyNet.Atmcs.Uscmcp.Bll.Common.CreateAmplylineChart(this.WebChartViewer1, datas, labels, xLabels, Session["sxlable"].ToString(), "识别率(%)", Session["scaption"].ToString()); this.WebChartViewer1.Visible = true; Session["datatable"] = dt; pnlData.Render(this.WebChartViewer1, RenderMode.Auto); //ButPrint.Hidden = false; ButExcel.Hidden = false; //ButChart.Hidden = false; } else { // ButPrint.Hidden = true; ButExcel.Hidden = true; // ButChart.Hidden = true; } } catch (Exception ex) { ILog.WriteErrorLog(ex); logManager.InsertLogError("PassCarOcrCount.aspx-AddDataTable", ex.Message + ";" + ex.StackTrace, "AddDataTable has an exception"); } }