public override void DataBind() { string SpecialField = Request.Params["ecweb"]; string queryTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:00"); String PlantCode = Request.Params["plantcode"]; String UnitCode = Request.Params["unitcode"]; String PlantID = KPI_PlantDal.GetPlantIDByCode(PlantCode); String UnitID = KPI_UnitDal.GetUnitIDByCode(UnitCode); gvReal.DataSource = KPI_RealValueDal.GetRealValue(PlantID, ""); base.DataBind(); nowtime.Text = "计算时间:" + queryTime; nowshift.Text = "轮班值次:"; if (!String.IsNullOrWhiteSpace(UnitID)) { string workid = KPI_UnitDal.GetWorkIDByID(UnitID); string ShiftName = ""; string PeriodName = ""; string StartTime = ""; string EndTime = ""; bool bGood = KPI_WorkDal.GetShiftAndPeriod(workid, queryTime, ref ShiftName, ref PeriodName, ref StartTime, ref EndTime); nowshift.Text = "轮班值次:" + ShiftName; } }
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(); } }