Example #1
0
    protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        try
        {
            #region 檢查判斷
            //系統日>=首次出貨日或進貨開始日就不可以刪除.
            if (DateTime.Parse(GridView1.Rows[e.RowIndex].Cells[4].Text) <= DateTime.Today)
            {
                ErrorMsgLabel.Text = "不可刪除:首次出貨日須小於系統日 !!";
                return;
            }

            if (DateTime.Parse(((Label)GridView1.Rows[e.RowIndex].FindControl("lblACCEPT_DATE_START")).Text) <= DateTime.Today)
            {
                ErrorMsgLabel.Text = "不可刪除:進貨開始日須小於系統日 !!";
                return;
            }
            #endregion

            DateTime processtime = DateTime.Now;

            #region 檔期活動
            ParameterList.Clear();
            ParameterList.Add(GetValueSetParameter(GridView1.Rows[e.RowIndex].Cells[0].Text, "string", false)); //V_OLD_PROMOTE_ID
            ParameterList.Add(GetValueSetParameter(((Label)GridView1.Rows[e.RowIndex].FindControl("lblCREATEDATE")).Text, "datetime", false)); //D_OLD_CREATEDATE
            ParameterList.Add(GetValueSetParameter(((Label)GridView1.Rows[e.RowIndex].FindControl("lblCREATEUID")).Text, "string", false)); //V_OLD_CREATEUID
            ParameterList.Add(GetValueSetParameter(((Label)GridView1.Rows[e.RowIndex].FindControl("lblUPDATEDATE")).Text, "datetime", false)); //D_OLD_UPDATEDATE
            ParameterList.Add(GetValueSetParameter(((Label)GridView1.Rows[e.RowIndex].FindControl("lblUPDATEUID")).Text, "string", false)); //V_OLD_UPDATEUID
            ParameterList.Add(GetValueSetParameter(Session["UID"].ToString(), "string", false)); 
            ParameterList.Add(processtime); 
            #endregion

            STMModel.MaintainPromoteExhibition BCO = new STMModel.MaintainPromoteExhibition(ConnectionDB);

            BCO.DeleteStoreBase(ParameterList, null);

            ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "ClientScript", "alert('刪除完成');", true);

            databind();
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0];  //直接取第一個
        }
    }
    protected void btnQuery_Click(object sender, EventArgs e)
    {
        #region
        string SessionIDName = string.Format("{0}", PAGE_DT_01);

        STMModel.MaintainPromoteExhibition BCO = new STMModel.MaintainPromoteExhibition(ConnectionDB);
        ParameterList.Clear();
        ParameterList.Add(this.SLP_VENDOR.Text);
        ParameterList.Add(FIRST_DATE);
        ParameterList.Add(RETURN_DATE);
        DataTable Dt = BCO.ExpandStoreItemDiscount(ParameterList);
        GridView1.DataSource = Dt;
        Session[SessionIDName] = Dt;

        GridView1.DataBind();

        dtSelectDisChain = Dt;

         //設定分頁大小
        GridView1.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) < 0) ? 10 : int.Parse(TextBoxPagesize.Text);
        GridView1.PageIndex = 0;
        GridView1.DataBind();

        LabelQueryRecordCount.Text = string.Format(" {0} Rows ", Dt.Rows.Count.ToString());

        if (Dt == null || (Dt != null && Dt.Rows.Count <= 0))
        {
            ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "ClientScript", "alert('查無資料');", true);
        }
        #endregion
    }
Example #3
0
    /// <summary>
    /// 繫結資料到控制項
    /// </summary>
    /// <param name="vdb"></param>
    private void databind()
    {
        
        #region

        //抓取本頁初次登記的時間

        string SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value);

        STMModel.MaintainPromoteExhibition BCO = new STMModel.MaintainPromoteExhibition(ConnectionDB);

        ParameterList.Clear();

        //檔期活動
        ParameterList.Add(DBNull.Value);
        ParameterList.Add(GetValueSetParameter(this.txtPROMOTE_ID.Text, "string", CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.txtPROMOTE_NAME.Text, "string", CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_PROMOTE_MONTH.Text, "string", false));
        ParameterList.Add(GetValueSetParameter(this.SLP_ACCT_MONTH.Text, "string", false));
        ParameterList.Add(GetValueSetParameter(this.SLP_COL_DAYS.Text, "string", false));
        ParameterList.Add(DBNull.Value);  //V_COL_DAYS_EXPLAIN
        ParameterList.Add(GetValueSetParameter(this.SLP_ACCEPT_DATE_START.StartDate,"string",false));
        ParameterList.Add(GetValueSetParameter(this.SLP_ACCEPT_DATE_START.EndDate, "string", false));
        ParameterList.Add(GetValueSetParameter(this.SLP_ACCEPT_DATE_END.StartDate, "string", false));
        ParameterList.Add(GetValueSetParameter(this.SLP_ACCEPT_DATE_END.EndDate, "string", false));
        ParameterList.Add(GetValueSetParameter(this.SLP_ACCEPT_FIRST_DATE.StartDate, "string", false));
        ParameterList.Add(GetValueSetParameter(this.SLP_ACCEPT_FIRST_DATE.EndDate, "string", false));
        ParameterList.Add(GetValueSetParameter(this.SLP_RETURN_DATE_START.StartDate, "string", false));
        ParameterList.Add(GetValueSetParameter(this.SLP_RETURN_DATE_START.EndDate, "string", false));
        ParameterList.Add(GetValueSetParameter(this.SLP_RETURN_DATE_END.StartDate, "string", false));
        ParameterList.Add(GetValueSetParameter(this.SLP_RETURN_DATE_END.EndDate, "string", false));
        if (this.ddlPROMOTE_TYPE.SelectedValue == "0")
            ParameterList.Add(DBNull.Value);
        else
            ParameterList.Add(this.ddlPROMOTE_TYPE.SelectedValue.ToString());
        ParameterList.Add(DBNull.Value);  //V_PROMOTE_TYPE_EXPLAIN
        if (this.ddlDISCOUNT_TYPE.SelectedValue == "0") 
            ParameterList.Add(DBNull.Value);
        else
            ParameterList.Add(this.ddlDISCOUNT_TYPE.SelectedValue.ToString());
        ParameterList.Add(DBNull.Value);  //V_DISCOUNT_TYPE_EXPLAIN
        ParameterList.Add(GetValueSetParameter(this.SLP_NOTES.Text, "string", false));  //N_NOTES
        ParameterList.Add(DBNull.Value);
        ParameterList.Add(((DropDownList)SLP_PRICE_SUBSIDY_PERCENT.FindControl("D1")).SelectedItem.Text);
        ParameterList.Add(GetValueSetParameter(this.SLP_PRICE_SUBSIDY_PERCENT.Text, "Decimal", CheckBoxLikeSearch.Checked));
        ParameterList.Add(((DropDownList)SLP_COST_SUBSIDY_PERCENT.FindControl("D1")).SelectedItem.Text);
        ParameterList.Add(GetValueSetParameter(this.SLP_COST_SUBSIDY_PERCENT.Text, "Decimal", CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter("", "string", CheckBoxLikeSearch.Checked));
        ParameterList.Add(DBNull.Value);  //V_AC_UNAME
        if (this.SLP_CONFIRM_CODE.Text == "")
           ParameterList.Add(DBNull.Value);
        else
           ParameterList.Add(GetValueSetParameter(this.SLP_CONFIRM_CODE.Text, "string", false));
        ParameterList.Add(DBNull.Value); //V_CONFIRM_CODE_EXPLAIN
        ParameterList.Add(DBNull.Value);  //N_DISCOUNT_KIND
        ParameterList.Add(GetValueSetParameter(this.SLP_CREATE_DATE.StartDate, "string", false));
        ParameterList.Add(GetValueSetParameter(this.SLP_CREATE_DATE.EndDate, "string", false));
        ParameterList.Add(GetValueSetParameter(this.SLP_CREATE_UID.Text, "string", false));
        ParameterList.Add(DBNull.Value);  //V_CREATEUNAME
        ParameterList.Add(GetValueSetParameter(this.SLP_UPDATE_DATE.StartDate, "string", false));
        ParameterList.Add(GetValueSetParameter(this.SLP_UPDATE_DATE.EndDate, "string", false));
        ParameterList.Add(GetValueSetParameter(this.SLP_UPDATE_UID.Text, "string", false));
        ParameterList.Add(DBNull.Value);  //V_UPDATEUNAME
       
        //折扣設定
        ParameterList.Add(GetValueSetParameter(this.SLP_GROUP_NO.Text, "string", false));
        ParameterList.Add(GetValueSetParameter(this.SLP_STORE.Text, "string", false));
        ParameterList.Add(GetValueSetParameter(this.SLP_ITEM.Text, "string", false));
        ParameterList.Add(GetValueSetParameter(this.SLP_PERIOD.Text, "string", false));
        ParameterList.Add(GetValueSetParameter(this.SLP_COST_SUBSIDY_PERCENT2.Text, "Decimal", CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_PRICE_SUBSIDY_PERCENT2.Text, "Decimal", CheckBoxLikeSearch.Checked));
        ParameterList.Add(GetValueSetParameter(this.SLP_CREATE_DATE2.StartDate, "string", false));
        ParameterList.Add(GetValueSetParameter(this.SLP_CREATE_DATE2.EndDate, "string", false));
        ParameterList.Add(GetValueSetParameter(this.SLP_CREATE_UID2.Text, "string", false));
        ParameterList.Add(DBNull.Value);  //V_CREATEUNAME
        ParameterList.Add(GetValueSetParameter(this.SLP_UPDATE_DATE2.StartDate, "string", false));
        ParameterList.Add(GetValueSetParameter(this.SLP_UPDATE_DATE2.EndDate, "string", false));
        ParameterList.Add(GetValueSetParameter(this.SLP_UPDATE_UID2.Text, "string", false));
        ParameterList.Add(DBNull.Value);  //V_UPDATEUNAME
        ParameterList.Add(GetValueSetParameter(TextBoxRowCountLimit.Text, "int", false));
   
        DataTable Dt = BCO.QuerySwitch(STMModel.MaintainPromoteExhibition.QueryType.QueryByLike , ParameterList);
        
        Session[SessionIDName] = Dt;
        GridView1.DataSource = Dt;

        //設定分頁大小
        GridView1.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) < 0) ? 10 : int.Parse(TextBoxPagesize.Text);
        GridView1.PageIndex = 0;
        GridView1.DataBind();

        LabelQueryRecordCount.Text = string.Format(" {0} Rows ", Dt.Rows.Count.ToString());

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

        #region 將Key值存到Session中

        ArrayList arl_Key = new ArrayList();

        foreach (DataRow drRow in Dt.Rows)
        { arl_Key.Add("promote_id=" + drRow["PROMOTE_ID"].ToString()); }

        Session["STM272_SortKey" + this.PageTimeStamp.Value] = arl_Key;

        #endregion

        #endregion
    }//databind
Example #4
0
    private void QueryData(string v_promote_id)
    {
        bool AuthUpdateSTM22 = false;

        try
        {
            #region 將變數資料清空

            ds_Data.Tables.Clear();

            #endregion

            #region 檔期活動
            STMModel.MaintainPromoteExhibition BCO = new STMModel.MaintainPromoteExhibition(ConnectionDB);

            DataTable Dt;
            ParameterList.Clear();

            ParameterList.Add(null);
            ParameterList.Add(v_promote_id);
            for (int i = 2; i <= 53; i++)
            {
                if ((i == 23) || (i == 25))
                    ParameterList.Add(">=");
                else
                    ParameterList.Add(null);
            }
            ParameterList.Add("1");

            Dt = BCO.QuerySwitch(STMModel.MaintainPromoteExhibition.QueryType.QueryByLike, ParameterList);

            if (Dt == null || (Dt != null && Dt.Rows.Count <= 0))
            {
                ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "ClientScript", "alert('查無資料');", true);
                return;
            }

            this.txtPROMOTE_ID.Text = Dt.Rows[0]["PROMOTE_ID"].ToString();
            this.txtPROMOTE_NAME.Text = Dt.Rows[0]["PROMOTE_NAME"].ToString();
            this.txtPROMOTE_MONTH.Text = Dt.Rows[0]["PROMOTE_MONTH"].ToString();
            this.txtACCT_MONTH.Text = Dt.Rows[0]["ACCT_MONTH"].ToString();
            this.SLP_COL_DAYS.Text = Dt.Rows[0]["COL_DAYS"].ToString();
            this.SLP_ACCEPT_DATE_START.Text = Dt.Rows[0]["ACCEPT_DATE_START"].ToString();
            this.SLP_ACCEPT_DATE_END.Text = Dt.Rows[0]["ACCEPT_DATE_END"].ToString();
            this.SLP_ACCEPT_FIRST_DATE.Text = Dt.Rows[0]["ACCPET_FIRST_DATE"].ToString();
            this.hdfACCEPT_FIRST_DATE.Value = Dt.Rows[0]["ACCPET_FIRST_DATE"].ToString();
            this.SLP_RETURN_DATE_START.Text = Dt.Rows[0]["RETURN_DATE_START"].ToString();
            this.SLP_RETURN_DATE_END.Text = DateTime.Parse(Dt.Rows[0]["RETURN_DATE_END"].ToString()).ToString("yyyy/MM/dd");
            if (Dt.Rows[0]["CONFIRM_CODE"].ToString() == "1")
                this.txtCONFIRM_CODE.Text = "已審核";
            else
                this.txtCONFIRM_CODE.Text = "未審核";

            this.ddlPROMOTE_TYPE.SelectedValue = Dt.Rows[0]["PROMOTE_TYPE"].ToString();
            this.ddlDISCOUNT_TYPE.SelectedValue = Dt.Rows[0]["DISCOUNT_TYPE"].ToString();
            this.SLP_NOTES.Text = Dt.Rows[0]["NOTES"].ToString();
            this.SLP_PRICE_SUBSIDY_PERCENT.Text = Dt.Rows[0]["PRICE_SUBSIDY_PERCENT"].ToString();
            this.SLP_COST_SUBSIDY_PERCENT.Text = Dt.Rows[0]["COST_SUBSIDY_PERCENT"].ToString();

            string strPrefixed = "POP_STM2732";
            Session[string.Format("{0}_FIRST_DATE", strPrefixed)] = this.SLP_ACCEPT_FIRST_DATE.Text;
            Session[string.Format("{0}_RETURN_DATE", strPrefixed)] = this.SLP_RETURN_DATE_END.Text;

            if (this.txtCONFIRM_CODE.Text == "已審核")
            { btnPASS.Enabled = false; }
            if (this.txtCONFIRM_CODE.Text == "未審核")
            { btnNOPASS.Enabled = false; }

            //檔期審核權限
            DataTable DtC = GetFunctionCRUD("STM22");
            if (DtC.Rows.Count > 0)
            { AuthUpdateSTM22 = bool.Parse(DtC.Rows[0]["CanUpdate"].ToString()); }

            btnPASS.Enabled = (AuthUpdateSTM22) ? btnPASS.Enabled : false;
            btnNOPASS.Enabled = (AuthUpdateSTM22) ? btnNOPASS.Enabled : false;

            #endregion

            #region 門市
            STMModel.MaintainPromoteExhibition BCO_Store = new STMModel.MaintainPromoteExhibition(ConnectionDB);

            DataTable Dt_Store;
            ParameterList.Clear();

            ParameterList.Add(v_promote_id);

            Dt_Store = BCO_Store.QuerySwitch(STMModel.MaintainPromoteExhibition.QueryType.STORE, ParameterList);

            GridView1.DataSource = Dt_Store;
            //門市筆數
            this.txtCount_Store.Value = GridView1.Rows.Count.ToString();

            string SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value);
            Session[SessionIDName] = Dt_Store;

            //設定分頁大小
            GridView1.PageIndex = 0;
            GridView1.DataBind();
            this.txtCount_Store.Value = GridView1.Rows.Count.ToString();

            #endregion

            #region 商品
            STMModel.MaintainPromoteExhibition BCO_Item = new STMModel.MaintainPromoteExhibition(ConnectionDB);

            DataTable Dt_Item;
            ParameterList.Clear();

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

            Dt_Item = BCO_Item.QuerySwitch(STMModel.MaintainPromoteExhibition.QueryType.ITEM, ParameterList);

            DataView dv_Item = new DataView(Dt_Item);
            dv_Item.RowFilter = "STORE = '" + (Dt_Store.Rows.Count == 0 ? "" : Dt_Store.Rows[0]["STORE"].ToString()) + "'";

            //顯示商品Panel-門市代號
            if (Dt_Store.Rows.Count != 0)
            {
                txtITEM_STORE.Text = Dt_Store.Rows[0]["STORE"].ToString();
                lblITEM_STORE_NAME.Text = Dt_Store.Rows[0]["STORE_NAME"].ToString();
                lblITEM_GROUP_NO.Text = Dt_Store.Rows[0]["GROUP_NO"].ToString();
                lblITEM_COST.Text = Dt_Store.Rows[0]["PRICE_SUBSIDY_PERCENT"].ToString();
            }

            GridView2.DataSource = dv_Item;
            string SessionIDName2 = string.Format("{0}_{1}", PAGE_DT_02, PageTimeStamp.Value);
            Session[SessionIDName2] = dv_Item;
            //設定分頁大小
            GridView2.PageIndex = 0;
            GridView2.DataBind();
            //商品筆數
            this.txtCount_Item.Value = Dt_Item.Rows.Count.ToString();

            if (Dt == null || (Dt != null && Dt.Rows.Count <= 0))
            {
                return;
            }

            #endregion

            #region 將資料寫入變數

            Dt.TableName = "VDS_STM_PROMOTE_MST";
            Dt_Store.TableName = "VDS_STM_PROMOTE_STORE";
            Dt_Item.TableName = "VDS_STM_PROMOTE_DTL";

            ds_Data.Tables.Add(Dt.Copy());
            ds_Data.Tables.Add(Dt_Store.Copy());
            ds_Data.Tables.Add(Dt_Item.Copy());

            //門市
            DataSet ds_store = new DataSet();
            ds_store.Tables.Add(Dt_Store.Copy());
            DataColumn[] keys_store = new DataColumn[2];
            keys_store[0] = ds_store.Tables[0].Columns["GROUP_NO"];
            keys_store[1] = ds_store.Tables[0].Columns["STORE"];

            ds_store.Tables[0].PrimaryKey = keys_store;
            Session["STM272_Store" + PageTimeStamp.Value] = ds_store;

            //商品
            DataSet ds = new DataSet();
            ds.Tables.Add(Dt_Item.Copy());
            DataColumn[] keys = new DataColumn[4];
            keys[0] = ds.Tables[0].Columns["PROMOTE_CODE"];
            keys[1] = ds.Tables[0].Columns["STORE"];
            keys[2] = ds.Tables[0].Columns["ITEM"];
            keys[3] = ds.Tables[0].Columns["PERIOD"];

            ds.Tables[0].PrimaryKey = keys;
            Session["STM272_" + PageTimeStamp.Value] = ds;

            #endregion

        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0];  //直接取第一個
        }
        finally { }
    }
Example #5
0
    protected void btnConfirm_Click(object sender, EventArgs e)
    {
        try
        {

            if (SLP_ACCEPT_DATE_START.Text.Trim() == string.Empty)
            {
                throw new Exception("進貨開始日未設定 !! ");
            }
            if (SLP_ACCEPT_FIRST_DATE.Text.Trim() == string.Empty)
            {
                throw new Exception("首次出貨日未設定 !! ");
            }

            DataSet ds_store = (DataSet)Session["STM272_store" + PageTimeStamp.Value];

            DataRow[] drstore = (DataRow[])ds_store.Tables[0].Select("STORE='" + SLP_STORE.Text + "'");

            if (drstore.Length > 0)
            {
                throw new Exception("門市代號不能重複 ");
            }

            if (this.SLP_PRICE_SUBSIDY_PERCENT2.Text.Length > 0)
            {
                if (Convert.ToDecimal(this.SLP_PRICE_SUBSIDY_PERCENT2.Text.Trim()) > 100 || Convert.ToDecimal(this.SLP_PRICE_SUBSIDY_PERCENT2.Text.Trim()) < 0)
                {
                    throw new Exception("[門市補貼%]欄位請輸入100>門市補貼>0值<br/>");
                }
                else
                {
                    String[] strPRICE_SUBSIDY_PERCENT2 = SLP_PRICE_SUBSIDY_PERCENT2.Text.Trim().Split('.');
                    if (strPRICE_SUBSIDY_PERCENT2.Length == 2)
                    {
                        if (Convert.ToDecimal(strPRICE_SUBSIDY_PERCENT2[1]) > 99)
                        {
                            throw new Exception("[門市補貼%]欄位小數只能二位<br/>");
                        }
                    }
                }
            }

            //捉取門市資料
            STMModel.MaintainPromoteExhibition BCO_GetStore = new STMModel.MaintainPromoteExhibition(ConnectionDB);

            DataTable Dt_GetStore;
            ParameterList.Clear();

            ParameterList.Add(SLP_STORE.Text);

            Dt_GetStore = BCO_GetStore.GetGroupStoreInfo(ParameterList);

            if (Dt_GetStore == null || (Dt_GetStore != null && Dt_GetStore.Rows.Count <= 0))
            {
                throw new Exception("店群或門市錯誤,無法新增 !! ");
            }

            DataRow dr = ds_store.Tables[0].NewRow();

            dr["GROUP_NO"] = Dt_GetStore.Rows[0]["GROUP_NO"].ToString();
            dr["GROUP_NAME"] = Dt_GetStore.Rows[0]["GROUP_NAME"].ToString();
            dr["STORE"] = Dt_GetStore.Rows[0]["STORE"].ToString();
            dr["STORE_NAME"] = Dt_GetStore.Rows[0]["STORE_NAME"].ToString();
            dr["AC_UID"] = Dt_GetStore.Rows[0]["AC_UID"].ToString();
            dr["AC_UNAME"] = Dt_GetStore.Rows[0]["AC_UNAME"].ToString();
            dr["PRICE_SUBSIDY_PERCENT"] = SLP_PRICE_SUBSIDY_PERCENT2.Text;
            ds_store.Tables[0].Rows.Add(dr);

            GridView1.DataSource = ds_store;
            string SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value);
            Session[SessionIDName] = ds_store;
            GridView1.DataBind();
            Session["STM272_store" + PageTimeStamp.Value] = ds_store;

            //筆數加1
            int count_store = 0;
            if (txtCount_Store.Value.Length == 0)
            {
                count_store = 1;
            }
            else
            {
                count_store = int.Parse(this.txtCount_Store.Value) + 1;
            }

            txtCount_Store.Value = count_store.ToString();


            //取得商品Table
            DataSet ds_item = new DataSet();
            DataTable Dt_Item = new DataTable();
            ds_item = (DataSet)Session["STM272_" + PageTimeStamp.Value];
            Dt_Item = ds_item.Tables[0];
            int intCNT = Dt_Item.Rows.Count;

            //自動展開商品
            Item_Open(Dt_GetStore.Rows[0]["GROUP_NO"].ToString(), SLP_STORE.Text, SLP_PRICE_SUBSIDY_PERCENT2.Text, Dt_Item);

            //非第一筆門市
            if (intCNT > 0)
            {
                //顯示商品Panel-門市代號
                txtITEM_STORE.Text = dr["STORE"].ToString();
                lblITEM_STORE_NAME.Text = dr["STORE_NAME"].ToString();
                lblITEM_GROUP_NO.Text = dr["GROUP_NO"].ToString();
                lblITEM_COST.Text = SLP_PRICE_SUBSIDY_PERCENT2.Text;

                //UPDATE折扣價格
                Price_Into(SLP_STORE.Text, Dt_Item);
            }

            btnStoreCancel_Click(sender, e);

        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0];  //直接取第一個
        }
        finally
        {

            ScriptManager.RegisterStartupScript(
             this.UpdatePanelLineItem,
              typeof(UpdatePanel),
              "UpdatePanel",
              "window.setTimeout(function set_focus(){bConfirmState = true ;},1);", true);
        }

    }
Example #6
0
    protected void btnNOPASS_Click(object sender, EventArgs e)
    {

        #region 檢查判斷
        //首次出貨日<=系統日就不可 審核解除.
        if (DateTime.Parse(this.hdfACCEPT_FIRST_DATE.Value) <= DateTime.Today)
        {
            ErrorMsgLabel.Text = "首次出貨日(" + this.hdfACCEPT_FIRST_DATE.Value + ")小於等於生活日,不可解除審核";
            return;
        }

        //20110712 正平註解掉
        //if (DateTime.Parse(this.SLP_RETURN_DATE_END.Text) >= DateTime.Today)
        //{
        //    ErrorMsgLabel.Text = "您無法解除進行中的檔期活動,如要修改此筆資料請結束此檔期活動迄日,在重新建立一筆新檔期活動 !!";
        //    return;
        //}
        #endregion

        DateTime processtime = DateTime.Now;

        STMModel.MaintainPromoteExhibition STM = new STMModel.MaintainPromoteExhibition(ConntionDB);

        ParameterList.Clear();
        ParameterList.Add(txtPROMOTE_ID.Text.Trim());//V_OLD_PROMOTE_ID
        ParameterList.Add(GetValueSetParameter(Session["UID"].ToString(), "string", false));     //V_NEW_UPDATEUID 
        ParameterList.Add(processtime);             //D_NEW_UPDATEDATE     

        STM.RevokePromoteExhibition(ParameterList);

        QueryData(txtPROMOTE_ID.Text.Trim());
        ScriptManager.RegisterStartupScript(UpdatePanel11, this.GetType(), "ClientScript", "alert('審核解除成功');", true);

    }
Example #7
0
    protected void btnPASS_Click(object sender, EventArgs e)
    {
        DateTime processtime = DateTime.Now;

        STMModel.MaintainPromoteExhibition STM = new STMModel.MaintainPromoteExhibition(ConntionDB);

        ParameterList.Clear();
        ParameterList.Add(txtPROMOTE_ID.Text.Trim());//V_OLD_PROMOTE_ID
        ParameterList.Add(GetValueSetParameter(Session["UID"].ToString(), "string", false));     //V_NEW_UPDATEUID 
        ParameterList.Add(processtime);             //D_NEW_UPDATEDATE     

        STM.CheckPromoteExhibition(ParameterList);

        QueryData(txtPROMOTE_ID.Text.Trim());
        ScriptManager.RegisterStartupScript(UpdatePanel11, this.GetType(), "ClientScript", "alert('審核成功');", true);

    }
Example #8
0
    private void Price_Into(String Store, DataTable Dt_Item)
    {
        try
        {
            STMModel.MaintainPromoteExhibition STM = new STMModel.MaintainPromoteExhibition(ConntionDB);

            #region 建立折扣價格Table
            DataTable dt_Price = new DataTable();
            #endregion

            #region DB清除暫存工作資訊
            ParameterList.Clear();
            ParameterList.Add(Session["UID"].ToString() + PageTimeStamp.Value);
            STM.CLEARPRICEINFOLIST(ParameterList);
            #endregion

            #region 將商品資料寫入DB暫存Table
            foreach (DataRow dr1 in Dt_Item.Rows)
            {
                if (dr1.RowState != DataRowState.Deleted)
                {
                    ParameterList.Clear();
                    ParameterList.Add(Session["UID"].ToString() + PageTimeStamp.Value);
                    ParameterList.Add(dr1["STORE"].ToString());
                    ParameterList.Add(dr1["ITEM"].ToString());
                    ParameterList.Add(dr1["PERIOD"].ToString());
                    ParameterList.Add(SLP_ACCEPT_FIRST_DATE.Text.Replace("/", ""));
                    ParameterList.Add(1);
                    STM.PREPPRICEINFOLIST(ParameterList);
                }
            }
            #endregion

            #region 捉價格資料,寫入折扣價格Table
            ParameterList.Clear();
            ParameterList.Add(Session["UID"].ToString() + PageTimeStamp.Value);
            dt_Price = STM.GETPRICEINFOLIST(ParameterList);
            if (dt_Price == null || (dt_Price != null && dt_Price.Rows.Count <= 0))
            {
                return;
            }
            #endregion

            #region 將折扣價格Table資料,update 至商品Table
            foreach (DataRow dr1 in dt_Price.Rows)
            {
                object[] findPKs = new object[4];
                int iSTMKind = int.Parse(dr1["PRICEDISCOUNTKIND"].ToString());
                findPKs[0] = this.txtPROMOTE_ID.Text;
                findPKs[1] = dr1["STORE"].ToString();
                findPKs[2] = dr1["ITEM"].ToString();
                findPKs[3] = dr1["PERIOD"].ToString();
                DataRow dr = Dt_Item.Rows.Find(findPKs);

                if (dr != null)
                {
                    //  PRICEDISCOUNTKIND
                    dr["COST_DIS_RATE"] = Decimal.Parse(dr1["COSTDISRATE"].ToString()) * 100;
                    dr["LIST_DIS_RATE"] = Decimal.Parse(dr1["T1_LISTDISRATE"].ToString()) * 100;
                    dr["NEW_COST_DIS_RATE"] = (Decimal.Parse(dr1["COSTDISRATE"].ToString()) * 100) - Decimal.Parse(dr["COST_SUBSIDY_PERCENT"].ToString());
                    dr["NEW_LIST_DIS_RATE"] = (Decimal.Parse(dr1["T1_LISTDISRATE"].ToString()) * 100) - Decimal.Parse(dr["PRICE_SUBSIDY_PERCENT"].ToString());
                    #region 將是否有商品折扣,有檔期折扣或是新成本折扣 > 新牌價折扣,如果沒有無法新增
                    if (iSTMKind == 0)
                    {
                        dr.Delete();
                        Dt_Item.AcceptChanges();
                        ErrorMsgLabel.Text = "無基本折扣 !! 無法新增";

                    }
                    else if (iSTMKind >= 64 && GetParameterValue(dr1["MESSAGE"].ToString(), "PROMOTE_CODE") != txtPROMOTE_ID.Text)
                    {
                        dr.Delete();
                        Dt_Item.AcceptChanges();
                        ErrorMsgLabel.Text = "已有檔期折扣,無法重複折扣 !! 無法新增";
                    }
                    else
                    {
                        Decimal rNewDisCost = Decimal.Parse(dr["NEW_COST_DIS_RATE"].ToString());
                        Decimal NEWDisPrice = Decimal.Parse(dr["NEW_LIST_DIS_RATE"].ToString());
                        if (rNewDisCost > NEWDisPrice)
                        {
                            dr.Delete();
                            Dt_Item.AcceptChanges();
                            ErrorMsgLabel.Text = "新成本折扣 > 新牌價折扣,無法新增";
                        }
                    }
                    #endregion
                }
            }
            #endregion

            #region 門市商品GRIDVIEW重新顯示資料
            DataSet ds_item = new DataSet();

            ds_item.Tables.Add(Dt_Item.Copy());

            DataView dv_Item = new DataView(ds_item.Tables[0]);
            dv_Item.RowFilter = "STORE = '" + Store + "' and ITEM <> 'NOITEM'";
            GridView2.DataSource = dv_Item;
            string SessionIDName2 = string.Format("{0}_{1}", PAGE_DT_02, PageTimeStamp.Value);
            Session[SessionIDName2] = dv_Item;
            GridView2.DataBind();
            Session["STM272_" + PageTimeStamp.Value] = ds_item;

            //商品筆數
            this.txtCount_Item.Value = Dt_Item.Rows.Count.ToString();

            #endregion
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0];  //直接取第一個
        }
        finally { }
    }
Example #9
0
    protected void btnEdt_Click(object sender, EventArgs e)
    {
        //檢核必輸入欄位
        TextBox ACCEPT_DATE_START = ((TextBox)((ASP.wui_slp_slp_slpdate_ascx)SLP_ACCEPT_DATE_START).FindControl("TextBoxCode"));
        TextBox ACCEPT_DATE_END = ((TextBox)((ASP.wui_slp_slp_slpdate_ascx)SLP_ACCEPT_DATE_END).FindControl("TextBoxCode"));
        TextBox ACCEPT_FIRST_DATE = ((TextBox)((ASP.wui_slp_slp_slpdate_ascx)SLP_ACCEPT_FIRST_DATE).FindControl("TextBoxCode"));
        TextBox RETURN_DATE_START = ((TextBox)((ASP.wui_slp_slp_slpdate_ascx)SLP_RETURN_DATE_START).FindControl("TextBoxCode"));
        TextBox RETURN_DATE_END = ((TextBox)((ASP.wui_slp_slp_slpdate_ascx)SLP_RETURN_DATE_END).FindControl("TextBoxCode"));
        TextBox txtCOL_DAYS = (TextBox)(SLP_COL_DAYS.TextBox_Code);

        TextBox[] FieldIDs ={ txtPROMOTE_NAME, txtPROMOTE_MONTH.TextBoxCode_Object, txtACCT_MONTH.TextBoxCode_Object, ACCEPT_DATE_START, ACCEPT_DATE_END, ACCEPT_FIRST_DATE, RETURN_DATE_START, RETURN_DATE_END, txtCOL_DAYS };
        string[] FieldNames ={ "檔期名稱", "活動月份", "結帳月份", "進貨開始日", "進貨結束日", "首次出貨日", "退貨開始日", "退貨結束日", "收款天數" };
        int i = 0;
        foreach (TextBox FieldName in FieldIDs)
        {
            if (FieldName.Text.Trim().Length == 0)
            {
                ErrorMsgLabel.Text = "必須輸入「" + FieldNames[i] + "」欄位";
                return;
            }
            i++;
        }

        if (Request[SLP_COL_DAYS.TextBox_Name.UniqueID].ToString() == "查無資料")
        {
            ErrorMsgLabel.Text = "查無收款天數資料";
            return;
        }

        if (SLP_NOTES.Text != "" && Request[SLP_NOTES.TextBox_Name.UniqueID].ToString() == "查無資料")
        {
            ErrorMsgLabel.Text = "查無檔期備註資料";
            return;
        }

        //簡化至check_date
        ////進貨開始日須小於進貨結束日
        //if ((SLP_ACCEPT_DATE_START.Text != "") || (SLP_ACCEPT_DATE_END.Text != ""))
        //{
        //    if (DateTime.Parse(SLP_ACCEPT_DATE_START.Text) >= DateTime.Parse(SLP_ACCEPT_DATE_END.Text))
        //    {
        //        ErrorMsgLabel.Text = "進貨開始日須小於進貨結束日 !!";
        //        return;
        //    }
        //}

        //判斷是否已審核
        if (txtCONFIRM_CODE.Text == "已審核")
        {
            ErrorMsgLabel.Text = "已審核資料不可修改,請先審核解除再進行修改 !!";
            return;
        }

        //日期條件檢查
        if (!check_date())
        {
            return;
        }

        DataSet ds1 = (DataSet)Session["STM272_" + PageTimeStamp.Value];
        DataTable dtSTORE = ds1.Tables[0].DefaultView.ToTable(true, "STORE");

        STMModel.MaintainPromoteExhibition STM = new STMModel.MaintainPromoteExhibition(ConnectionDB);

        foreach (DataRow dr in dtSTORE.Rows)
        {
            if (!(STM.CheckDcDate(dr["STORE"].ToString(), ACCEPT_FIRST_DATE.Text)))
            {
                ErrorMsgLabel.Text = "檔期首次進貨日不在門市" + dr["STORE"].ToString() + "適用日期區間中!!";
                return;
            }
        }

        if (this.SLP_PRICE_SUBSIDY_PERCENT.Text.Length > 0)
        {
            if (Convert.ToDecimal(this.SLP_PRICE_SUBSIDY_PERCENT.Text.Trim()) > 100 || Convert.ToDecimal(this.SLP_PRICE_SUBSIDY_PERCENT.Text.Trim()) < 0)
            {
                ErrorMsgLabel.Text = "[門市補貼%]欄位請輸入100>門市補貼>0值<br/>";
                return;
            }
        }

        if (this.SLP_COST_SUBSIDY_PERCENT.Text.Length > 0)
        {
            if (Convert.ToDecimal(this.SLP_COST_SUBSIDY_PERCENT.Text.Trim()) > 100 || Convert.ToDecimal(this.SLP_COST_SUBSIDY_PERCENT.Text.Trim()) < 0)
            {
                ErrorMsgLabel.Text = "[出版社補貼%]欄位請輸入100>出版社補貼>0值<br/>";
                return;
            }
        }

        //儲存作業
        int v_ID = 0;

        #region
        try
        {
            #region 取得畫面元件的值

            DateTime processtime = DateTime.Now;

            #endregion

            #region 檔期活動
            ParameterList.Clear();
            ParameterList.Add(GetValueSetParameter(ds_Data.Tables["VDS_STM_PROMOTE_MST"].Rows[0]["PROMOTE_ID"].ToString(), "string", false));
            ParameterList.Add(GetValueSetParameter(ds_Data.Tables["VDS_STM_PROMOTE_MST"].Rows[0]["CREATEDATE"].ToString(), "datetime", false));
            ParameterList.Add(GetValueSetParameter(ds_Data.Tables["VDS_STM_PROMOTE_MST"].Rows[0]["CREATEUID"].ToString(), "string", false));
            ParameterList.Add(GetValueSetParameter(ds_Data.Tables["VDS_STM_PROMOTE_MST"].Rows[0]["UPDATEDATE"].ToString(), "datetime", false));
            ParameterList.Add(GetValueSetParameter(ds_Data.Tables["VDS_STM_PROMOTE_MST"].Rows[0]["UPDATEUID"].ToString(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.txtPROMOTE_NAME.Text, "string", false)); //V_NEW_PROMOTE_NAME
            ParameterList.Add(GetValueSetParameter(this.txtPROMOTE_MONTH.Text, "string", false)); //V_NEW_PROMOTE_MONTH
            ParameterList.Add(GetValueSetParameter(this.txtACCT_MONTH.Text, "string", false)); //V_NEW_ACCT_MONTH
            ParameterList.Add(GetValueSetParameter(this.SLP_COL_DAYS.Text, "string", false)); //V_NEW_COL_DAYS
            ParameterList.Add(GetValueSetParameter(this.SLP_ACCEPT_DATE_START.Text, "date", false)); //D_NEW_ACCEPT_DATE_START
            ParameterList.Add(GetValueSetParameter(this.SLP_ACCEPT_DATE_END.Text, "date", false)); //D_NEW_ACCEPT_DATE_END
            ParameterList.Add(GetValueSetParameter(this.SLP_ACCEPT_FIRST_DATE.Text, "date", false)); //D_NEW_ACCPET_FIRST_DATE
            ParameterList.Add(GetValueSetParameter(this.SLP_RETURN_DATE_START.Text, "date", false)); //D_NEW_RETURN_DATE_START
            ParameterList.Add(GetValueSetParameter(this.SLP_RETURN_DATE_END.Text, "date", false)); //D_NEW_RETURN_DATE_END
            ParameterList.Add(GetValueSetParameter(this.ddlPROMOTE_TYPE.Text, "int", false)); //N_NEW_PROMOTE_TYPE
            ParameterList.Add(GetValueSetParameter(this.ddlDISCOUNT_TYPE.Text, "string", false)); //V_NEW_DISCOUNT_TYPE
            ParameterList.Add(GetValueSetParameter(this.SLP_NOTES.Text, "string", false)); //N_NEW_NOTES
            ParameterList.Add(GetValueSetParameter(this.SLP_PRICE_SUBSIDY_PERCENT.Text, "Decimal", false)); //N_PRICE_SUBSIDY_PERCENT
            ParameterList.Add(GetValueSetParameter(this.SLP_COST_SUBSIDY_PERCENT.Text, "Decimal", false)); //N_COST_SUBSIDY_PERCENT
            ParameterList.Add(GetValueSetParameter(Session["UID"].ToString(), "string", false)); //V_NEW_AC_UID
            if (this.txtCONFIRM_CODE.Text == "已審核")
                ParameterList.Add(1); //N_CONFIRM_CODE
            else
                ParameterList.Add(0); //N_CONFIRM_CODE
            ParameterList.Add(64); //N_NEW_DISCOUNT_KIND
            ParameterList.Add(processtime);
            ParameterList.Add(GetValueSetParameter(Session["UID"].ToString(), "string", false));

            #endregion

            #region 商品

            DataSet ds = (DataSet)Session["STM272_" + PageTimeStamp.Value];

            #endregion

            STMModel.MaintainPromoteExhibition BCO = new STMModel.MaintainPromoteExhibition(ConnectionDB);

            BCO.UpdateStoreBase(ParameterList, null, ds.Tables[0]);

            QueryData(ds_Data.Tables["VDS_STM_PROMOTE_MST"].Rows[0]["PROMOTE_ID"].ToString());

            ScriptManager.RegisterStartupScript(UpdatePanel11, this.GetType(), "ClientScript", "alert('更新完成');", true);
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0];  //直接取第一個
        }
        #endregion
    }
Example #10
0
    protected void btnSave_Click(object sender, EventArgs e)
    {
        STMModel.MaintainPromoteExhibition STM = new STMModel.MaintainPromoteExhibition(ConntionDB);

        //檢核必輸入欄位
        TextBox ACCEPT_DATE_START = ((TextBox)((ASP.wui_slp_slp_slpdate_ascx)SLP_ACCEPT_DATE_START).FindControl("TextBoxCode"));
        TextBox ACCEPT_DATE_END = ((TextBox)((ASP.wui_slp_slp_slpdate_ascx)SLP_ACCEPT_DATE_END).FindControl("TextBoxCode"));
        TextBox ACCEPT_FIRST_DATE = ((TextBox)((ASP.wui_slp_slp_slpdate_ascx)SLP_ACCEPT_FIRST_DATE).FindControl("TextBoxCode"));
        TextBox RETURN_DATE_START = ((TextBox)((ASP.wui_slp_slp_slpdate_ascx)SLP_RETURN_DATE_START).FindControl("TextBoxCode"));
        TextBox RETURN_DATE_END = ((TextBox)((ASP.wui_slp_slp_slpdate_ascx)SLP_RETURN_DATE_END).FindControl("TextBoxCode"));

        TextBox txtPROMOTE = (TextBox)(txtPROMOTE_MONTH.TextBoxCode_Object);
        TextBox txtACCT = (TextBox)(txtACCT_MONTH.TextBoxCode_Object);
        TextBox txtCOL_DAYS = (TextBox)(SLP_COL_DAYS.TextBox_Code);
        //   
        //       
        TextBox[] FieldIDs ={ txtPROMOTE_ID, txtPROMOTE_NAME, txtPROMOTE_MONTH.TextBoxCode_Object, txtACCT_MONTH.TextBoxCode_Object, ACCEPT_DATE_START, ACCEPT_DATE_END, ACCEPT_FIRST_DATE, RETURN_DATE_START, RETURN_DATE_END, txtCOL_DAYS };
        string[] FieldNames ={ "檔期編號", "檔期名稱", "活動月份", "結帳月份", "進貨開始日", "進貨結束日", "首次出貨日", "退貨開始日", "退貨結束日", "收款天數" };
        int i = 0;
        foreach (TextBox FieldName in FieldIDs)
        {
            if (FieldName.Text.Trim().Length == 0)
            {
                ErrorMsgLabel.Text = "必須輸入「" + FieldNames[i] + "」欄位";
                return;
            }
            i++;
        }

        if (Request[SLP_COL_DAYS.TextBox_Name.UniqueID].ToString() == "查無資料")
        {
            ErrorMsgLabel.Text = "查無收款天數資料";
            return;
        }

        if (SLP_NOTES.Text != "" && Request[SLP_NOTES.TextBox_Name.UniqueID].ToString() == "查無資料")
        {
            ErrorMsgLabel.Text = "查無檔期備註資料";
            return;
        }

        //簡化至check_date
        ////進貨開始日須小於進貨結束日
        //if ((SLP_ACCEPT_DATE_START.Text != "") || (SLP_ACCEPT_DATE_END.Text != ""))
        //{
        //    if (DateTime.Parse(SLP_ACCEPT_DATE_START.Text) >= DateTime.Parse(SLP_ACCEPT_DATE_END.Text))
        //    {
        //        ErrorMsgLabel.Text = "進貨開始日須小於進貨結束日 !!";
        //        return;
        //    }
        //}

        //日期條件檢查
        if (!check_date())
        {
            return;
        }

        DataSet ds1 = (DataSet)Session["STM272_" + PageTimeStamp.Value];
        DataTable dtSTORE = ds1.Tables[0].DefaultView.ToTable(true, "STORE");

        foreach (DataRow dr in dtSTORE.Rows)
        {
            DataRow[] drNoItem = (DataRow[])ds1.Tables[0].Select("STORE='" + dr["STORE"].ToString() + "' AND (ITEM='NOITEM' OR ITEM IS NULL)");

            if (drNoItem.Length > 0)
            {
                ErrorMsgLabel.Text = "尚有門市未新增商品資料 !!";
                return;
            }

            if (!(STM.CheckDcDate(dr["STORE"].ToString(), ACCEPT_FIRST_DATE.Text)))
            {
                ErrorMsgLabel.Text = "檔期首次進貨日不在門市" + dr["STORE"].ToString()+"適用日期區間中!!";
                return;
            }
        }

        if (this.SLP_PRICE_SUBSIDY_PERCENT.Text.Length > 0)
        {
            if (Convert.ToDecimal(this.SLP_PRICE_SUBSIDY_PERCENT.Text.Trim()) > 100 || Convert.ToDecimal(this.SLP_PRICE_SUBSIDY_PERCENT.Text.Trim()) < 0)
            {
                ErrorMsgLabel.Text = "[門市補貼%]欄位請輸入100>門市補貼>0值<br/>";
                return;
            }
        }

        if (this.SLP_COST_SUBSIDY_PERCENT.Text.Length > 0)
        {
            if (Convert.ToDecimal(this.SLP_COST_SUBSIDY_PERCENT.Text.Trim()) > 100 || Convert.ToDecimal(this.SLP_COST_SUBSIDY_PERCENT.Text.Trim()) < 0)
            {
                ErrorMsgLabel.Text = "[出版社補貼%]欄位請輸入100>出版社補貼>0值<br/>";
                return;
            }
        }

        STMModel.VDS_STM37_BCO bco37 = new STMModel.VDS_STM37_BCO(ConnectionDB);

        string ProID = txtPROMOTE_ID.Text;
        int N_CNT_M;
        int N_CNT_N;

        DataTable dt_s = bco37.QueryPromoteS(ProID, out N_CNT_M, out N_CNT_N);

        if (N_CNT_M > 0)
        {
            this.ErrorMsgLabel.Text = "與特殊書展編號重複";
            return;
        }
 

        //儲存作業
        string v_ID = "";

        #region
        try
        {
            #region 取得畫面元件的值

            DateTime processtime = DateTime.Now;

            #endregion

            #region 檔期活動
            ParameterList.Clear();
            ParameterList.Add(GetValueSetParameter(this.txtPROMOTE_NAME.Text, "string", false)); //V_PROMOTE_NAME
            ParameterList.Add(GetValueSetParameter(this.txtPROMOTE_MONTH.Text, "string", false)); //V_PROMOTE_MONTH
            ParameterList.Add(GetValueSetParameter(this.txtACCT_MONTH.Text, "string", false)); //V_ACCT_MONTH
            ParameterList.Add(GetValueSetParameter(this.SLP_COL_DAYS.Text, "string", false)); //V_COL_DAYS
            ParameterList.Add(GetValueSetParameter(this.SLP_ACCEPT_DATE_START.Text, "date", false)); //D_ACCEPT_DATE_START
            ParameterList.Add(GetValueSetParameter(this.SLP_ACCEPT_DATE_END.Text, "date", false)); //D_ACCEPT_DATE_END
            ParameterList.Add(GetValueSetParameter(this.SLP_ACCEPT_FIRST_DATE.Text, "date", false)); //D_ACCPET_FIRST_DATE
            ParameterList.Add(GetValueSetParameter(this.SLP_RETURN_DATE_START.Text, "date", false)); //D_RETURN_DATE_START
            ParameterList.Add(GetValueSetParameter(this.SLP_RETURN_DATE_END.Text, "date", false)); //D_RETURN_DATE_END
            ParameterList.Add(GetValueSetParameter(this.ddlPROMOTE_TYPE.SelectedValue.ToString(), "int", false)); //N_PROMOTE_TYPE
            ParameterList.Add(GetValueSetParameter(this.ddlDISCOUNT_TYPE.SelectedValue.ToString(), "string", false)); //V_DISCOUNT_TYPE
            ParameterList.Add(GetValueSetParameter(this.SLP_NOTES.Text, "string", false)); //N_NOTES
            ParameterList.Add(GetValueSetParameter(this.SLP_PRICE_SUBSIDY_PERCENT.Text, "Decimal", false)); //N_PRICE_SUBSIDY_PERCENT
            ParameterList.Add(GetValueSetParameter(this.SLP_COST_SUBSIDY_PERCENT.Text, "Decimal", false)); //N_COST_SUBSIDY_PERCENT
            ParameterList.Add(GetValueSetParameter(Session["UID"].ToString(), "string", false)); //V_AC_UID
            if (this.txtCONFIRM_CODE.Text == "已審核")
                ParameterList.Add(1); //N_CONFIRM_CODE
            else
                ParameterList.Add(0); //N_CONFIRM_CODE
            ParameterList.Add(64); //N_DISCOUNT_KIND固定
            ParameterList.Add(processtime);
            ParameterList.Add(GetValueSetParameter(Session["UID"].ToString(), "string", false));
            ParameterList.Add(processtime);
            ParameterList.Add(GetValueSetParameter(Session["UID"].ToString(), "string", false));
            ParameterList.Add(GetValueSetParameter(this.txtPROMOTE_ID.Text, "string", false));
            #endregion

            #region 商品

            DataSet ds = (DataSet)Session["STM272_" + PageTimeStamp.Value];

            #endregion

            STMModel.MaintainPromoteExhibition BCO = new STMModel.MaintainPromoteExhibition(ConnectionDB);

            v_ID = BCO.CreateStoreBase(ParameterList, null, ds.Tables[0]);

            if ((v_ID == "") || (v_ID == null))
            {
                throw new Exception("新增0筆資料!");
            }
            else
            {
                QueryData(v_ID);
                txtPROMOTE_ID.ReadOnly = true;
                txtPROMOTE_ID.CssClass = "readtxtbox";
                btnSave.Visible = false;      //確定新增
                btnAddCancle.Visible = false; //取消(回查詢頁)
                btnEdt.Visible = CanUpdate;        //確定更新 
                btnUpdateCancel.Visible = true;     //取消
                btnAdd.Visible = CanUpdate;     //新增門市
                btnAddItem.Visible = CanUpdate;     //新增商品
                btnUpdateItem.Visible = false;
                GridView1.Columns[4].Visible = CanDelete;   //商品 GRID "刪除"欄位
                GridView2.Columns[8].Visible = CanDelete;  //門市 GRID "刪除"欄位
                GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Save, true, string.Empty, this.btnEdt, WUI_GMToolbarV.ClickAction.ButtonClick);
                ScriptManager.RegisterStartupScript(UpdatePanel11, this.GetType(), "ClientScript", "alert('新增完成');", true);
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message.Split(Environment.NewLine.Replace(Environment.NewLine, "~").ToCharArray())[0];  //直接取第一個
        }
        #endregion
    }