Exemplo n.º 1
0
    }//ButtonNew_Click

    protected void ButtonQuery_Click(object sender, EventArgs e)
    {
        #region
        try
        {
            #region 檢查條件
            this.ErrorMsgLabel.Text = "";
            string s_CheckPage = CheckPage(sender);

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

            if (this.SLP_SLPDateRange1.StartDate.ToString() != "" || this.SLP_SLPDateRange1.EndDate.ToString() != "")
            {
                ScriptManager.RegisterStartupScript(Page, this.GetType(), "VAM071", "alert('您輸入單據日期條件將忽略不列入查詢');", true);

            }
            #endregion

            #region 傳入參數
            string Number1_OP, Number2_OP, Number3_OP;
            if (this.SLP_SLPNumber1.Operator == "0")
                Number1_OP = "<";
            else if (this.SLP_SLPNumber1.Operator == "1")
                Number1_OP = "=";
            else
                Number1_OP = ">";

            if (this.SLP_SLPNumber2.Operator == "0")
                Number2_OP = "<";
            else if (this.SLP_SLPNumber2.Operator == "1")
                Number2_OP = "=";
            else
                Number2_OP = ">";

            if (this.SLP_SLPNumber3.Operator == "0")
                Number3_OP = "<";
            else if (this.SLP_SLPNumber3.Operator == "1")
                Number3_OP = "=";
            else
                Number3_OP = ">";

            ParameterList.Clear();
            ParameterList.Add(GetValueSetParameter("", "int", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_VendorDisc1.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_SLPDateRange2.StartDate.ToString(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_SLPDateRange2.EndDate.ToString(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_EnumBase1.Text.Trim(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_VendorBase1.Text.Trim(), "string", false));
            ParameterList.Add(Number1_OP);
            ParameterList.Add(GetValueSetParameter(this.SLP_SLPNumber1.Text.Trim(), "Decimal", false));
            ParameterList.Add(Number2_OP);
            ParameterList.Add(GetValueSetParameter(this.SLP_SLPNumber2.Text.Trim(), "Decimal", false));
            ParameterList.Add(Number3_OP);
            ParameterList.Add(GetValueSetParameter(this.SLP_SLPNumber3.Text.Trim(), "Decimal", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_SLPDateRange3.StartDate.ToString(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.SLP_SLPDateRange3.EndDate.ToString(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.TextBoxRowCountLimit.Text.Trim(), "int", false));
            ParameterList.Add(GetValueSetParameter(this.ddlTRANS_TAX.Text, "string", false));

            #endregion

            #region 取得資料

            DataTable dt_Return = new DataTable();

            BCO.MaintainDiscountInvoice bco = new BCO.MaintainDiscountInvoice(ConnectionDB);
            dt_Return = bco.QueryByFind(ParameterList);

            #endregion

            #region 資料與GridView繫結

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

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

                ArrayList NOList = new ArrayList();
                for (int i = 0; i < dt_Return.Rows.Count; i++)
                {
                    string[] strNO = new string[2];
                    strNO[0] = dt_Return.Rows[i]["DISC_NO"].ToString();
                    strNO[1] = SessionIDName;
                    NOList.Add(strNO);
                }

                Session["VAM071Query" + SessionIDName] = NOList;
            }

            #endregion
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        #endregion
    }//ButtonQuery_Click	
Exemplo n.º 2
0
    private void LoadData(string sDISC_NO)
    {
        #region 傳入參數

        ParameterList.Clear();
        ParameterList.Add(GetValueSetParameter("", "int", false));
        ParameterList.Add(GetValueSetParameter(sDISC_NO, "string", false));
        ParameterList.Add(GetValueSetParameter("", "string", false));
        ParameterList.Add(GetValueSetParameter("", "string", false));
        ParameterList.Add(GetValueSetParameter("", "string", false));
        ParameterList.Add(GetValueSetParameter("", "string", false));
        ParameterList.Add("<");
        ParameterList.Add(GetValueSetParameter("", "Decimal", false));
        ParameterList.Add("<");
        ParameterList.Add(GetValueSetParameter("", "Decimal", false));
        ParameterList.Add("<");
        ParameterList.Add(GetValueSetParameter("", "Decimal", false));
        ParameterList.Add(GetValueSetParameter("", "string", false));
        ParameterList.Add(GetValueSetParameter("", "string", false));
        ParameterList.Add(GetValueSetParameter("1", "int", false));
        ParameterList.Add("");
        #endregion

        #region 取得資料

        DataTable dt_Return = new DataTable();

        BCO.MaintainDiscountInvoice bco = new BCO.MaintainDiscountInvoice(ConnectionDB);
        dt_Return = bco.QueryByFind(ParameterList);

        #endregion

        #region 資料與GridView繫結

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

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

            ArrayList NOList = new ArrayList();
            for (int i = 0; i < dt_Return.Rows.Count; i++)
            {
                string[] strNO = new string[2];
                strNO[0] = dt_Return.Rows[i]["DISC_NO"].ToString();
                strNO[1] = SessionIDName;
                NOList.Add(strNO);
            }

            Session["VAM071Query" + SessionIDName] = NOList;
        }

        #endregion
    }