示例#1
0
    //架貨查詢
    protected void btnQ2_Click(object sender, EventArgs e)
    {
        if (SLP_SHELT_CM3_S.Text.Trim() == "" && SLP_SHELT_CM3_E.Text.Trim() == "" && SLP_SHELT_NO.Text.Trim() == "")
        {
            lblErrorQ2.Text = "請至少需輸入一項查詢條件";
            return;
        }
        else if (SLP_SHELT_CM3_S.Text.Trim().Length > 0 && SLP_SHELT_CM3_E.Text.Trim().Length == 0)
        {
            lblErrorQ2.Text = "請輸入貨架尺寸迄";
            return;
        }
        else if (SLP_SHELT_CM3_S.Text.Trim().Length == 0 && SLP_SHELT_CM3_E.Text.Trim().Length > 0)
        {
            lblErrorQ2.Text = "請輸入貨架尺寸起";
            return;
        }
        else if (SLP_SHELT_NO.TextBox_Name.Text == "查無資料")
        {
            lblErrorQ2.Text = "請輸入正確之貨架代號";
            return;
        }
        else if (SLP_SHELT_CM3_S.Text.Trim().Length > 0 && SLP_SHELT_CM3_E.Text.Trim().Length > 0)
        {
            if (int.Parse(SLP_SHELT_CM3_S.Text) > int.Parse(SLP_SHELT_CM3_E.Text))
            {
                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); //配本商品期別
            if (SLP_SHELT_CM3_S.Text.Trim().Length == 0) ParameterList.Add(System.DBNull.Value); else ParameterList.Add(SLP_SHELT_CM3_S.Text); //貨架尺寸起
            if (SLP_SHELT_CM3_E.Text.Trim().Length == 0) ParameterList.Add(System.DBNull.Value); else ParameterList.Add(SLP_SHELT_CM3_E.Text); //貨架尺寸迄
            ParameterList.Add(SLP_SHELT_NO.Text); //貨架代號
            ParameterList.Add(Session["UID"].ToString()); //登入者
            BCO.MaintainDisRecord bco = new BCO.MaintainDisRecord(ConnectionDB);
            DataTable dt = new DataTable();
            dt = bco.QureryDisStoreForShelf(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; }
    }