示例#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);

            CRMModel.ImportCRMOrder BCO = new CRMModel.ImportCRMOrder(ConnectionDB);
            dt_Return = BCO.QueryErrorByFind(ParameterList);

            if (dt_Return.Rows.Count > 0)
            {
                //string SessionIDName = "CRM04A_" + PageTimeStamp.Value;
                string SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value);
                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();
                ResultMsgLabel.Text = "查無資料";

            }

        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
            up_ErrorMsg.Update();
        }
        #endregion
    }
示例#2
0
    private void QueryData()
    {
        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);

        CRMModel.ImportCRMOrder BCO = new CRMModel.ImportCRMOrder(ConnectionDB);
        dt_Return = BCO.QueryErrorByFind(ParameterList);

        if (dt_Return.Rows.Count > 0)
        {
            string SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value);

            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 = "查無資料";

        }
    }