示例#1
0
    //查詢
    protected void ButtonQuery_Click(object sender, EventArgs e)
    {
        #region
        try
        {
            this.gv_ErrorData.Visible = false;
            this.gv_OKData.Visible = false;

            #region 檢查條件
            this.ErrorMsgLabel.Text = "";
            string s_CheckPage = CheckPage(sender);

            if (s_CheckPage != string.Empty)
            {
                this.ErrorMsgLabel.Text = s_CheckPage;
                return;
            }

            #endregion
            ErrorMsgLabel.Text = "";

            DataTable dtA = new DataTable();

            VGRModel.VDS_VGR08_BCO bco = new VGRModel.VDS_VGR08_BCO(ConnectionDB);

            DateTime dateB, dateE;

            DateTime.TryParse(this.SLP_SLPDateRange1.StartDate.ToString(), out dateB);
            
            if (DateTime.TryParse(this.SLP_SLPDateRange1.EndDate.ToString(), out dateE) == false)
                dateE = Convert.ToDateTime("3000/01/01");
            else
                DateTime.TryParse(this.SLP_SLPDateRange1.EndDate.ToString(), out dateE);

            this.gv_ErrorData.Visible = false;

            if (this.TextBoxRowCountLimit.Text.Trim() == "")
            {
                this.TextBoxRowCountLimit.Text = "500";
            }

            if (this.rdoTypeQ1.Checked)
            {
                hid_Query_Type.Value = "1";
            }
            else if (this.rdoTypeQ2.Checked)
            {
                hid_Query_Type.Value = "2";
            }
            else
            {
                hid_Query_Type.Value = "3";
            }

            dtA = bco.QueryErrorByFind(hid_Query_Type.Value, GetValueSetParameter(this.txt_User.Text.Trim(), "string", false).ToString(), dateB, dateE, Convert.ToInt32(this.TextBoxRowCountLimit.Text.Trim()));

            #region 資料與GridView繫結

            //抓取本頁初次登記的時間
            if (dtA.Rows.Count == 0)
            {
                ErrorMsgLabel.Text = "查無資料!";
            }
            else
            {
                string SessionIDName = "VGR081_" + PageTimeStamp.Value;

                this.gv_ErrorData.Visible = true;
                Session["SessionID"] = SessionIDName;
                Session[SessionIDName] = dtA;
                this.gv_ErrorData.DataSource = dtA;
                if (this.TextBoxPagesize.Text == "")
                    this.gv_ErrorData.PageSize = 10;
                else
                    this.gv_ErrorData.PageSize = Convert.ToInt32(this.TextBoxPagesize.Text);
                this.gv_ErrorData.PageIndex = 0;
                this.gv_ErrorData.DataBind();
            }

            #endregion
            
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        #endregion
    }
示例#2
0
    //檢視異常報表
    protected void but_Unusual_Report_Click(object sender, EventArgs e)
    {
        #region
        try
        {          
            DataTable dtA = new DataTable();
            this.gv_ErrorData.Visible = false;
            this.gv_OKData.Visible = false;
            if (this.TextBoxRowCountLimit.Text.Trim() == "")
            {
                this.TextBoxRowCountLimit.Text = "500";
            }
            VGRModel.VDS_VGR08_BCO bco = new VGRModel.VDS_VGR08_BCO(ConnectionDB);

            if (this.rdoType1.Checked == true)
            {
                hid_Query_Type.Value = "1";

            }
            else if (this.rdoType2.Checked)
            {
                hid_Query_Type.Value = "2";
            }
            else
            {
                hid_Query_Type.Value = "3";
            }

            dtA = bco.QueryErrorByFind(hid_Query_Type.Value, Session["UID"].ToString(), Convert.ToDateTime(System.DateTime.Now.ToShortDateString()), Convert.ToDateTime(System.DateTime.Now.ToShortDateString()), Convert.ToInt32(this.TextBoxRowCountLimit.Text.Trim()));

            #region 資料與GridView繫結

            //抓取本頁初次登記的時間
            if (dtA.Rows.Count == 0)
            {

                ErrorMsgLabel.Text = "查無資料!";

            }
            else
            {
                string SessionIDName = "VGR081_" + PageTimeStamp.Value;

                this.gv_ErrorData.Visible = true;
                Session["SessionID"] = SessionIDName;
                Session[SessionIDName] = dtA;
                this.gv_ErrorData.DataSource = dtA;
                if (this.TextBoxPagesize.Text == "")
                    this.gv_ErrorData.PageSize = 10;
                else
                    this.gv_ErrorData.PageSize = Convert.ToInt32(this.TextBoxPagesize.Text);
                this.gv_ErrorData.PageIndex = 0;
                this.gv_ErrorData.DataBind();
            }

            #endregion            

        }
        catch (Exception ex)
        {
            this.ErrorMsgLabel.Text = ex.Message;
        }
        finally { }
        #endregion
    }