Esempio n. 1
0
    /// <summary>
    /// 將變更後的內部變量this.CallBackValue返回給前台JavaScript方法ReceiveServerData(string Value)。

    /// </summary>
    /// <returns></returns>
    string ICallbackEventHandler.GetCallbackResult()
    {
        if (CallBackValue != string.Empty)
        {
            try
            {
                TextBox txt_CHAN_NO = (TextBox)((ASP.stm_slp_slp_storechain_ascx)slp_CHAN_NO).FindControl("TextBoxCode");//通路
                TextBox txt_STORE = (TextBox)((ASP.stm_slp_slp_store_ascx)slp_STORE).FindControl("TextBoxCode");//門市

                TextBox txt_ITEM = (TextBox)((ASP.itm_slp_slp_sku_ascx)slp_ITEM).FindControl("TextBoxCode");//品號
                TextBox txt_PERIOD = (TextBox)((ASP.itm_slp_slp_itemperiod_ascx)slp_PERIOD).FindControl("TextBoxCode");//期別

                System.Text.StringBuilder sb = new System.Text.StringBuilder();
                CallBackValue = CallBackValue.Trim();
                string[] s_Client_String = System.Text.RegularExpressions.Regex.Split(CallBackValue, "<partition>", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
                ArrayList ParameterList = new ArrayList();//20091117

                #region 離開欄位[@門市]

                if (s_Client_String[0] == "離開欄位[@門市]")
                {
                    #region 從資料庫查詢資料

                    ParameterList.Clear();
                    ParameterList.Add(s_Client_String[1]);//門市

                    ParameterList.Add(string.Empty);//通路
                    ParameterList.Add(Session["UID"].ToString());

                    DataTable dt_Return = new DataTable();
                    BCO.MaintainStore bco = new BCO.MaintainStore(ConntionDB);
                    dt_Return = bco.QUERY_STORE_BY_STOREANDCHAN(ParameterList);

                    #endregion

                    if (dt_Return.Rows.Count == 0)
                    {
                        sb.Append("離開欄位[@門市]<partition>");
                        sb.Append("FALSE<partition>");
                        sb.Append("查無資料<partition>");
                        sb.Append(txt_STORE.ClientID + "<partition>");//設定焦點的欄位

                        sb.Append(txt_CHAN_NO.ClientID);
                    }
                    else
                    {
                        sb.Append("離開欄位[@門市]<partition>");
                        sb.Append("TRUE<partition>");
                        sb.Append(dt_Return.Rows[0]["CHAN_NO"].ToString() + "<partition_Detail>" + txt_CHAN_NO.ClientID);
                    }
                }

                #endregion

                #region 異動欄位[@二段碼]設定值後

                else if (s_Client_String[0] == "異動欄位[@二段碼]設定值後")
                {
                    #region 從資料庫查詢資料

                    ParameterList.Clear();
                    ParameterList.Add(s_Client_String[1]);//通路
                    ParameterList.Add(s_Client_String[2]);//一段碼
                    ParameterList.Add(s_Client_String[3]);//二段碼

                    ParameterList.Add(Session["UID"].ToString());

                    DataTable dt_Return = new DataTable();
                    BCO.QueryCRMCommon bco = new BCO.QueryCRMCommon(ConntionDB);
                    dt_Return = bco.QueryItemPeriodInfoByBarcode(ParameterList);

                    #endregion

                    if (dt_Return.Rows.Count == 0)
                    {
                        sb.Append("異動欄位[@二段碼]設定值後<partition>");
                        sb.Append("FALSE<partition>");
                        sb.Append("此一段碼/二段碼不存在對應商品期別資訊,請重新輸入<partition>");
                        sb.Append(this.txt_BARCODE.ClientID + "<partition>");//設定焦點的欄位

                        sb.Append(this.txt_PERIOD_BARCODE.ClientID + "<partition>");
                        sb.Append(txt_ITEM.ClientID + "<partition>");
                        sb.Append(txt_PERIOD.ClientID);
                    }
                    else
                    {
                        sb.Append("異動欄位[@二段碼]設定值後<partition>");
                        sb.Append("TRUE<partition>");
                        sb.Append(dt_Return.Rows[0]["ITEM"].ToString() + "<partition_Detail>" + txt_ITEM.ClientID + "<partition>");
                        sb.Append(dt_Return.Rows[0]["PERIOD"].ToString() + "<partition_Detail>" + txt_PERIOD.ClientID);
                    }

                }
                #endregion

                #region 異動欄位[@品號/品名]設定值後

                else if (s_Client_String[0] == "異動欄位[@品號/品名]設定值後")
                {
                    #region 從資料庫查詢資料

                    ParameterList.Clear();
                    ParameterList.Add(s_Client_String[1]);//品號
                    ParameterList.Add(Session["UID"].ToString());

                    DataTable dt_Return_1 = new DataTable();
                    BCO.QueryCRMCommon bco = new BCO.QueryCRMCommon(ConntionDB);
                    dt_Return_1 = bco.GetMaxDeiveryPeriod(ParameterList);

                    #endregion

                    if (dt_Return_1.Rows[0]["PERIOD"].ToString() == string.Empty)
                    {
                        sb.Append("異動欄位[@品號/品名]設定值後<partition>");
                        sb.Append("FALSE<partition>");
                        sb.Append("查無資料<partition>");
                        sb.Append(txt_ITEM.ClientID);//設定焦點的欄位

                    }
                    else
                    {
                        sb.Append("異動欄位[@品號/品名]設定值後<partition>");
                        sb.Append("TRUE<partition>");
                        sb.Append(dt_Return_1.Rows[0]["PERIOD"].ToString() + "<partition_Detail>" + txt_PERIOD.ClientID);
                    }
                }

                #endregion

                CallBackValue = sb.ToString();
            }
            catch (Exception ex)
            { CallBackValue = "發生例外錯誤<partition>" + ex.Message; }
        }

        return CallBackValue;
    }
Esempio n. 2
0
    /// <summary>
    /// 異動欄位[@品號/品名]設定值後
    /// </summary>
    /// <param name="strItem"></param>
    /// <param name="strUserID"></param>
    /// <returns></returns>
    private DataTable GetPeriodByItem(string strItem,string strUserID)
    {
        #region
        try
        {
            ArrayList ParameterList = new ArrayList();
            ParameterList.Clear();
            ParameterList.Add(strItem);//品號
            ParameterList.Add(strUserID);
            CRMModel.QueryCRMCommon BCO = new CRMModel.QueryCRMCommon(ConnectionDB);
            return BCO.GetMaxDeiveryPeriod(ParameterList);
        }
        catch (Exception ex)
        {
            throw ex;
        }

        #endregion
    }