Esempio n. 1
0
    protected void Btn_Print_Click(object sender, EventArgs e)
    {
        try
        {

            BCO.MaintainTransData bco = new MaintainTransData(ConntionDB);

            DataTable Dt = bco.QueryMainItemByFind(this.getParameterList(), (CheckBoxLikeSearch.Checked) ? true : false);

            if (Dt == null || (Dt != null && Dt.Rows.Count <= 0))
            {
               // ResultMsgLabel.Text = "查無資料";
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "TRN031.aspx", "alert(' 查無資料 ');", true);
            }
            else
            {
                    #region 設定頁面狀態


                    //this.hid_PageStatus.Value = "PRINT";
                    //this.txt_PageStatus.Text = "PRINT";

                    #endregion

                   
                    #region 顯示報表

                    string s_FileName = "";      //設定輸出檔名
                    string s_rptFilePath = "";   //設定報表路徑

                    s_rptFilePath = Server.MapPath("./REPORT/TRN031/TRN031_Report.rpt");
                    s_FileName = HttpUtility.UrlEncode("車輛棧板彙總表.PDF", System.Text.Encoding.UTF8);


                    LoadCrystalReport(s_FileName, s_rptFilePath, Dt, "PDF");
                    #endregion

                  
                }

        }
        catch (Exception ex)
        { this.ErrorMsgLabel.Text = ex.ToString(); }
        finally { }
    }
Esempio n. 2
0
    protected void Btn_Query_Click(object sender, EventArgs e)
    {
        try
        {
            ErrorMsgLabel.Text = "";
            ResultMsgLabel.Text = "";

           DataTable Dt = new DataTable();
          

            #region 清空靜態變數
            dt_Detail = null;
            #endregion


            #region 處理查詢

            BCO.MaintainTransData bco = new MaintainTransData(ConntionDB);

            Dt = bco.QueryByFind(this.getParameterList(), (CheckBoxLikeSearch.Checked) ? true : false,Convert.ToInt32( TextBoxRowCountLimit.Text));

            #endregion


            if (Dt == null || (Dt != null && Dt.Rows.Count <= 0))
            {
                ResultMsgLabel.Text = "查無資料";
                //ScriptManager.RegisterStartupScript(Page, this.GetType(), "TRN031.aspx", "alert(' 查無資料 ');", true);
            }
            else
            {

                dt_Detail = Dt.Copy();

            }



            #region 將Key值存到Session中

            ArrayList arl_Key = new ArrayList();

            foreach (DataRow drRow in Dt.Rows)
            { arl_Key.Add("id=" + drRow["ID"].ToString()); }

            Session["TRN03_SortKey" + this.PageTimeStamp.Value] = arl_Key;

            #endregion




            #region 設定頁面狀態

            this.hid_PageStatus.Value = "QUERY";
            this.txt_PageStatus.Text = "QUERY";

            #endregion

            #region 設定查詢結果

            this.gv_Detail.DataSource = Dt;

            if (TextBoxPagesize.Text == "0")
            {
                gv_Detail.PageSize = 1;
            }
            else
            {
                gv_Detail.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) < 0) ? 10 : int.Parse(TextBoxPagesize.Text);
            }

            this.gv_Detail.PageIndex = 0;
            this.gv_Detail.DataBind();

            #endregion


         

        }
        catch (Exception ex)
        { this.ErrorMsgLabel.Text = ex.ToString(); }
        finally { }

    }