protected void ButtonQuery_Click(object sender, EventArgs e)
    {
        try
        {
            //清除目前選擇DATA            
            this.SelectLabelCode.Text = "";
            this.SelectLabelName.Text = "";

            GridView1.PageSize = Convert.ToInt32(TextBoxPagesize.Text.Trim());
            INVModel.MaintainStockLocate bco = new INVModel.MaintainStockLocate(ConntionDB);
            firstpage = 0;
            firstindex = -1;

            ParameterList.Clear();            
            if(TextBoxCode.Text.Trim()!="")
                ParameterList.Add(TextBoxCode.Text.Trim());
            else
                ParameterList.Add(" ");
            ParameterList.Add(TextBoxRowCountLimit.Text.Trim());

            databind(bco.QueryStockLocateByLike3(ParameterList));
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        finally { }
    }//ButtonQuery_Click
    public string LocateSecName(string Code,
                                string LOCATE_NO
                                )
    {
        string Name = "";
        string ConnectionDBStr = ((DatabaseSettings)ConfigurationManager.GetSection("dataConfiguration")).DefaultDatabase;
        MaintainStockLocate co_main = new MaintainStockLocate(ConnectionDBStr);

        if (Code != "")
        {
            ArrayList ParameterList = new ArrayList();
            ParameterList.Clear();
            ParameterList.Add(Code);
            ParameterList.Add(LOCATE_NO);


            DataTable dt = co_main.QueryForSLP(ParameterList);
            Name = ((dt.Rows.Count > 0) ? dt.Rows[0]["NOTES"].ToString() : "查無資料");
        }

        return Name;
    }
 public SLP_LocateSec()
 {
     co_main = new INVModel.MaintainStockLocate(ConntionDB);
 }
    public LocateSecObj SimpleLocateSecName(string Code)
    {
        LocateSecObj LSO = new LocateSecObj();
        string ConnectionDBStr = ((DatabaseSettings)ConfigurationManager.GetSection("dataConfiguration")).DefaultDatabase;
        MaintainStockLocate StockLocate = new MaintainStockLocate(ConnectionDBStr);

        if (Code.Trim() != "")
        {

            ArrayList ParameterList = new ArrayList();
            ParameterList.Add(Code);
            
            DataTable dt = StockLocate.QueryByLikeForSimpleSLP(ParameterList);
            

            if (dt.Rows.Count > 0)
            {
                LSO.Explain = dt.Rows[0]["explain"].ToString();
                LSO.LocateNo = dt.Rows[0]["Locate_No"].ToString();
                LSO.LocateSection = dt.Rows[0]["Locate_Section"].ToString();
            }            
        }

        return LSO;
    }
Beispiel #5
0
    }//ButtonQuery_Click			

    /// <summary>
    /// 繫結資料到控制項
    /// </summary>
    private void databind(string queryType)
    {
        //抓取本頁初次登記的時間
        string SessionIDName = "INV011_" + PageTimeStamp.Value;

        MaintainStockLocate BCO = new MaintainStockLocate(ConntionDB);
        DataTable Dt;
        if (queryType == "Excel")
        {
            Dt = BCO.QueryStockLocateByFind_INV011_Export(ParameterList);
        }
        else
        {
            ViewState["SortField"] = null;
            ViewState["SortDirect"] = null;
            Dt = BCO.QueryStockLocateByFind_INV011(ParameterList);
            Dt.Columns.Add("chkSel", Type.GetType("System.String"));
        }
        DataTable dt = Dt.Copy(); //複製成另一份,因匯出時有加Html空白

        Session[SessionIDName] = Dt;
        Session["INV01"] = dt;

        if (queryType == "DataGrid")
        {
            GridView1.DataSource = Dt;
            //設定分頁大小
            GridView1.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) < 0) ? 10 : int.Parse(TextBoxPagesize.Text);
            GridView1.PageIndex = 0;
            GridView1.DataBind();
        }
        #region 將Key值存到Session中

        ArrayList arl_Key = new ArrayList();
        foreach (DataRow drRow in Dt.Rows)
        { arl_Key.Add(drRow["ID"].ToString()); }

        Session["INV011_SortKey" + PageTimeStamp.Value] = arl_Key;

        #endregion
    }//databind
    protected void ButtonQuery_Click(object sender, EventArgs e)
    {
        try
        {
            //清除目前選擇DATA
            //this.lblID.Text = "";
            //this.lblLOATE_SHELF.Text = "";
            //this.lblLOCATE_AISLE.Text = "";
            //this.lblLOCATE_GRID.Text = "";
            //this.lblLOCATE_NO.Text = "";
            this.lblLOCATE_SECTION.Text = "";
            this.lblNOTES.Text = "";

            //GridView1.PageSize = Convert.ToInt32(TextBoxPagesize.Text.Trim());
            INVModel.MaintainStockLocate bco = new PIC.VDS2G.GFM.INV.MaintainStockLocate(ConntionDB);
            firstpage = 0;
            firstindex = -1;

            ParameterList.Clear();
            ParameterList.Add(txtLOCATE_NO.Text.Trim());
            ParameterList.Add(txtLOCATE_SECTION.Text.Trim());
            ParameterList.Add(TextBoxRowCountLimit.Text.Trim());
            databind(bco.QueryByLikeForSLP(ParameterList));
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        finally { }
    }//ButtonQuery_Click