Ejemplo n.º 1
0
    protected int QueryPurchaseMain()
    {
        MaintainPurchaseOrder BCO = new MaintainPurchaseOrder(ConntionDB);

        ParameterList.Clear();

        ParameterList.Add(txtPURCHASE_NO.Text.Trim());

        DataTable dt = BCO.QuerySwitch(PURCommon.QueryType.PK, ParameterList);

        //iResult 0:查無資料 1:有資料但全部結案 2:有資料(可能包含部分結案)

        SLP_VendorBase1.Text = "";
        txtStatus.Text = ""; //此欄位是在途單的狀態 非採購單的狀態

        int iResult = 2;
        if (dt.Rows.Count == 0)
        {
            iResult = 0;
        }
        else
        {
            SLP_VendorBase1.Text = dt.Rows[0]["VENDOR"].ToString().Trim();
            if (dt.Rows[0]["STATUS"].ToString().Trim() == "75")
            {
                iResult = 1;
            }
        }
        return iResult;
    }
Ejemplo n.º 2
0
 private DataTable Get_MainData(string strPURCHASE_NO)
 {
     MaintainPurchaseOrder bco = new MaintainPurchaseOrder(ConntionDB);
     ParameterList.Clear();
     ParameterList.Add("AND M.PURCHASE_NO='" + strPURCHASE_NO + "'");
     DataTable dt = bco.QuerySwitch(PURModel.PURCommon.QueryType.Where1, ParameterList);
     return dt;
 }
Ejemplo n.º 3
0
    // 繫結資料 Master
    private bool databind_Master()
    {
        bool bResult = false;
        ErrorMsgLabel.Text = "";
        MaintainPurchaseOrder bco = new MaintainPurchaseOrder(ConntionDB);
        ParameterList.Clear();
        ParameterList.Add(this.hiddenPurchaseNo.Value);
        DataTable Dt = bco.QuerySwitch(PURModel.PURCommon.QueryType.PK, ParameterList);

        if (Dt.Rows.Count > 0)
        {
            ViewState["MasterOLDData"] = Dt;
            this.hiddenIsClose.Value = Dt.Rows[0]["IS_CLOSE"].ToString();
            this.hiddenPurchase_ID.Value = Dt.Rows[0]["ID"].ToString();
            bResult = true;
        }
        else
        {
            ErrorMsgLabel.Text = "查無此筆資料或已被其他使用者刪除,請點選上一筆/下一筆鈕或回查詢頁重新查詢!";
        }
        return bResult;
    }
Ejemplo n.º 4
0
    protected void BtnQuery_Click(object sender, EventArgs e)
    {
        try
        {
            ErrorMsgLabel.Text = "";
            ResultMsgLabel.Text = "";
            IsCheckOK = true;
            DataTable Dt = new DataTable();

            // 清空靜態變數 與 檢查各查詢參數是否正確   
            string strWhere = "";
            strWhere = this.getQuerySqlStatement();

            if (IsCheckOK)
            {
                MaintainPurchaseOrder bco = new MaintainPurchaseOrder(ConntionDB);
                ParameterList.Clear();
                ParameterList.Add(strWhere);
                ParameterList.Add(TextBoxRowCountLimit.Text.Trim());
                Dt = bco.QuerySwitch(PURModel.PURCommon.QueryType.Where1, ParameterList);

                if (Dt == null || (Dt != null && Dt.Rows.Count <= 0))
                {
                    ResultMsgLabel.Text = "查無資料";
                }
                else
                {
                    dt_Detail = Dt;
                }

                // 設定頁面狀態
                this.hid_PageStatus.Value = "QUERY";
                this.txt_PageStatus.Text = "QUERY";

                // 設定查詢結果
                this.gv_Detail.DataSource = Dt;
                this.gv_Detail.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) < 0) ? 10 : int.Parse(TextBoxPagesize.Text);
                this.gv_Detail.PageIndex = 0;

                if (Dt.Rows.Count > 0)
                    Set_SessionNo(dt_Detail.DefaultView);
                else
                    Session["PUR02_SortKey" + PageTimeStamp.Value] = null;
            }
            else
            {
                this.gv_Detail.DataSource = null;
            }
            this.gv_Detail.DataBind();

        }
        catch (Exception ex)
        { this.ErrorMsgLabel.Text = ex.ToString(); }
        finally { }

    }