Example #1
0
    //檢視異常報表
    protected void but_Unusual_Report_Click(object sender, EventArgs e)
    {
        #region
        try
        {
            string s_LoginUser = string.Empty;
            DataTable dt_Return = new DataTable();
            ArrayList ParameterList = new ArrayList();

            s_LoginUser = Session["UID"].ToString();//登入人員

            ParameterList.Clear();
            ParameterList.Add(Session["UID"].ToString());
            ParameterList.Add(string.Empty);
            ParameterList.Add(Session["UID"].ToString());
            ParameterList.Add(DateTime.Now);

            Int32 iTopRowNum;
            Int32.TryParse(TextBoxRowCountLimit.Text.Trim(), out iTopRowNum);
            ParameterList.Add(iTopRowNum);
            ParameterList.Add(PageTimeStamp.Value);


            ALOModel.ImportStoreOrderItem BCO = new ALOModel.ImportStoreOrderItem(ConnectionDB);
            dt_Return = BCO.QueryErrorByFind(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.DataSource = dt_Return.DefaultView;
                this.gv_ErrorData.DataBind();
                //System.Web.UI.ScriptManager.RegisterStartupScript(this.up_GridView, this.GetType(), "TO_ALO054.aspx", "alert('查無資料')", true);
                ResultMsgLabel.Text = "查無資料";

            }

        }
        catch (Exception ex)
        {
            this.ErrorMsgLabel.Text = ex.Message;
        }
        finally { }
        #endregion
    }
Example #2
0
    private void QueryData()
    {
        #region
        string s_LoginUser = string.Empty;
        DataTable dt_Return = new DataTable();
        ArrayList ParameterList = new ArrayList();

        s_LoginUser = Session["UID"].ToString();//登入人員

        ParameterList.Clear();
        ParameterList.Add(this.txt_User.Text.Trim());
        ParameterList.Add(this.txt_Date.Text.Trim());
        ParameterList.Add(Session["UID"].ToString());
        ParameterList.Add(DateTime.Now);

        Int32 iTopRowNum;
        Int32.TryParse(TextBoxRowCountLimit.Text.Trim(), out iTopRowNum);
        ParameterList.Add(iTopRowNum);
        if (this.txt_User.Text.Trim() != Session["UID"].ToString())
            ParameterList.Add(null);
        else
            ParameterList.Add(PageTimeStamp.Value);

        ALOModel.ImportStoreOrderItem BCO = new ALOModel.ImportStoreOrderItem(ConnectionDB);
        dt_Return = BCO.QueryErrorByFind(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();
            //System.Web.UI.ScriptManager.RegisterStartupScript(this.up_GridView, this.GetType(), "TO_ALO054.aspx", "alert('查無資料')", true);
            ResultMsgLabel.Text = "查無資料";

        }
        #endregion
    }