예제 #1
0
        /// <summary>
        /// VAM23異常資料報表
        /// </summary>
        /// <param name="ParameterList">變數清單</param>
        /// <returns>回傳查詢結果</returns>
        public DataTable VAM23_1(ArrayList ParameterList)
        {
            #region 宣告變數

            BCO.CAMCommon CAMCommonBCO = new BCO.CAMCommon();
            ArrayList arl_ReportService = new ArrayList();
            DataTable dt_Return = new DataTable();

            #endregion

            #region 傳入參數

            arl_ReportService.Clear();

            arl_ReportService.Add(CAMCommonBCO.GetValueSetParameter(ParameterList[0].ToString(), "string", false));
            arl_ReportService.Add(CAMCommonBCO.GetValueSetParameter(ParameterList[1].ToString(), "string", false));
            arl_ReportService.Add(CAMCommonBCO.GetValueSetParameter(ParameterList[2].ToString(), "string", false));
            arl_ReportService.Add(CAMCommonBCO.GetValueSetParameter(ParameterList[3].ToString(), "int", false));
            arl_ReportService.Add(CAMCommonBCO.GetValueSetParameter(ParameterList[4].ToString(), "string", false));

            #endregion

            #region 連結資料庫

            VAM23_BCO bco = new VAM23_BCO(ConntionDB);
            dt_Return = bco.QueryError(arl_ReportService);

            #endregion

            #region 檢查回傳資料

            if (dt_Return.Rows.Count == 0)
            { throw new Exception("查無資料"); }
            else
            { return dt_Return; }

            #endregion
        }
예제 #2
0
    private void QueryData()
    {
        #region
        DateTime dateA;
        if (SLP_YearMonth2.Text.Trim().Length != 6)
        {
            ErrorMsgLabel.Text = "年月格式有誤,請重新輸入";
        }
        else if (DateTime.TryParse(SLP_YearMonth2.Text.Substring(0, 4) + "/" + SLP_YearMonth2.Text.Substring(4, 2) + "/01", out dateA) == false)
        {
            ErrorMsgLabel.Text = "年月格式有誤,請重新輸入";
        }
        else
        {
            CAMCommon CAMCommonBCO = new CAMCommon();
            DataTable dt_Return = new DataTable();
            ArrayList ParameterList = new ArrayList();

            ParameterList.Clear();
            ParameterList.Add(CAMCommonBCO.GetValueSetParameter(rblCloseType.SelectedValue, "string", false));
            ParameterList.Add(CAMCommonBCO.GetValueSetParameter(SLP_YearMonth2.Text, "string", false));
            ParameterList.Add(CAMCommonBCO.GetValueSetParameter(SLP_VENDOR.Text, "string", false));
            Int32 iTopRowNum;
            Int32.TryParse(TextBoxRowCountLimit.Text.Trim(), out iTopRowNum);
            ParameterList.Add(iTopRowNum);
            ParameterList.Add(CAMCommonBCO.GetValueSetParameter(Session["UID"].ToString(), "string", false));

            BCO.VAM23_BCO BCO = new BCO.VAM23_BCO(ConntionDB);
            dt_Return = BCO.QueryError(ParameterList);

            if (dt_Return.Rows.Count > 0)
            {
                string SessionIDName = string.Format("{0}_{1}", PageProgramCode, PageTimeStamp.Value);
                Session["SessionID"] = SessionIDName;
                Session[SessionIDName] = dt_Return;
                this.gv_ErrorData.DataSource = dt_Return.DefaultView;

                this.gv_ErrorData.PageSize = (TextBoxPagesize.Text == "") ? 50 : (int.Parse(TextBoxPagesize.Text) <= 0) ? 50 : int.Parse(TextBoxPagesize.Text);
                this.gv_ErrorData.PageIndex = 0;
                this.gv_ErrorData.DataBind();
            }
            else
            {
                this.gv_ErrorData.DataBind();
                ErrorMsgLabel.Text = "查無資料";
            }
        }

        up_ErrorMsg.Update();
        up_GridView.Update();
        #endregion
    }