Exemple #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //if (Request.QueryString["title"] != null)
                //{
                //    string title = OPM_TitleDal.GetTitle(Request.QueryString["title"].ToString());
                //    if (title != "")
                //    {
                //        lblTitle.Text = title;
                //    }
                //}

                //电厂信息
                DataTable dt = KPI_PlantDal.GetPlants("");
                //ddlPlant.Items.Add(new ListItem("全部", "ALL"));
                foreach (DataRow dr in dt.Rows)
                {
                    ddlPlant.Items.Add(new ListItem(dr["Name"].ToString(), dr["ID"].ToString()));
                }

                //机组信息
                //dt = KPI_UnitDal.GetUnits("");
                ////ddlUnit.Items.Add(new ListItem("全部", "ALL"));
                //foreach (DataRow dr in dt.Rows)
                //{
                //    ddlUnit.Items.Add(new ListItem(dr["Name"].ToString(), dr["ID"].ToString()));
                //}

                //是否显示单元
                if (Request.QueryString["plantcode"] != null)
                {
                    string plantcode = Request.QueryString["plantcode"].ToString();

                    if (plantcode != "")
                    {
                        string plantid = KPI_PlantDal.GetPlantIDByCode(plantcode);

                        ddlPlant.Visible = false;
                        lblPlant.Visible = false;

                        ddlPlant.SelectedValue = plantid;
                    }
                }


                //页面集合
                if (Request.QueryString["ecweb"] != null)
                {
                    ViewState["ecweb"] = Request.QueryString["ecweb"].ToString();
                }
                else
                {
                    ViewState["ecweb"] = "";
                }

                //初始化时间
                txt_Month.Value = DateTime.Now.ToString("yyyy-MM");

                BindValues();
            }
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //if (Request.QueryString["title"] != null)
                //{
                //    string title = OPM_TitleDal.GetTitle(Request.QueryString["title"].ToString());
                //    if (title != "")
                //    {
                //        lblTitle.Text = title;
                //    }
                //}
                string plantid = "";
                if (Request.QueryString["plantcode"] != null)
                {
                    string plantcode = Request.QueryString["plantcode"].ToString();

                    if (plantcode != "")
                    {
                        plantid = KPI_PlantDal.GetPlantIDByCode(plantcode);
                    }
                }

                //机组信息
                DataTable dt = KPI_UnitDal.GetUnits(plantid);
                foreach (DataRow dr in dt.Rows)
                {
                    ddlUnit.Items.Add(new ListItem(dr["Name"].ToString(), dr["ID"].ToString()));
                }


                //获得参数集合
                //unitcode,为了获得值次
                if (Request.QueryString["unitcode"] != null)
                {
                    ViewState["unitcode"] = Request.QueryString["unitcode"].ToString();
                }
                else
                {
                    ViewState["unitcode"] = "";
                }

                //页面集合
                //
                if (Request.QueryString["ecweb"] != null)
                {
                    ViewState["ecweb"] = Request.QueryString["ecweb"].ToString();
                }
                else
                {
                    ViewState["ecweb"] = "";
                }

                //
                DateTime dtST = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1);
                DateTime dtET = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
                if (dtET == dtST)
                {
                    dtST = dtST.AddMonths(-1);
                }

                txt_ST.Value = dtST.ToString("yyyy-MM-dd");
                txt_ET.Value = dtET.ToString("yyyy-MM-dd");

                BindValues();
            }
        }