Esempio n. 1
0
    //門市查詢
    protected void btnQ4_Click(object sender, EventArgs e)
    {
        if (SLP_STORE_S.Text.Trim() == "" && SLP_STORE_E.Text.Trim() == "")
        {
            lblErrorQ2.Text = "請輸入門市起迄";
            return;
        }
        else if (SLP_STORE_S.Text.Trim().Length > 0 && SLP_STORE_E.Text.Trim().Length == 0)
        {
            lblErrorQ2.Text = "請輸入門市迄";
            return;
        }
        else if (SLP_STORE_S.Text.Trim().Length == 0 && SLP_STORE_E.Text.Trim().Length > 0)
        {
            lblErrorQ2.Text = "請輸入門市起";
            return;
        }
        else if (SLP_STORE_S.TextBox_Name.Text == "查無資料")
        {
            lblErrorQ2.Text = "請輸入正確之門市起";
            return;
        }
        else if (SLP_STORE_E.TextBox_Name.Text == "查無資料")
        {
            lblErrorQ2.Text = "請輸入正確之門市迄";
            return;
        }
        else if (SLP_STORE_S.Text.Trim().Length > 0 && SLP_STORE_E.Text.Trim().Length > 0)
        {
            if (SLP_STORE_S.Text.Trim().Length > SLP_STORE_E.Text.Trim().Length)
            {
                lblErrorQ2.Text = "門市起不可大於門市迄";
                return;
            }
            else
            {
                if (string.Compare(SLP_STORE_S.Text.Trim(), SLP_STORE_E.Text.Trim()) > 0)
                {
                    lblErrorQ2.Text = "門市起不可大於門市迄";
                    return;
                }
            }
        }
        try
        {
            ArrayList ParameterList = new ArrayList();//20091113

            ParameterList.Clear();
            ParameterList.Add(PageTimeStamp.Value + Session["UID"].ToString());
            ParameterList.Add("ALO121"); //V_PG_ID
            ParameterList.Add(txtDIS_NO.Text); //配本序號
            ParameterList.Add(hidITEM.Value); //配本商品品號
            ParameterList.Add(hidPERIOD.Value); //配本商品期別
            ParameterList.Add(SLP_STORE_S.Text); //貨架代號
            ParameterList.Add(SLP_STORE_E.Text); //貨架代號
            ParameterList.Add(Session["UID"].ToString()); //登入者
            BCO.MaintainDisRecord bco = new BCO.MaintainDisRecord(ConnectionDB);
            DataTable dt = new DataTable();
            dt = bco.QureryDisStoreForStoreRange(ParameterList);
            txtQueryTotRec.Text = dt.Rows.Count.ToString();
            ComputeTotQty(dt); //計算查詢總配量
            string SessionIDName = "ALO121_dt5" + PageTimeStamp.Value;
            Session[SessionIDName] = dt;
            if (dt.Rows.Count == 0)
            {
                lblErrorQ2.Text = "查無資料";
                GridView2.DataSource = null;
            }
            else
                GridView2.DataSource = CopyTable(dt);
            GridView2.DataBind();
            Resize_Div(GridView2.Rows.Count);
            UpdatePanel1.Update();
        }
        catch (Exception ex) { this.lblErrorQ2.Text = ex.Message; }
    }