Example #1
0
    //異常查詢
    protected void ButtonQuery_Click(object sender, EventArgs e)
    {
        #region
        try
        {
            ErrorMsgLabel1.Text = "";
            DataTable dt = new DataTable();

            BCO.VDS_IVM38_BCO bco = new BCO.VDS_IVM38_BCO(ConntionDB);
            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;
            dt = bco.QueryErrorByFind(GetValueSetParameter(this.txt_User.Text.Trim(), "string", this.CheckBoxLikeSearch.Checked).ToString(), dateB, dateE);

            #region 資料與GridView繫結

            //抓取本頁初次登記的時間
            if (dt.Rows.Count == 0)
            {
                this.gv_ErrorData.Visible = false;
                ErrorMsgLabel1.Text = "查無資料!";
            }
            else
            {
                string SessionIDName = "IVM381_ERR" + PageTimeStamp.Value;
                this.gv_ErrorData.Visible = true;
                Session["SessionID"] = SessionIDName;
                Session[SessionIDName] = dt;
                this.gv_ErrorData.DataSource = dt;
                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)
        {
            ErrorMsgLabel1.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0];  //直接取第一個
        }
        #endregion
    }
Example #2
0
    //檢視異常報表
    protected void but_Unusual_Report_Click(object sender, EventArgs e)
    {
        #region
        try
        {
            ErrorMsgLabel1.Text = "";
            DataTable dt = new DataTable();
            this.gv_ErrorData.Visible = false;

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

            dt = bco.QueryErrorByFind(Session["UID"].ToString(), Convert.ToDateTime(System.DateTime.Now.ToShortDateString()), Convert.ToDateTime(System.DateTime.Now.ToShortDateString()));

            #region 資料與GridView繫結

            //抓取本頁初次登記的時間
            if (dt.Rows.Count == 0)
            {
                ErrorMsgLabel1.Text = "查無資料!";
            }
            else
            {
                string SessionIDName = "IVM381_ERR" + PageTimeStamp.Value;
                this.gv_ErrorData.Visible = true;
                Session["SessionID"] = SessionIDName;
                Session[SessionIDName] = dt;
                this.gv_ErrorData.DataSource = dt;
                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.ErrorMsgLabel1.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0];  //直接取第一個
        }
        finally { }
        #endregion
    }