コード例 #1
0
ファイル: ECChartPage.aspx.cs プロジェクト: jht1983/SISKPI
        protected void btnExport_Click(Object sender, EventArgs e)
        {
            Response.ContentEncoding = Encoding.UTF8;
            Response.ContentType     = "application/ms-excel";
            Response.Charset         = "utf-8";
            Response.AppendHeader("Content-Disposition",
                                  "attachment;filename=" + HttpUtility.UrlEncode("指标历史数据.xls",
                                                                                 System.Text.Encoding.UTF8).ToString());
            StringWriter   sw  = new StringWriter();
            HtmlTextWriter htw = new HtmlTextWriter(sw);

            int      RecordCount = 0;
            DateTime StartDate   = Convert.ToDateTime(txtStartDate.Text);
            DateTime EndDate     = Convert.ToDateTime(txtEndDate.Text);
            String   ECID        = Request.Params["ECID"];

            using (ECHistoryDataAccess DataAccess = new ECHistoryDataAccess()) {
                ECDataRepeater.DataSource = DataAccess.GetECHourData(ECID, StartDate, EndDate,
                                                                     1, 20000, out RecordCount);
                ECDataRepeater.DataBind();
                ECDataRepeater.RenderControl(htw);
                Response.Write(sw.ToString());
                Response.Flush();
                Response.End();
                sw.Close();
                sw.Dispose();
            }
            DataBind();
        }
コード例 #2
0
ファイル: ECChartPage.aspx.cs プロジェクト: jht1983/SISKPI
        private void ChartIntial()
        {
            Title m_Title = Chart1.Titles[0];

            m_Title.Font = new Font("宋体", 12f);
            m_Title.Font = new Font("宋体", 12f, System.Drawing.FontStyle.Bold);
            //String ECName = HttpUtility.UrlDecode(Request.Params["ECName"]);
            m_Title.Text = String.Format("{0}{1}至{2}历史曲线", ECName, txtStartDate.Text, txtEndDate.Text);
            ChartArea chartaera = Chart1.ChartAreas["ChartArea1"];

            chartaera.AxisX.LabelStyle.Font = new Font("宋体", 9.75f);
            chartaera.AxisY.LabelStyle.Font = new Font("宋体", 9.75f);
            Series MinValueSeries = Chart1.Series["MinValueSeries"];
            Series AvgValueSeries = Chart1.Series["AvgValueSeries"];
            Series MaxValueSeries = Chart1.Series["MaxValueSeries"];

            using (ECHistoryDataAccess DataAccess = new ECHistoryDataAccess()) {
                int      RecordCount = 0;
                DateTime StartDate   = Convert.ToDateTime(txtStartDate.Text);
                DateTime EndDate     = Convert.ToDateTime(txtEndDate.Text);
                String   ECID        = Request.Params["ECID"];
                List <ECHistoryDataEntity> DataSource = DataAccess.GetECHourData(ECID, StartDate, EndDate,
                                                                                 1, 20000, out RecordCount);
                foreach (ECHistoryDataEntity ChartData in DataSource)
                {
                    MinValueSeries.Points.AddXY(ChartData.CheckDate,
                                                Convert.ToDouble(ChartData.MinValue));
                    AvgValueSeries.Points.AddXY(ChartData.CheckDate,
                                                Convert.ToDouble(ChartData.AvgValue));
                    MaxValueSeries.Points.AddXY(ChartData.CheckDate,
                                                Convert.ToDouble(ChartData.MaxValue));
                }
            }
        }
コード例 #3
0
ファイル: ECChartPage.aspx.cs プロジェクト: jht1983/SISKPI
        public override void DataBind()
        {
            int      RecordCount = 0;
            DateTime StartDate   = Convert.ToDateTime(txtStartDate.Text);
            DateTime EndDate     = Convert.ToDateTime(txtEndDate.Text);
            String   ECID        = Request.Params["ECID"];

            using (ECHistoryDataAccess DataAccess = new ECHistoryDataAccess()) {
                ECDataRepeater.DataSource = DataAccess.GetECHourData(ECID, StartDate, EndDate,
                                                                     Pager.CurrentPageIndex, Pager.PageSize, out RecordCount);
                Pager.RecordCount = RecordCount;
            }
            base.DataBind();
        }