Example #1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        #region
        ErrorMsgLabel.Text = "";
        RightMsgLabel.Text = "";

        if (!IsPostBack)
        {
            if (Request.QueryString["PageTimeStamp"] != null)
                PageTimeStamp.Value = Request.QueryString["PageTimeStamp"];
            else
                PageTimeStamp.Value = string.Format("{0}{1}{2}{3}{4}{5}",
                                                DateTime.Now.Year.ToString(),
                                                DateTime.Now.Month.ToString().PadLeft(2, '0'),
                                                DateTime.Now.Day.ToString().PadLeft(2, '0'),
                                                DateTime.Now.Hour.ToString().PadLeft(2, '0'),
                                                DateTime.Now.Minute.ToString().PadLeft(2, '0'),
                                                DateTime.Now.Second.ToString().PadLeft(2, '0')
                                                );


            #region 取傳入參數
            //string s_DIS_NO, s_ITEM, s_PERIOD;
            try
            {
                s_DIS_NO = Request.QueryString["DIS_NO"];
            }
            catch
            {
                s_DIS_NO = null;
            }
            txt_DIS_NO_OLD.Text = s_DIS_NO;
            try
            {
                s_ITEM = Request.QueryString["ITEM"];
            }
            catch
            {
                s_ITEM = null;
            }
            try
            {
                s_PERIOD = Request.QueryString["PERIOD"];
            }
            catch
            {
                s_PERIOD = null;
            }

            if (s_DIS_NO == null || s_ITEM == null || s_PERIOD == null)
            {
                this.ErrorMsgLabel.Text = "傳入參數有誤,無法執行複製!請回前頁重新執行";
                return;
            }
            #endregion

            #region 設定Tabe index
            rb_ChanType.TabIndex = 1;
            SLP_StoreChain1.TextBox_Code.TabIndex = 2;
            rb_OrderType.TabIndex = 3;
            SLP_FrontCnt.TextBox_Code.TabIndex = 4;
            SLP_AdjustQty.TextBox_Code.TabIndex = 5;
            txt_AdjustSumQty.TabIndex = 6;
            btnExecute.TabIndex = 3;
            btnBack.TabIndex = 4;

            #endregion

            #region 取得可調整之有效配本門市數

            ArrayList ParameterList = new ArrayList();//20091113

            ParameterList.Clear();
            ParameterList.Add(s_DIS_NO);
            ParameterList.Add(s_ITEM);
            ParameterList.Add(s_PERIOD);

            ALOModel.MaintainDisStore bco_store = new ALOModel.MaintainDisStore(ConnectionDB);
            vNonLokcCnt = bco_store.QueryNonLockStoreCount(ParameterList);
            if (vNonLokcCnt <= 0)
            {
                this.ErrorMsgLabel.Text = "可調整之配本門市數=0, 無法進行升降冪調整, 請回前頁!";
                return;
            }

            #endregion

            this.btnExecute.Enabled = true;
            this.Form.DefaultButton = btnExecute.UniqueID;
        }


        ToolBarInit();

        AuthorityControls(this);
        #endregion
    }
Example #2
0
    protected void Page_Load(object sender, EventArgs e)
    {
        #region
        ErrorMsgLabel.Text = "";
        RightMsgLabel.Text = "";

        if (!IsPostBack)
        {
            #region
            if (Request.QueryString["PageTimeStamp"] != null)
                PageTimeStamp.Value = Request.QueryString["PageTimeStamp"];
            else
                PageTimeStamp.Value = string.Format("{0}{1}{2}{3}{4}{5}",
                                                DateTime.Now.Year.ToString(),
                                                DateTime.Now.Month.ToString().PadLeft(2, '0'),
                                                DateTime.Now.Day.ToString().PadLeft(2, '0'),
                                                DateTime.Now.Hour.ToString().PadLeft(2, '0'),
                                                DateTime.Now.Minute.ToString().PadLeft(2, '0'),
                                                DateTime.Now.Second.ToString().PadLeft(2, '0')
                                                );


            #region 取傳入參數
            //string s_DIS_NO, s_ITEM, s_PERIOD;
            try
            {
                s_DIS_NO = Request.QueryString["DIS_NO"];
            }
            catch
            {
                s_DIS_NO = null;
            }

            try
            {
                s_ITEM = Request.QueryString["ITEM"];
            }
            catch
            {
                s_ITEM = null;
            }
            try
            {
                s_PERIOD = Request.QueryString["PERIOD"];
            }
            catch
            {
                s_PERIOD = null;
            }

            if (s_DIS_NO == null || s_ITEM == null || s_PERIOD == null)
            {
                this.ErrorMsgLabel.Text = "傳入參數(配本序號,品號,期別)有誤,無法執行計算!請回前頁重新執行";
                return;
            }
            s_SESSION_ID = this.PageTimeStamp.Value.ToString() + "_" + Session["UID"].ToString();
            #endregion

            #region 設定TextOnChange

            //TextBox txtChanCode = this.SLP_StoreChain1.TextBox_Code;
            //txtChanCode.TextChanged += new System.EventHandler(txtChanCode_TextChanged);
            //this.SLP_StoreChain1.TextBox_Code.Attributes["onchange"] += "__doPostBack(document.all['" + up_Slp_Chan.ClientID + "'].id,'txtChanCode_OnChange');";
            //txtChanCode.AutoPostBack = true;

            //AsyncPostBackTrigger trigger1 = new AsyncPostBackTrigger();
            //trigger1.EventName = "TextChanged";
            //trigger1.ControlID = SLP_StoreChain1.TextBox_Code.UniqueID;
            //this.up_Slp_Chan.Triggers.Add(trigger1);
            #endregion

            #region 取得可調整之有效配本門市數

            ArrayList ParameterList = new ArrayList();//20091113

            ParameterList.Clear();
            ParameterList.Add(s_DIS_NO);
            ParameterList.Add(s_ITEM);
            ParameterList.Add(s_PERIOD);
            ALOModel.MaintainDisStore bco_store = new ALOModel.MaintainDisStore(ConnectionDB);
            vNonLokcCnt = bco_store.QueryNonLockStoreCount(ParameterList);
            if (vNonLokcCnt <= 0)
            {
                this.ErrorMsgLabel.Text = "可調整之配本門市數=0, 無法進行計算比例, 請回前頁!";
                HasUpdateData = false;
                //return;
            }

            #endregion

            #region 取得待處理資訊

            #region 產生暫存檔資訊
            try
            {
                ALOModel.MaintainDisRecord BCO = new ALOModel.MaintainDisRecord(ConnectionDB);
                ParameterList.Clear();
                ParameterList.Add(s_DIS_NO);
                ParameterList.Add(s_ITEM);
                ParameterList.Add(s_PERIOD);
                ParameterList.Add(Session["UID"].ToString());
                ParameterList.Add(s_SESSION_ID);

                bool bResult = BCO.CreateALO116TMP(ParameterList);

                if (!bResult)
                {
                    throw new Exception("建立暫存檔失敗");
                }

            }
            catch (Exception ex)
            {
                this.ErrorMsgLabel.Text = ex.Message;
                return;
            }

            #endregion

            QueryAllChanData(); //取得通路資料

            QueryAllAreaData(); //取得區域資料

            #endregion

            this.btnExecute.Enabled = true;
            //this.Form.DefaultButton = btnExecute.UniqueID;

            rbtn_Chan.Attributes.Add("onclick", "CheckOPType(this);");
            rbtn_Area.Attributes.Add("onclick", "CheckOPType(this);");

            ScriptManager.RegisterStartupScript(this, this.GetType(), "",
                "LockOrUnLockButtonInGridviewControl(false,'gv_Chan','btn');LockOrUnLockButtonInGridviewControl(true,'gv_Area','btn');", true);

            #endregion
        }
        else
        {
            //if (Request.Form["__EVENTARGUMENT"] == "txtChanCode_OnChange")
            //    txtChanCode_OnChange();
        }

        ToolBarInit();
        #region 頁面狀態設定
        //SetPageControlStatus();
        if (Request.QueryString["APPROVE_DATE"] != null && Request.QueryString["APPROVE_DATE"].ToString().Trim() != "")
        {
            ConfirmData = true;
        }
        #endregion
        AuthorityControls(this);
        #endregion
    }