Пример #1
0
    protected void btnExecute_Click(object sender, EventArgs e)
    {
        try
        {
            StringBuilder sb = new StringBuilder();

            #region 檢查計算條件
            if (this.txt_DIS_NO_OLD.Text == "")
            { sb.Append("配本序號不應為空值,請回前頁 \n\r"); }
            if (this.rb_ChanType.SelectedValue == "1")//個別通路
            {
                if (this.SLP_StoreChain1.Text == "")
                {
                    sb.Append("通路設定=個別通路時,通路代號不可為空值 \n\r");
                }
            }
            if (this.SLP_FrontCnt.Text == "")
            { sb.Append("前幾家不可為空值 \n\r"); }
            else
            {
                if (Int32.Parse(this.SLP_FrontCnt.Text.Trim()) > vNonLokcCnt)
                {
                    sb.AppendFormat("前幾家數量不可大於現在未鎖定配本門市數{0}! \n\r", vNonLokcCnt);
                }
                else if (Int32.Parse(this.SLP_FrontCnt.Text.Trim()) <= 0)
                {
                    sb.Append("前幾家數量應 >0 ! \n\r");
                }

            }
            if (this.SLP_AdjustQty.Text == "")
            { sb.Append("調整數量不可為空值 \n\r"); }
            else if (this.SLP_AdjustQty.Text == "0")
            { sb.Append("調整數量不可為0 \n\r"); }
            if (sb.ToString().Trim() != "")
            {
                throw new Exception(sb.ToString().Trim());
            }
            #endregion

            #region 執行升降冪設定
            ArrayList ParameterList = new ArrayList();//20091113
            ParameterList.Clear();
            ParameterList.Add(s_DIS_NO);//配本序號
            ParameterList.Add(s_ITEM);//品號
            ParameterList.Add(s_PERIOD);//期別
            if (rb_ChanType.SelectedValue == "0")
            {
                ParameterList.Add(null); //通路
            }
            else
            {
                ParameterList.Add(this.SLP_StoreChain1.Text);//通路
            }
            ParameterList.Add(Int32.Parse(this.rb_OrderType.Text.Trim()));//升降冪
            ParameterList.Add(Int32.Parse(this.SLP_FrontCnt.Text.Trim()));//前幾家
            ParameterList.Add(Int32.Parse(this.SLP_AdjustQty.Text.Trim()));//加減數量
            ParameterList.Add(Session["UID"].ToString());//使用者

            ALOModel.MaintainDisRecord BCOM = new ALOModel.MaintainDisRecord(ConnectionDB);
            Int32 iAdjSumQty = BCOM.CalculateForAscendorDescend(ParameterList, null);
            this.txt_AdjustSumQty.Text = iAdjSumQty.ToString();

            #endregion
        }
        catch (Exception ex)
        {
            WaringLogProcess(ex.Message);
            this.ErrorMsgLabel.Text = ex.Message;
        }
    }