//檢視異常報表 protected void but_Unusual_Report_Click(object sender, EventArgs e) { #region try { #region DataTable dt_Return = new DataTable(); ArrayList ParameterList = new ArrayList(); ParameterList.Clear(); ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(PageTimeStamp.Value.Substring(0, 14)); Int32 iTopRowNum; Int32.TryParse(TextBoxRowCountLimit.Text.Trim(), out iTopRowNum); ParameterList.Add(iTopRowNum); VGIModel.ImportAccept111 BCO_VGI = new PIC.VDS2G.LGT.VGI.ImportAccept111(ConnectionDB); dt_Return = BCO_VGI.QueryError(ParameterList); if (dt_Return.Rows.Count > 0) { string SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value); Session["SessionID"] = SessionIDName; Session[SessionIDName] = dt_Return; this.gv_ErrorData.DataSource = dt_Return.DefaultView; this.gv_ErrorData.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) <= 0) ? 10 : int.Parse(TextBoxPagesize.Text); this.gv_ErrorData.PageIndex = 0; this.gv_ErrorData.DataBind(); btn_Export.Enabled = true; } else { btn_Export.Enabled = false; this.gv_ErrorData.DataBind(); ResultMsgLabel.Text = "查無資料"; //System.Web.UI.ScriptManager.RegisterStartupScript(this.up_GridView, this.GetType(), "TO_VGI111.aspx", "alert('查無資料')", true); } #endregion } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; up_ErrorMsg.Update(); } #endregion }
private void QueryData() { #region DataTable dt_Return = new DataTable(); ArrayList ParameterList = new ArrayList(); ParameterList.Clear(); ParameterList.Add(this.txt_User.Text.Trim()); ParameterList.Add(this.txt_Date.Text.Trim()); Int32 iTopRowNum; Int32.TryParse(TextBoxRowCountLimit.Text.Trim(), out iTopRowNum); ParameterList.Add(iTopRowNum); VGIModel.ImportAccept111 BCO_VGI = new PIC.VDS2G.LGT.VGI.ImportAccept111(ConnectionDB); dt_Return = BCO_VGI.QueryError(ParameterList); if (dt_Return.Rows.Count > 0) { string SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value); Session["SessionID"] = SessionIDName; Session[SessionIDName] = dt_Return; this.gv_ErrorData.DataSource = dt_Return.DefaultView; this.gv_ErrorData.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) <= 0) ? 10 : int.Parse(TextBoxPagesize.Text); this.gv_ErrorData.PageIndex = 0; this.gv_ErrorData.DataBind(); btn_Export.Enabled = true; } else { btn_Export.Enabled = false; this.gv_ErrorData.DataBind(); ResultMsgLabel.Text = "查無資料"; //System.Web.UI.ScriptManager.RegisterStartupScript(this.up_GridView, this.GetType(), "TO_VGI111.aspx", "alert('查無資料')", true); } #endregion }