/// <summary> /// CGR05報表 /// </summary> /// <param name="ParameterList">變數清單</param> /// <returns>回傳查詢結果</returns> public DataTable CGR08_0(ArrayList ParameterList, string ReportOutputFormat, ref ReportList.ExcelOtherType EOT ) { CGRModel.PrintSorterDetl bco = new CGRModel.PrintSorterDetl(ConntionDB); DataTable Dt = bco.GetSorterRptData(ParameterList); if (Dt.Rows.Count == 0) { throw new Exception("查無資料"); } else { return Dt; } }
/// <summary> /// 查詢鈕 /// </summary> protected void btnQuery_Click(object sender, EventArgs e) { if (VerifyFormData() == true) { try { //抓取本頁初次登記的時間 string SessionIDName = "CGR081_" + PageTimeStamp.Value; CGRModel.PrintSorterDetl BCO = new CGRModel.PrintSorterDetl(ConntionDB); DataTable Dt = new DataTable(); ParameterList.Clear(); ParameterList.Add(SLP_P_Date.StartDate); ParameterList.Add(SLP_P_Date.EndDate); ParameterList.Add("ALL"); ParameterList.Add(TextBoxRowCountLimit.Text); Dt = BCO.GetSorterBatch(ParameterList); if (Dt.Rows.Count == 0) { ScriptManager.RegisterStartupScript(Page, this.GetType(), "CGR081.aspx", "alert(' 查無資料 ');", true); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", string.Format("$get('{0}').style.display='none';", btnPrintReport.ClientID), true); GridView1.Visible = false; return; } else { GridView1.Visible = true; Session[SessionIDName] = Dt; //設定分頁大小 //GridView1.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) < 0) ? 10 : int.Parse(TextBoxPagesize.Text); GridView1.PageIndex = 0; GridView1.DataSource = Dt; GridView1.DataBind(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", string.Format("$get('{0}').style.display='';", btnPrintReport.ClientID), true); } } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } } }