Esempio n. 1
0
    protected void txtPERIOD_Changed(object sender, EventArgs e)
    {
        if (txtITEM.Text == "" || txtPERIOD.Text == "")
        {
            txtPERIOD_BARCODE.Text = "";
            txtMANUFACTURE.Text = "";
            txtPUBLISH_TYPE.Text = "";
            txtPRICE.Text = "";
            return;
        }

        #region 期別000000,請至圖書採購卡維護資料

        ITM.MaintainSKU bcoITEM = new PIC.VDS2G.GFM.ITM.MaintainSKU(ConntionDB);
        ParameterList.Clear();
        ITM.SQLHelper.SQLWhere(ref ParameterList, DbType.String, "MA.ITEM", txtITEM.Text, "=", "and");
        DataTable dtItem = bcoITEM.QuerySKUByFind_1(ParameterList);
        if (dtItem.Rows.Count > 0)
        {
            DataRow drItem = dtItem.Rows[0];
            if (drItem["ROOT_NO"].ToString() == "2" && IsPostBack)
            {
                ShowErrorMessage("該品號群分類為圖書,請至圖書採購卡維護資料");
                txtITEM.Text = "";
                txtPERIOD.Text = "";
                hidITEM.Value = "";
                hidPeriod.Value = "";
                return;
            }
            else
            {
                //2010/09/24 added for more check
                #region
                MKT.MaintainPurchaseCard BCO_PC = new MKT.MaintainPurchaseCard(ConntionDB);

                ParameterList.Clear();
                ParameterList.Add(txtITEM.Text);
                ParameterList.Add(txtPERIOD.Text);

                bool bResult = BCO_PC.CheckIsDuplicatedByItemPeriod(ParameterList);

                if (!bResult)
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "JS", "alert('此品號/期別已開立過採購卡,請確認!');", true);
                }

                #endregion


                #region
                ITM.MaintainSKUPeriod bcoPeriod = new ITM.MaintainSKUPeriod(ConntionDB);
                ParameterList.Clear();

                ITM.SQLHelper.SQLWhere(ref ParameterList, DbType.String, "MA.ITEM", txtITEM.Text, "=", "and");
                ITM.SQLHelper.SQLWhere(ref ParameterList, DbType.String, "MA.PERIOD", txtPERIOD.Text, "=", "and");
                DataTable dt = bcoPeriod.QuerySKUPeriodByFind_1(ParameterList);
                hidPeriod.Value = txtPERIOD.Text;
                if (dt.Rows.Count > 0)
                {
                    DataRow dr = dt.Rows[0];
                    txtPERIOD_BARCODE.Text = dr["PERIOD_BARCODE"].ToString();
                    txtMANUFACTURE.Text = dr["VENDOR"].ToString();
                    txtPUBLISH_TYPE.Text = dr["PUBLISH_TYPE_NO"].ToString();
                    txtPRICE.Text = dr["PRICE"].ToString();
                }
                else
                {
                    txtPERIOD_BARCODE.Text = "";
                    txtMANUFACTURE.Text = "";
                    txtPUBLISH_TYPE.Text = "";
                    txtPRICE.Text = "";
                }
                #endregion
            }
        }


        Focus(txtPLAN_ACCEPT_DATE.DateTextBox.ClientID);
        /*
        if (txtPERIOD.Text == "000000")
        {
            ShowErrorMessage("期別000000,請至圖書採購卡維護資料");
            txtPERIOD.Text = "";
        }
         */
        #endregion
    }
Esempio n. 2
0
    protected void txtITEM_Changed(object sender, EventArgs e)
    {
        if (txtITEM.Text != "")
        {
            ITM.MaintainSKU bcoITEM = new PIC.VDS2G.GFM.ITM.MaintainSKU(ConntionDB);
            ParameterList.Clear();
            ITM.SQLHelper.SQLWhere(ref ParameterList, DbType.String, "MA.ITEM", txtITEM.Text, "=", "and");
            DataTable dtItem = bcoITEM.QuerySKUByFind_1(ParameterList);
            if (dtItem.Rows.Count > 0)
            { 
                DataRow drItem = dtItem.Rows[0];
                if (drItem["ROOT_NO"].ToString() == "1" && IsPostBack)
                {
                    ShowErrorMessage("該品號群分類為雜誌,請至雜誌採購卡維護資料");
                    txtITEM.Text = "";
                    return; 
                }
                txtPATTERN_NO.Text = drItem["PATTERN_NO"].ToString();

                txtPRICE.Text = drItem["PRICE"].ToString();
                txtMANUFACTURE.Text = drItem["VENDOR"].ToString(); 
            }
        }
    }