コード例 #1
0
    /// <summary>
    /// 取得商品儲區擷轉明細
    /// </summary>
    private DataTable Get_Data(string s_Page_Load)
    {
        #region 傳入參數

        ArrayList ParameterList_Session = new ArrayList();
        ArrayList ParameterList = new ArrayList();//20091118
        if (s_Page_Load == "IS_PAGE_LOAD")
        {
            ParameterList_Session = (ArrayList)Session["POP_CRMTransError2_ParameterList"];
            if (ParameterList_Session != null)
            {
                this.slp_TRANS_DATE.Text = ((DateTime)ParameterList_Session[0]).ToString("yyyy/MM/dd");
                this.slp_ST_ACCEPT_DATE.Text = ((DateTime)ParameterList_Session[1]).ToString("yyyy/MM/dd");
                this.SLP_RootNo1.Text = ParameterList_Session[2].ToString();
                this.slp_IS_OVERDUE.SelectedValue = ParameterList_Session[3].ToString();
                this.txt_TRANS_NO_B.Text = ParameterList_Session[4].ToString();
                this.txt_TRANS_NO_E.Text = ParameterList_Session[5].ToString();
                ParameterList.Add(Session["UID"].ToString());
                ParameterList_Session.Add(GetValueSetParameter("9999", "int", false));
            }
        }
        else if (s_Page_Load == "NOT_PAGE_LOAD")
        {
            ParameterList.Clear();
            ParameterList.Add(GetValueSetParameter(this.slp_TRANS_DATE.Text, "date", false));
            ParameterList.Add(GetValueSetParameter(this.slp_ST_ACCEPT_DATE.Text, "date", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_RootNo1.Text.Trim(), "int", false));
            ParameterList.Add(GetValueSetParameter(this.slp_IS_OVERDUE.SelectedValue, "int", false));
            ParameterList.Add(GetValueSetParameter(this.txt_TRANS_NO_B.Text, "string", false));
            ParameterList.Add(GetValueSetParameter(this.txt_TRANS_NO_E.Text, "string", false));
            ParameterList.Add(Session["UID"].ToString());
            ParameterList.Add(GetValueSetParameter(this.TextBoxRowCountLimit.Text.Trim(), "int", false));
        }

        #endregion

        #region 取得資料

        DataTable dt_Return = new DataTable();

        BCO.QueryCRMCommon bco = new BCO.QueryCRMCommon(ConntionDB);

        try
        {
            if (s_Page_Load == "IS_PAGE_LOAD")
            { dt_Return = bco.QueryTransErrorData(ParameterList_Session); }
            else if (s_Page_Load == "NOT_PAGE_LOAD")
            { dt_Return = bco.QueryTransErrorData(ParameterList); }
        }
        catch (Exception ex)
        {
            throw ex;
        }

        #endregion

        #region 資料與GridView繫結

        //抓取本頁初次登記的時間

        string SessionIDName = "CRM071_POP_" + PageTimeStamp.Value;

        Session["SessionID"] = SessionIDName;
        Session[SessionIDName] = dt_Return;
        this.gv_TransErrData.DataSource = dt_Return;
        this.gv_TransErrData.PageSize = (this.TextBoxPagesize.Text == string.Empty) ? 10 : (int.Parse(this.TextBoxPagesize.Text) <= 0) ? 10 : int.Parse(this.TextBoxPagesize.Text);
        this.gv_TransErrData.PageIndex = 0;
        this.gv_TransErrData.DataBind();

        #endregion

        return dt_Return;
    }