private void BindData()
        {
            #region 权限检查
            if (!Context.User.Identity.IsAuthenticated)
            {
                return;
            }
            #endregion

            string strWhere = "";
            if (Session["strWhereNews"] != null && Session["strWhereNews"].ToString() != "")
            {
                strWhere += Session["strWhereNews"].ToString();
            }
            DataSet ds = new DataSet();
            ds = bll.GetList(strWhere);
            DataView dv = ds.Tables[0].DefaultView;
            gridView.DataSource = dv;
            gridView.DataBind();

            //分页
            int rows_Count   = ds.Tables[0].Rows.Count;
            int page_Size    = gridView.PageSize;
            int page_Count   = gridView.PageCount;
            int page_Current = gridView.PageIndex + 1;

            lblRowsCount.Text   = rows_Count.ToString();
            lblPageCount.Text   = page_Count.ToString();
            lblCurrentPage.Text = page_Current.ToString();


            #region 显示页导航

            btnFirst.Enabled = true;
            btnPrev.Enabled  = true;
            btnNext.Enabled  = true;
            btnLast.Enabled  = true;
            if (gridView.PageIndex == 0)
            {
                btnFirst.Enabled = false;
                btnPrev.Enabled  = false;
                if (gridView.PageCount == 1)
                {
                    btnLast.Enabled = false;
                    btnNext.Enabled = false;
                }
            }
            else if (gridView.PageIndex == gridView.PageCount - 1)
            {
                btnLast.Enabled = false;
                btnNext.Enabled = false;
            }

            #endregion
        }
        private void BindData()
        {
            string strWhere = "";

            if (Session["strWhereNews"] != null && Session["strWhereNews"].ToString() != "")
            {
                strWhere += Session["strWhereNews"].ToString();
            }
            DataSet ds = new DataSet();

            //暂时显示100条记录,数据太多内存不够
            //ds = bll.GetList(100, strWhere, "systime desc");
            ds = bll.GetList(strWhere);

            DataView dv = ds.Tables[0].DefaultView;

            gridView.DataSource = dv;
            gridView.DataBind();

            //分页
            int rows_Count   = ds.Tables[0].Rows.Count;
            int page_Size    = gridView.PageSize;
            int page_Count   = gridView.PageCount;
            int page_Current = gridView.PageIndex + 1;

            lblRowsCount.Text   = rows_Count.ToString();
            lblPageCount.Text   = page_Count.ToString();
            lblCurrentPage.Text = page_Current.ToString();


            #region 显示页导航

            btnFirst.Enabled = true;
            btnPrev.Enabled  = true;
            btnNext.Enabled  = true;
            btnLast.Enabled  = true;
            if (gridView.PageIndex == 0)
            {
                btnFirst.Enabled = false;
                btnPrev.Enabled  = false;
                if (gridView.PageCount == 1)
                {
                    btnLast.Enabled = false;
                    btnNext.Enabled = false;
                }
            }
            else if (gridView.PageIndex == gridView.PageCount - 1)
            {
                btnLast.Enabled = false;
                btnNext.Enabled = false;
            }

            #endregion
        }
Esempio n. 3
0
        public string AverageFlow_Month_mew(String station_name, int year)
        {
            string yearstr  = "'%" + year + "%'";
            string wherestr = "station_name ='" + station_name + "' and YYYY_MM like " + yearstr;

            Maticsoft.BLL.HIS_MEASURAND_DischargeAmount_Month Bll = new Maticsoft.BLL.HIS_MEASURAND_DischargeAmount_Month();
            DataSet   dataset  = Bll.GetList(1000, wherestr, "YYYY_MM");
            DataTable dtl      = dataset.Tables[0];
            int       rowcount = dtl.Rows.Count;

            if (rowcount == 0)
            {
                return("null");
            }
            DataRow col = dtl.Rows[0];
            String  DischargeAmountstr = col["station_name"].ToString();

            DischargeAmountstr += "#flow";
            for (int i = 0; i < rowcount; i++)
            {
                col = dtl.Rows[i];
                DischargeAmountstr += ";" + col["YYYY_MM"].ToString() + "," + col["flow"].ToString();
            }

            return(DischargeAmountstr);
        }
Esempio n. 4
0
        public string DischargeAmount_Month(int id, int year)
        {
            string yearstr  = "'%" + year + "%'";
            string wherestr = "id ='" + id + "' and YYYY_MM like " + yearstr;

            Maticsoft.BLL.HIS_MEASURAND_DischargeAmount_Month Bll = new Maticsoft.BLL.HIS_MEASURAND_DischargeAmount_Month();
            DataSet   dataset  = Bll.GetList(1000, wherestr, "YYYY_MM");
            DataTable dtl      = dataset.Tables[0];
            int       rowcount = dtl.Rows.Count;

            if (rowcount == 0)
            {
                return("null");
            }
            DataRow col = dtl.Rows[0];
            String  DischargeAmountstr = col["id"].ToString();

            DischargeAmountstr += "#CODMn";
            for (int i = 0; i < rowcount; i++)
            {
                col = dtl.Rows[i];
                DischargeAmountstr += ";" + col["YYYY_MM"].ToString() + "," + col["CODMn"].ToString();
            }
            DischargeAmountstr += "#NH3_N";
            for (int i = 0; i < rowcount; i++)
            {
                col = dtl.Rows[i];
                DischargeAmountstr += ";" + col["YYYY_MM"].ToString() + "," + col["NH3_N"].ToString();
            }
            DischargeAmountstr += "#TP";
            for (int i = 0; i < rowcount; i++)
            {
                col = dtl.Rows[i];
                DischargeAmountstr += ";" + col["YYYY_MM"].ToString() + "," + col["TP"].ToString();
            }
            DischargeAmountstr += "#TN";
            for (int i = 0; i < rowcount; i++)
            {
                col = dtl.Rows[i];
                DischargeAmountstr += ";" + col["YYYY_MM"].ToString() + "," + col["TN"].ToString();
            }
            return(DischargeAmountstr);
        }
Esempio n. 5
0
 public string DischargeAmount_Month(String station_name, int year)
 {
     string yearstr = "'%" + year +  "%'";
     string wherestr = "station_name ='" + station_name + "' and YYYY_MM like "+yearstr;
     Maticsoft.BLL.HIS_MEASURAND_DischargeAmount_Month Bll = new Maticsoft.BLL.HIS_MEASURAND_DischargeAmount_Month();
     DataSet dataset = Bll.GetList(1000, wherestr, "YYYY_MM");
     DataTable dtl = dataset.Tables[0];
     int rowcount = dtl.Rows.Count;
     if (rowcount == 0)
     {
         return "null";
     }
     DataRow col = dtl.Rows[0];
     String DischargeAmountstr = col["station_name"].ToString();
     DischargeAmountstr += "#CODMn";
     for (int i = 0; i < rowcount; i++)
     {
         col = dtl.Rows[i];
         DischargeAmountstr += ";" + col["YYYY_MM"].ToString() + "," + col["CODMn"].ToString();
     }
     DischargeAmountstr += "#NH3_N";
     for (int i = 0; i < rowcount; i++)
     {
         col = dtl.Rows[i];
         DischargeAmountstr += ";" + col["YYYY_MM"].ToString() + "," + col["NH3_N"].ToString();
     }
     DischargeAmountstr += "#TP";
     for (int i = 0; i < rowcount; i++)
     {
         col = dtl.Rows[i];
         DischargeAmountstr += ";" + col["YYYY_MM"].ToString() + "," + col["TP"].ToString();
     }
     DischargeAmountstr += "#TN";
     for (int i = 0; i < rowcount; i++)
     {
         col = dtl.Rows[i];
         DischargeAmountstr += ";" + col["YYYY_MM"].ToString() + "," + col["TN"].ToString();
     }
     return DischargeAmountstr;
 }