Example #1
0
    /// <summary>
    /// 繫結資料到控制項
    /// </summary>
    /// <param name="vdb"></param>
    private void QueryData()
    {
        #region
        ErrorMsgLabel.Text = "";

        string strCountLimit = TextBoxRowCountLimit.Text.Trim();
        if (strCountLimit == "")
        {
            ErrorMsgLabel.Text = "顯示筆數未設定";
            return;
        }
        int iTemp = 0;
        if (int.TryParse(strCountLimit, out iTemp) == false)
        {
            ErrorMsgLabel.Text = "顯示筆數輸入型態錯誤";
            return;
        }
        string SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value);

        ALOModel.ALO24_BCO BCO = new ALOModel.ALO24_BCO(ConnectionDB);
        ArrayList Para = new ArrayList();
        Para.Clear();
        Para.Add(SLP_SLPDate1.Text.Trim());
        Para.Add(SLP_StoreChain1.Text.Trim());
        Para.Add(SLP_SKU1.Text.Trim());
        Para.Add(SLP_ItemPeriod1.Text.Trim());
        Para.Add(strCountLimit);

        DataTable dt = BCO.QueryByFind(Para);

        Session[SessionIDName] = dt;
        Int32 iRowCount = 0;

        GridView1.DataSource = dt;
        GridView1.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) <= 0) ? 10 : int.Parse(TextBoxPagesize.Text);
        GridView1.PageIndex = 0;
        GridView1.DataBind();


        if (dt != null && dt.Rows.Count > 0)
        {

        }
        else
        {
            ErrorMsgLabel.Text = "查無資料";
        }

        #endregion
    }//QueryData
Example #2
0
    protected void ButtonUpdate_Click(object sender, EventArgs e)
    {
        #region
        ErrorMsgLabel.Text = "";

        string strCHAN_ITEM = txtCHAN_ITEM.Text.Trim();
        if (strCHAN_ITEM == "")
        {
            ErrorMsgLabel.Text = "[新通路對照號]欄位必填";
            return;
        }

        ALOModel.ALO24_BCO BCO = new ALOModel.ALO24_BCO(ConnectionDB);
        ArrayList Para = new ArrayList();
        Para.Clear();
        Para.Add(SLP_SLPDate1.Text.Trim());
        Para.Add(SLP_StoreChain1.Text.Trim());
        Para.Add(SLP_SKU1.Text.Trim());
        Para.Add(SLP_ItemPeriod1.Text.Trim());
        Para.Add(strCHAN_ITEM);

        int iUpdateCount = BCO.UpdateSTChanNo(Para);

        if(iUpdateCount>0)
            ErrorMsgLabel.Text = "修改完成,已異動 " + iUpdateCount.ToString() +" 筆";
        else
            ErrorMsgLabel.Text = "查無資料";

        GridView1.DataSource = null;
        GridView1.DataBind();

        #endregion
    }