Exemple #1
0
    /// <summary>
    /// 繫結資料到控制項
    /// </summary>
    /// <param name="vdb"></param>
    private void QueryData()
    {
        #region
        try
        {
            string SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value);

            TRNModel.VDS_TRN14_BCO BCO = new TRNModel.VDS_TRN14_BCO(ConnectionDB);
            DataTable dt = null;
            dt = BCO.QUERY_CAL_MONTH_ROUTE(GetQueryParams());
            Session[SessionIDName] = dt;

            GridView1.DataSource = dt;
            GridView1.PageIndex = 0;
            GridView1.DataBind();

            if (dt == null || dt.Rows.Count <= 0)
            {
                if (CurrentPageMode == PageCurrentMode.Insert)
                {
                    GetTransRouteMain();
                }
                else
                {
                    ErrorMsgLabel.Text = "查無資料";
                }
            }
            else
            {
                if (CurrentPageMode == PageCurrentMode.Insert)
                {
                    CurrentPageMode = PageCurrentMode.Edit;
                }
                else
                {
                    CurrentPageMode = PageCurrentMode.Readonly;
                    SetControlsByCurrentPageMode();
                }
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        #endregion
    }
Exemple #2
0
    }//btn_Query_Click	

    protected void btn_Add_Click(object sender, EventArgs e)
    {
        #region
        try
        {
            if (CurrentPageMode == PageCurrentMode.Readonly)
            {
                Response.Redirect("TRN141.aspx?Code=TRN14");
            }
            else
            {
                CurrentPageMode = PageCurrentMode.Insert;
                //QueryData();//如果資料庫裡已有資料則進入編輯模式
                GetTransRouteMain();
                SetControlsByCurrentPageMode();
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        #endregion
    }//btn_Add_Click
Exemple #3
0
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        #region
        try
        {
            #region
            if (SLP_StoreChain1.Text != "" && SLP_Store1.Text != "")
            {
                MKTModel.VDS_MKT21_BCO BCO = new MKTModel.VDS_MKT21_BCO(ConnectionDB);
                string strID = "", strErrMsg = "";
                bool bResult = false;
                bResult = BCO.ADD_UN_TAG_STORE(GetQueryParams(), null, out strID, out strErrMsg);

                if (bResult && strErrMsg == "")
                {
                    ArrayList aryTmp = new ArrayList();
                    aryTmp.Clear();
                    aryTmp.Add(strID);
                    aryParamsPKey = aryTmp;

                    CurrentPageMode = PageCurrentMode.Readonly;
                    SetControlsByCurrentPageMode();

                    ErrorMsgLabel.Text = "新增成功";

                    //string strJS = string.Format("alert('新增成功');location.replace('MKT212.aspx?Code=MKT21&Mode=Readonly&ID={0}&PageTimeStamp={1}');", strID, PageTimeStamp.Value);
                    //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "ADD_OK", strJS, true);
                }
                else
                {
                    ErrorMsgLabel.Text = strErrMsg;
                }
            }
            else
            {
                ErrorMsgLabel.Text = "請輸入通路、門市";
            }
            #endregion
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
            UpdatePanel1.Update();
        }
        #endregion
    }//btn_Save_Click
Exemple #4
0
    protected void Page_Load(object sender, EventArgs e)
    {
        #region

        ErrorMsgLabel.Text = "";

        strReason = SLP_CodeFile1.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')
                                );



            if (Request.QueryString["ChanNo"] != null && Request.QueryString["Store"] != null)
            {
                SLP_StoreChain1.Text = Request.QueryString["ChanNo"].Trim();
                SLP_Store1.Text = Request.QueryString["Store"].Trim();
            }

            CurrentPageMode = PageCurrentMode.Insert;

            //for POP_ClassAndItemSelector
            dtClassAndItemSelected = null;
            btn_PatternSelect.OnClientClick = "checkMultiAddInput();if(Page_IsValid==false){return false;}POP_ClassAndItemSelector();";

            //UI setting ----------------------------------------------------
            SLP_StoreChain1.ReadOnly = true;
            SLP_Store1.ReadOnly = true;

            SLP_SLPDate2.Text = DateTime.Now.ToString("yyyy/MM/dd");
            SLP_Number1.Text = "0";
            SLP_Number1.ReadOnly = true;
            DropDownList ddl = (DropDownList)SLP_CodeFile1.FindControl("D1");
            ddl.Enabled = true;
            ddl.SelectedIndex = -1;
            SetRadioButtonClear();

            #region OLD
            //rBtn_SpecType3.Checked = true;
            //SwitchDetailSetting(rBtn_SpecType3.Text);
            #endregion

            //detail
            ((TextBox)SLP_NumberS.FindControl("TextBoxCode")).Attributes["onchange"] += "CompareFromToValues('SLP_NumberS_TextBoxCode','SLP_NumberE_TextBoxCode','本數');if(Page_IsValid==false){return false;}SetTheSameValue('SLP_NumberS_TextBoxCode','SLP_NumberE_TextBoxCode');";
            ((TextBox)SLP_NumberE.FindControl("TextBoxCode")).Attributes["onchange"] += "CompareFromToValues('SLP_NumberS_TextBoxCode','SLP_NumberE_TextBoxCode','本數');";
            btn_AddDetail.Attributes.Add("onclick", "ClearAllMsg();");
            btn_UpdateRecord.Attributes.Add("onclick", "CompareFromToValues('SLP_NumberS_TextBoxCode','SLP_NumberE_TextBoxCode','本數');if(Page_IsValid==false){return false;}");

            //----------------------------------------------------------------

            bDetailEditing = false;

            Panel_Detail.Visible = false;

            ToolBarInit();

            AuthorityControls(this);
            #endregion
        }

        #endregion
    }
Exemple #5
0
    protected void SmartGridView1_RowEditing(object sender, GridViewEditEventArgs e)
    {
        #region
        Label lbl_ID = (Label)SmartGridView1.Rows[e.NewEditIndex].FindControl("lbl_ID");
        Label lbl_item = (Label)SmartGridView1.Rows[e.NewEditIndex].FindControl("lbl_item");
        Label lbl_spec_qty = (Label)SmartGridView1.Rows[e.NewEditIndex].FindControl("lbl_spec_qty");
        Label lbl_reason = (Label)SmartGridView1.Rows[e.NewEditIndex].FindControl("lbl_reason");
        Label lbl_s_start_date = (Label)SmartGridView1.Rows[e.NewEditIndex].FindControl("lbl_s_start_date");
        Label lbl_s_end_date = (Label)SmartGridView1.Rows[e.NewEditIndex].FindControl("lbl_s_end_date");
        Label lbl_spec_type = (Label)SmartGridView1.Rows[e.NewEditIndex].FindControl("lbl_spec_type");
        Label lbl_chan_no = (Label)SmartGridView1.Rows[e.NewEditIndex].FindControl("lbl_chan_no");
        Label lbl_store = (Label)SmartGridView1.Rows[e.NewEditIndex].FindControl("lbl_store");
        #region
        ALOModel.MaintainStoreSpec BCO = new ALOModel.MaintainStoreSpec(ConnectionDB);
        Hashtable ht = new Hashtable();
        ht.Add("PID", lbl_ID.Text);

        DataTable dtDetl = BCO.QueryDetlByPID(ht);

        if (dtDetl != null && dtDetl.Rows.Count > 0)
        {
            dtDetailData = dtDetl;
            gv_Detail.DataSource = dtDetl;
            Panel_Detail.Visible = true;
            btn_AddDetail.Visible = true;
            btn_CopyDetail.Visible = true;
            dtForDetailDeleted.Clear();

        }
        else
        {
            dtDetailData = null;
            Panel_Detail.Visible = false;
        }

        gv_Detail.DataBind();

        SLP_StoreChain2.Text = lbl_chan_no.Text;
        SLP_Store2.Text = lbl_store.Text;
        SLP_SKU3.Text = lbl_item.Text;
        SLP_SLPDate2.Text = lbl_s_start_date.Text;
        SLP_SLPDate3.Text = lbl_s_end_date.Text;
        SLP_Number1.Text = lbl_spec_qty.Text;
        SLP_Number1.ReadOnly = false;

        DropDownList ddl = (DropDownList)SLP_CodeFile1.FindControl("D1");
        ddl.SelectedValue = lbl_reason.Text;

        SetRadioButtonClear();

        switch (lbl_spec_type.Text)
        {
            case "1":
                rBtn_SpecType1.Checked = true;
                btn_Setting.Enabled = true;
                hiddenCurrentSpecType.Value = "1";
                SLP_Number1.ReadOnly = true;
                break;
            case "2":
                rBtn_SpecType2.Checked = true;
                btn_Setting.Enabled = false;
                hiddenCurrentSpecType.Value = "2";
                SLP_Number1.ReadOnly = false;
                break;
            case "3":
                rBtn_SpecType3.Checked = true;
                btn_Setting.Enabled = false;
                hiddenCurrentSpecType.Value = "3";
                SLP_Number1.ReadOnly = true;
                break;
            case "4":
                rBtn_SpecType4.Checked = true;
                btn_Setting.Enabled = false;
                hiddenCurrentSpecType.Value = "4";
                SLP_Number1.ReadOnly = false;
                break;
            case "5":
                rBtn_SpecType5.Checked = true;
                btn_Setting.Enabled = false;
                hiddenCurrentSpecType.Value = "5";
                SLP_Number1.ReadOnly = false;
                break;
            case "6":
                rBtn_SpecType6.Checked = true;
                btn_Setting.Enabled = false;
                hiddenCurrentSpecType.Value = "6";
                SLP_Number1.ReadOnly = false;
                break;
        }

        #endregion

        SetTmpDataForMaster(lbl_ID.Text.Trim());


        LastPageMode = PageCurrentMode.Readonly;
        CurrentPageMode = PageCurrentMode.Edit;





        #endregion
    }
Exemple #6
0
    }//Page_Init

    protected void Page_Load(object sender, EventArgs e)
    {
        #region
        try
        {
            ErrorMsgLabel.Text = "";
            ResultMsgLabel.Text = "";

            if (!IsPostBack)
            {
                if (Request.QueryString["PageTimeStamp"] != null)
                    PageTimeStamp.Value = Request.QueryString["PageTimeStamp"];
                else
                    PageTimeStamp.Value = string.Format("{0}{1}{2}{3}{4}{5}{6}",
                                                        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'),
                                                        DateTime.Now.Millisecond.ToString().PadLeft(4, '0')
                                                        );

                #region

                s_ID = Request.QueryString["ID"];

                if (Session[string.Format("{0}_{1}", strPreFixed, PageTimeStamp.Value)] != null)
                {
                    aryParamsPKey = (ArrayList)Session[string.Format("{0}_{1}", strPreFixed, PageTimeStamp.Value)];
                }

                if (s_ID != "" && Request.QueryString["Mode"] == PageCurrentMode.Readonly.ToString())
                {
                    QueryData();
                }
                else if (s_ID == "" && Request.QueryString["Mode"] == PageCurrentMode.Readonly.ToString())
                {
                    ErrorMsgLabel.Text = "請先至MKT211查詢";
                }

                if (Request.QueryString["Mode"] != null && Request.QueryString["Mode"] == PageCurrentMode.Readonly.ToString())
                {
                    CurrentPageMode = PageCurrentMode.Readonly;
                }
                else if (Request.QueryString["Mode"] != null && Request.QueryString["Mode"] == PageCurrentMode.Insert.ToString())
                {
                    CurrentPageMode = PageCurrentMode.Insert;
                }

                SetControlsByCurrentPageMode();
                #endregion

            }


            if (CurrentPageMode == PageCurrentMode.Readonly && aryParamsPKey.Count <= 0)
            {
                ErrorMsgLabel.Text = "請先至MKT211查詢";
            }

            SLP_Store1.TextBox_Code.Attributes.Add("onblur", "GetChanByStoreAtClient(this.value.trim());");
            btn_Save.Attributes.Add("onclick", "Check_RequiredField();if(Page_IsValid==false){return false;}");
            btn_Delete.Attributes.Add("onclick", "Check_RequiredField();if(Page_IsValid==false){return false;}ConfirmDeleteOrNot();if(Page_IsValid==false){return false;}");

            #region 設定TabIndex
            SLP_StoreChain1.TextBox_Code.TabIndex = 1;
            SLP_Store1.TextBox_Code.TabIndex = 2;
            btn_Save.TabIndex = 3;
            btn_Delete.TabIndex = 4;
            btn_Cancel.TabIndex = 5;
            #endregion

            ToolBarInit();
            AuthorityControls(this);


        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        finally 
        {
            UpdatePanel1.Update();
        }
        #endregion
    }//page_load
Exemple #7
0
    }//Page_Init

    protected void Page_Load(object sender, EventArgs e)
    {
        #region
        try
        {
            ErrorMsgLabel.Text = "";
            ResultMsgLabel.Text = "";

            if (!IsPostBack)
            {
                if (Request.QueryString["PageTimeStamp"] != null)
                    PageTimeStamp.Value = Request.QueryString["PageTimeStamp"];
                else
                    PageTimeStamp.Value = string.Format("{0}{1}{2}{3}{4}{5}{6}",
                                                        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'),
                                                        DateTime.Now.Millisecond.ToString().PadLeft(4, '0')
                                                        );

                #region

                s_ID = Request.QueryString["ID"];

                if (Session[string.Format("{0}_{1}", strPreFixed, PageTimeStamp.Value)] != null)
                {
                    aryParamsPKey = (ArrayList)Session[string.Format("{0}_{1}", strPreFixed, PageTimeStamp.Value)];
                }

                if (s_ID != "" && Request.QueryString["Mode"] == PageCurrentMode.Readonly.ToString())
                {
                    QueryData();
                }
                else if (s_ID == "" && Request.QueryString["Mode"] == PageCurrentMode.Readonly.ToString())
                {
                    ErrorMsgLabel.Text = "請先至TRN121查詢";
                }

                if (Request.QueryString["Mode"] != null && Request.QueryString["Mode"] == PageCurrentMode.Readonly.ToString())
                {
                    CurrentPageMode = PageCurrentMode.Readonly;
                }
                else if (Request.QueryString["Mode"] != null && Request.QueryString["Mode"] == PageCurrentMode.Insert.ToString())
                {
                    CurrentPageMode = PageCurrentMode.Insert;
                }

                SetControlsByCurrentPageMode();
                #endregion

            }


            if (CurrentPageMode == PageCurrentMode.Readonly && aryParamsPKey.Count <= 0)
            {
                ErrorMsgLabel.Text = "請先至TRN121查詢";
            }

            btn_Save.Attributes.Add("onclick", "Check_RequiredField();if(Page_IsValid==false){return false;}");
            btn_Delete.Attributes.Add("onclick", "Check_RequiredField();if(Page_IsValid==false){return false;}ConfirmDeleteOrNot();if(Page_IsValid==false){return false;}");

            txt_TRANS_NO.Attributes.Add("onkeyup", "value=value.replace(/[\\W]/g,'')");
            txt_TRANS_NO.Attributes.Add("onbeforepaste", "clipboardData.setData('text',clipboardData.getData('text').replace(/[^\\d]/g,''))");
            txt_TRANS_NO.Attributes.Add("onkeydown", "if(event.keyCode==13)event.keyCode=9;");

            txt_TRANS_MEMO.Attributes.Add("onblur", string.Format("CheckInputLength('{0}',100);", txt_TRANS_MEMO.ClientID));

            ddl_TRANS_KIND.Attributes.Add("onchange", "SetSLP_Area();");

            chk_IS_TRANSFER_POST.Attributes.Add("onclick", "CheckTransferPost();");
            SLP_TRANSFER_POST_SORT.TextBox_Code.Attributes["onblur"] += "CheckTransferPostSortIsOccupiedAtClient();";
            #region 設定TabIndex
            txt_TRANS_NO.TabIndex = 1;
            txt_TRANS_MEMO.TabIndex = 2;
            SLP_START_DATE.DateTextBox.TabIndex = 3;
            SLP_END_DATE.DateTextBox.TabIndex = 4;
            SLP_TAX_NO.DropDownListControl.TabIndex = 5;
            ddl_AC_TYPE.TabIndex = 6;
            SLP_AC_START_DATE.DateTextBox.TabIndex = 7;
            SLP_AC_END_DATE.DateTextBox.TabIndex = 8;
            ddl_TRANS_TYPE.TabIndex = 9;
            SLP_TRANS_VENDOR.DropDownListControl.TabIndex = 10;
            ddl_TRANS_KIND.TabIndex = 11;
            SLP_AREA.DropDownListControl.TabIndex = 12;
            chk_IS_TRANSFER_POST.TabIndex = 13;
            SLP_TRANSFER_POST_SORT.TextBox_Code.TabIndex = 14;
            SLP_TRANS_MONEY.TextBox_Code.TabIndex = 15;
            btn_Save.TabIndex = 16;
            btn_Delete.TabIndex = 17;
            btn_Cancel.TabIndex = 18;
            #endregion

            ToolBarInit();
            AuthorityControls(this);


        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        finally
        {
            UpdatePanel1.Update();
        }
        #endregion
    }//page_load
Exemple #8
0
    }//btn_Cancel_Click

    protected void btn_Edit_Click(object sender, EventArgs e)
    {
        #region
        try
        {
            if (CurrentPageMode == PageCurrentMode.Readonly)
            {
                CurrentPageMode = PageCurrentMode.Edit;

                string SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value);
                GridView1.DataSource = (DataTable)Session[SessionIDName];
                GridView1.DataBind();
                SetControlsByCurrentPageMode();
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        #endregion
    }//btn_Edit_Click
Exemple #9
0
    }//Page_Init

    protected void Page_Load(object sender, EventArgs e)
    {
        #region
        try
        {
            ErrorMsgLabel.Text = "";
            ResultMsgLabel.Text = "";

            if (!IsPostBack)
            {
                if (Request.QueryString["PageTimeStamp"] != null)
                    PageTimeStamp.Value = Request.QueryString["PageTimeStamp"];
                else
                    PageTimeStamp.Value = string.Format("{0}{1}{2}{3}{4}{5}{6}",
                                                        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'),
                                                        DateTime.Now.Millisecond.ToString().PadLeft(4, '0')
                                                        );

                #region

                s_ID = Request.QueryString["ID"];

                if (Session[string.Format("{0}_{1}", strPreFixed, PageTimeStamp.Value)] != null)
                {
                    aryParamsPKey = (ArrayList)Session[string.Format("{0}_{1}", strPreFixed, PageTimeStamp.Value)];
                }

                if (s_ID != "" && Request.QueryString["Mode"] == PageCurrentMode.Readonly.ToString())
                {
                    QueryData();
                }
                else if (s_ID == "" && Request.QueryString["Mode"] == PageCurrentMode.Readonly.ToString())
                {
                    ErrorMsgLabel.Text = "請先至TRN101查詢";
                }

                if (Request.QueryString["Mode"] != null && Request.QueryString["Mode"] == PageCurrentMode.Readonly.ToString())
                {
                    CurrentPageMode = PageCurrentMode.Readonly;
                }
                else if (Request.QueryString["Mode"] != null && Request.QueryString["Mode"] == PageCurrentMode.Insert.ToString())
                {
                    CurrentPageMode = PageCurrentMode.Insert;
                }

                SetControlsByCurrentPageMode();
                #endregion

            }


            if (CurrentPageMode == PageCurrentMode.Readonly && aryParamsPKey.Count <= 0)
            {
                ErrorMsgLabel.Text = "請先至TRN101查詢";
            }

            btn_Save.Attributes.Add("onclick", "Check_RequiredField();if(Page_IsValid==false){return false;}");
            btn_Delete.Attributes.Add("onclick", "Check_RequiredField();if(Page_IsValid==false){return false;}ConfirmDeleteOrNot();if(Page_IsValid==false){return false;}");

            txt_CODE.Attributes.Add("onkeyup", "value=value.replace(/[\\W]/g,'')");
            txt_CODE.Attributes.Add("onbeforepaste", "clipboardData.setData('text',clipboardData.getData('text').replace(/[^\\d]/g,''))");
            txt_CODE.Attributes.Add("onkeydown", "if(event.keyCode==13)event.keyCode=9;");

            txt_NAME.Attributes.Add("onblur", string.Format("CheckInputLength('{0}',30);", txt_NAME.ClientID));
            txt_EXPLAIN.Attributes.Add("onblur", string.Format("CheckInputLength('{0}',50);", txt_EXPLAIN.ClientID));

            #region 設定TabIndex
            txt_CODE.TabIndex = 1;
            txt_NAME.TabIndex = 2;
            txt_EXPLAIN.TabIndex = 3;
            btn_Save.TabIndex = 4;
            btn_Delete.TabIndex = 5;
            btn_Cancel.TabIndex = 6;
            #endregion

            ToolBarInit();
            AuthorityControls(this);


        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        finally 
        {
            UpdatePanel1.Update();
        }
        #endregion
    }//page_load
Exemple #10
0
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        #region
        try
        {
            #region
            if (txt_CODE.Text != "")
            {
                if (CurrentPageMode == PageCurrentMode.Insert)
                {
                    #region
                    TRNModel.VDS_TRN10_BCO BCO = new TRNModel.VDS_TRN10_BCO(ConnectionDB);
                    string strID = "", strErrMsg = "";
                    bool bResult = false;
                    bResult = BCO.ADD_TRN_CODE_MAIN(GetQueryParams(), null, out strID, out strErrMsg);

                    if (bResult && strErrMsg == "")
                    {
                        ArrayList aryTmp = new ArrayList();
                        aryTmp.Clear();
                        aryTmp.Add(strID);
                        aryParamsPKey = aryTmp;
                        s_ID = strID;

                        CurrentPageMode = PageCurrentMode.Readonly;
                        SetControlsByCurrentPageMode();

                        ErrorMsgLabel.Text = "新增成功";

                    }
                    else
                    {
                        ErrorMsgLabel.Text = strErrMsg;
                    }
                    #endregion
                }
                else if (CurrentPageMode == PageCurrentMode.Edit)
                {
                    #region
                    TRNModel.VDS_TRN10_BCO BCO = new TRNModel.VDS_TRN10_BCO(ConnectionDB);
                    string strID = "", strErrMsg = "";
                    bool bResult = false;
                    bResult = BCO.UPDATE_TRN_CODE_MAIN(GetQueryParams(), null, out strErrMsg);

                    if (bResult && strErrMsg == "")
                    {
                        CurrentPageMode = PageCurrentMode.Readonly;
                        SetControlsByCurrentPageMode();
                        ErrorMsgLabel.Text = "更新成功";
                    }
                    else
                    {
                        ErrorMsgLabel.Text = strErrMsg;
                    }
                    #endregion
                }
            }
            else
            {
                ErrorMsgLabel.Text = "請輸入代碼";
            }
            #endregion
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
            UpdatePanel1.Update();
        }
        #endregion
    }//btn_Save_Click
Exemple #11
0
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        #region
        try
        {
            #region
            if (SLP_RootNo1.Text != "" && SLP_PMA1.Text != "")
            {

                #region 存檔前檢查分類正確性
                ArrayList ParameterList = new ArrayList();
                ParameterList.Clear();
                ParameterList.Add(SLP_RootNo1.Text.Trim());
                ParameterList.Add(SLP_PMA1.Text.Trim());
                ParameterList.Add(null);//category
                ParameterList.Add(null);//sort_out
                ParameterList.Add(null);//pattern
                ParameterList.Add(null);//item
                string vLevel = "1";
                ParameterList.Add(vLevel);

                ALOModel.QueryALOCommon alo_comm = new ALOModel.QueryALOCommon(ConnectionDB);
                bool bCheck = alo_comm.CheckItemClassValid(ParameterList);
                if (!bCheck)
                {
                    throw new Exception("所輸入的群分類、大分類有誤,請確認後重新輸入");
                }
                #endregion

                #region
                MKTModel.VDS_MKT22_BCO BCO = new MKTModel.VDS_MKT22_BCO(ConnectionDB);
                string strID = "", strErrMsg = "";
                bool bResult = false;
                bResult = BCO.ADD_UN_TAG_PMA(GetQueryParams(), null, out strID, out strErrMsg);

                if (bResult && strErrMsg == "")
                {
                    ArrayList aryTmp = new ArrayList();
                    aryTmp.Clear();
                    aryTmp.Add(strID);
                    aryParamsPKey = aryTmp;

                    CurrentPageMode = PageCurrentMode.Readonly;
                    SetControlsByCurrentPageMode();

                    ErrorMsgLabel.Text = "新增成功";

                }
                else
                {
                    ErrorMsgLabel.Text = strErrMsg;
                }
                #endregion
            }
            else
            {
                ErrorMsgLabel.Text = "請輸入通路、門市";
            }
            #endregion
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
            UpdatePanel1.Update();
        }
        #endregion
    }//btn_Save_Click
Exemple #12
0
    /// <summary>
    /// 繫結資料到控制項
    /// </summary>
    /// <param name="vdb"></param>
    private void QueryData()
    {
        #region
        LabelQueryRecordCount.Text = "";

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

        ALOModel.MaintainStoreSpec BCO = new ALOModel.MaintainStoreSpec(ConnectionDB);

        //2010/04/15 modified: for performance  DataTable Dt = BCO.QueryStorSpecByFind(GetInputValues());
        DataTable Dt = BCO.QueryStorSpecByFind2(GetInputValues());

        Session[SessionIDName] = Dt;
        
        SmartGridView1.DataSource = Dt;

        SmartGridView1.PageSize = (TextBoxPagesize.Text == "") ? 10 : (int.Parse(TextBoxPagesize.Text) <= 0) ? 10 : int.Parse(TextBoxPagesize.Text);

        if (!(CurrentPageMode == PageCurrentMode.Query || CurrentPageMode == PageCurrentMode.Readonly))
        {
            SmartGridView1.PageIndex = GetPageIndexByParam(SLP_SKU3.Text.Trim());
        }
        else 
        {
            SmartGridView1.PageIndex = 0;
        }

        SmartGridView1.DataBind();

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

        if (Dt == null || (Dt != null && Dt.Rows.Count <= 0))
        {
            if (btn_Export.Visible == true)
            {
                btn_Export.Enabled = false;
            }

            //ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "ClientScript", "alert('查無資料');", true);
            ResultMsgLabel.Text = "查無資料";
            CurrentPageMode = PageCurrentMode.Query;
        }
        else
        {

            if (btn_Export.Visible == true)
            {
                btn_Export.Enabled = true;
            }

            LastPageMode = PageCurrentMode.Query;
            CurrentPageMode = PageCurrentMode.Readonly;
        }

        btn_EditComment.Enabled = true;

        #endregion
    }
Exemple #13
0
    protected void Page_Load(object sender, EventArgs e)
    {
        #region
        try
        {
            ErrorMsgLabel.Text = "";
            ResultMsgLabel.Text = "";

            strReason = SLP_CodeFile1.Text;
            strRemark = txt_Comment.Text.Trim();

            if (!IsPostBack)
            {
                this.SmartGridView1.PageSize = 5;//20091113

                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')
                                                );


                btn_EditComment.Enabled = false;
                //PanelMasterAndDetail.Visible = false;
                Panel_Detail.Visible = false;
                Panel_AddDetail.Visible = false;
                bDetailEditing = false;

                #region
                //query
                txt_Comment.Attributes.Add("onblur", string.Format("CheckInputLength('{0}',400);", txt_Comment.ClientID));
                ((TextBox)SLP_SKU1.FindControl("TextBoxCode")).Attributes["onblur"] += "CompareFromToValues('SLP_SKU1_TextBoxCode','SLP_SKU2_TextBoxCode','品號/品名');if(Page_IsValid==false){return false;}SetTheSameValue('SLP_SKU1_TextBoxCode','SLP_SKU2_TextBoxCode');";
                ((TextBox)SLP_SKU2.FindControl("TextBoxCode")).Attributes["onblur"] += "CompareFromToValues('SLP_SKU1_TextBoxCode','SLP_SKU2_TextBoxCode','品號/商品');";
                btn_Check.Attributes.Add("onclick", "showStoreStateDesc();return false;");

                //master
                rBtn_SpecType1.Attributes.Add("onclick", "CheckSpecTypeChange();if(Page_IsValid==false){return false;}");
                rBtn_SpecType2.Attributes.Add("onclick", "CheckSpecTypeChange();if(Page_IsValid==false){return false;}");
                rBtn_SpecType3.Attributes.Add("onclick", "CheckSpecTypeChange();if(Page_IsValid==false){return false;}");
                rBtn_SpecType4.Attributes.Add("onclick", "CheckSpecTypeChange();if(Page_IsValid==false){return false;}");
                rBtn_SpecType5.Attributes.Add("onclick", "CheckSpecTypeChange();if(Page_IsValid==false){return false;}");
                rBtn_SpecType6.Attributes.Add("onclick", "CheckSpecTypeChange();if(Page_IsValid==false){return false;}");
                btn_Save.Attributes.Add("onclick", "CompareNexDayValues('SLP_SLPDate3_TextBoxCode','SLP_SLPDate2_TextBoxCode','開始日不可大於結束日');if(Page_IsValid==false){return false;}");


                //detail
                ((TextBox)SLP_NumberS.FindControl("TextBoxCode")).Attributes["onchange"] += "CompareFromToValues('SLP_NumberS_TextBoxCode','SLP_NumberE_TextBoxCode','本數');if(Page_IsValid==false){return false;}SetTheSameValue('SLP_NumberS_TextBoxCode','SLP_NumberE_TextBoxCode');";
                ((TextBox)SLP_NumberE.FindControl("TextBoxCode")).Attributes["onchange"] += "CompareFromToValues('SLP_NumberS_TextBoxCode','SLP_NumberE_TextBoxCode','本數');";
                btn_AddDetail.Attributes.Add("onclick", "ClearAllMsg();");
                btn_UpdateRecord.Attributes.Add("onclick", "CompareFromToValues('SLP_NumberS_TextBoxCode','SLP_NumberE_TextBoxCode','本數');if(Page_IsValid==false){return false;}");



                #endregion

                ToolBarInit();

                RegTextAttr();

                RegClientScript();

                CurrentPageMode = PageCurrentMode.Query;
                LastPageMode = PageCurrentMode.Query;

                AuthorityControls(this);

                #region 設定TabIndex

                //query
                SLP_StoreChain1.TextBox_Code.TabIndex = 1;
                SLP_Store1.TextBox_Code.TabIndex = 2;
                //btn_Check.TabIndex = 3;
                //txt_Comment.TabIndex = 4;
                //btn_EditComment.TabIndex = 5;
                //btn_SaveComment.TabIndex = 6;
                SLP_SKU1.TextBox_Code.TabIndex = 7;
                SLP_SKU2.TextBox_Code.TabIndex = 8;
                SLP_SLPDate1.DateTextBox.TabIndex = 9;
                SLP_User1.TextBox_Code.TabIndex = 10;
                ((DropDownList)SLP_SpecType.FindControl("D1")).TabIndex = 11;
                btn_Import.TabIndex = 12;
                btn_Copy.TabIndex = 13;
                TextBoxRowCountLimit.TabIndex = 14;
                TextBoxPagesize.TabIndex = 15;
                btn_New.TabIndex = 16;
                btn_Query.TabIndex = 17;
                btn_Export.TabIndex = 17;

                //master
                SLP_StoreChain2.TextBox_Code.TabIndex = 18;
                SLP_Store2.TextBox_Code.TabIndex = 19;
                SLP_SKU3.TextBox_Code.TabIndex = 20;
                SLP_SLPDate2.DateTextBox.TabIndex = 21;
                SLP_SLPDate3.DateTextBox.TabIndex = 22;
                rBtn_SpecType1.TabIndex = 23;
                rBtn_SpecType2.TabIndex = 24;
                rBtn_SpecType3.TabIndex = 25;
                rBtn_SpecType4.TabIndex = 26;
                rBtn_SpecType5.TabIndex = 27;
                rBtn_SpecType6.TabIndex = 28;
                btn_Setting.TabIndex = 29;
                SLP_Number1.TextBox_Code.TabIndex = 30;
                ((DropDownList)SLP_CodeFile1.FindControl("D1")).TabIndex = 31;
                btn_Save.TabIndex = 32;
                btn_Cancel.TabIndex = 33;
                //detail
                btn_AddDetail.TabIndex = 34;
                btn_CopyDetail.TabIndex = 35;
                SLP_NumberS.TextBox_Code.TabIndex = 36;
                SLP_NumberE.TextBox_Code.TabIndex = 37;
                SLP_NumberAdj.TextBox_Code.TabIndex = 38;
                btn_UpdateRecord.TabIndex = 39;
                btn_CancelRecord.TabIndex = 40;
                #endregion

            }

            if (CurrentPageMode == PageCurrentMode.Insert)
            {
                SLP_StoreChain1.Text = SLP_StoreChain2.Text;
                SLP_Store1.Text = SLP_Store2.Text;
            }
            else
            {
                SLP_StoreChain1.Text = SLP_StoreChain1.Text;
                SLP_Store1.Text = SLP_Store1.Text;
            }


            CheckByChanAndStore();
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        #endregion
    }
Exemple #14
0
    }//btn_Add_Click

    protected void btn_Save_Click(object sender, EventArgs e)
    {
        #region
        try
        {
            #region

            if (CheckDetailIsExisted())
            {
                if (CurrentPageMode == PageCurrentMode.Insert || CurrentPageMode == PageCurrentMode.Edit)
                {
                    SaveCurrentGridviewValue();
                }

                //if (CheckDetailIsDuplicated())
                //{
                #region Variables
                string SessionIDName = string.Format("{0}_{1}", PAGE_DT_01, PageTimeStamp.Value);
                DataTable dtTemp = (DataTable)Session[SessionIDName];

                TRNModel.VDS_TRN14_BCO BCO = new TRNModel.VDS_TRN14_BCO(ConnectionDB);
                string strErrMsg = "";
                bool bResult = false;

                //WUI.SLP.SLP_Route SLP_Route1;
                //WUI.SLP.SLPNumber SLP_SLPNumber1;
                //WUI.SLP.SLPNumber SLP_SLPNumber2;
                ArrayList ParameterList = new ArrayList();
                TRNModel.TRNCommon BCOCommon = new TRNModel.TRNCommon();
                System.Data.Common.DbTransaction DBT = BCOCommon.OpenAndGetConnection(ConnectionDB).BeginTransaction();
                #endregion

                if (CurrentPageMode == PageCurrentMode.Insert)
                {
                    #region
                    try
                    {
                        //先把舊資料都刪除
                        ParameterList.Clear();
                        ParameterList = GetQueryParams();
                        ParameterList.Add(DBNull.Value);
                        ParameterList.Add(Session["UID"].ToString());
                        BCO.DEL_CAL_MONTH_ROUTE(ParameterList, DBT);

                        #region 新增
                        for (Int32 i = 0; i <= dtTemp.Rows.Count - 1; i++)
                        {
                            if (dtTemp.Rows[i].RowState != DataRowState.Deleted)
                            {
                                if (strErrMsg == "")
                                {
                                    //SLP_Route1 = (WUI.SLP.SLP_Route)GridView1.Rows[i].FindControl("SLP_Route1");
                                    //SLP_SLPNumber1 = (WUI.SLP.SLPNumber)GridView1.Rows[i].FindControl("SLP_SLPNumber1");
                                    //SLP_SLPNumber2 = (WUI.SLP.SLPNumber)GridView1.Rows[i].FindControl("SLP_SLPNumber2");
                                    ParameterList.Clear();
                                    ParameterList = GetQueryParams();
                                    //ParameterList.Add(SLP_Route1.Text);
                                    //ParameterList.Add(SLP_SLPNumber1.Text);
                                    //ParameterList.Add(SLP_SLPNumber2.Text);
                                    ParameterList.Add(dtTemp.Rows[i]["ROUTE"].ToString());
                                    ParameterList.Add(dtTemp.Rows[i]["ADD_STORE_CNT"].ToString());
                                    ParameterList.Add(dtTemp.Rows[i]["STORE_CNT"].ToString());
                                    ParameterList.Add(Session["UID"].ToString());
                                    bResult = BCO.ADD_CAL_MONTH_ROUTE(ParameterList, DBT, out strErrMsg);
                                }
                                else
                                {
                                    break;
                                    DBT.Rollback();//交易失敗
                                }
                            }
                        }
                        #endregion

                        #region 刪除
                        //DataTable dtDeleted = dtTemp.GetChanges(DataRowState.Deleted); ;

                        //if (dtDeleted != null)
                        //{
                        //    for (Int32 j = 0; j <= dtDeleted.Rows.Count - 1; j++)
                        //    {
                        //        if (bResult)
                        //        {
                        //            ParameterList.Clear();
                        //            ParameterList = GetQueryParams();
                        //            ParameterList.Add(dtDeleted.Rows[j]["ROUTE", DataRowVersion.Original].ToString());
                        //            ParameterList.Add(Session["UID"].ToString());
                        //            BCO.DEL_CAL_MONTH_ROUTE(ParameterList, DBT);
                        //        }
                        //        else
                        //        {
                        //            break;
                        //            DBT.Rollback();//交易失敗
                        //        }
                        //    }
                        //}
                        #endregion

                        DBT.Commit();//交易成功

                    }
                    catch (Exception ex)
                    {
                        DBT.Rollback();//交易失敗
                        throw ex;
                    }


                    if (bResult && strErrMsg == "")
                    {
                        CurrentPageMode = PageCurrentMode.Readonly;
                        SetControlsByCurrentPageMode();
                        QueryData();
                        ErrorMsgLabel.Text = "新增成功";
                    }
                    else
                    {
                        ErrorMsgLabel.Text = strErrMsg;
                    }
                    #endregion
                }
                else if (CurrentPageMode == PageCurrentMode.Edit)
                {
                    #region
                    try
                    {
                        #region 修改
                        for (Int32 i = 0; i <= dtTemp.Rows.Count - 1; i++)
                        {
                            if (dtTemp.Rows[i].RowState != DataRowState.Deleted)
                            {
                                if (strErrMsg == "")
                                {
                                    //SLP_Route1 = (WUI.SLP.SLP_Route)GridView1.Rows[i].FindControl("SLP_Route1");
                                    //SLP_SLPNumber1 = (WUI.SLP.SLPNumber)GridView1.Rows[i].FindControl("SLP_SLPNumber1");
                                    //SLP_SLPNumber2 = (WUI.SLP.SLPNumber)GridView1.Rows[i].FindControl("SLP_SLPNumber2");
                                    ParameterList.Clear();
                                    ParameterList = GetQueryParams();
                                    //ParameterList.Add(SLP_Route1.Text);
                                    //ParameterList.Add(SLP_SLPNumber1.Text);
                                    //ParameterList.Add(SLP_SLPNumber2.Text);
                                    ParameterList.Add(dtTemp.Rows[i]["ROUTE"].ToString());
                                    ParameterList.Add(dtTemp.Rows[i]["ADD_STORE_CNT"].ToString());
                                    ParameterList.Add(dtTemp.Rows[i]["STORE_CNT"].ToString());
                                    ParameterList.Add(Session["UID"].ToString());
                                    bResult = BCO.UPDATE_CAL_MONTH_ROUTE(ParameterList, DBT, out strErrMsg);
                                }
                                else
                                {
                                    break;
                                    DBT.Rollback();//交易失敗
                                }
                            }
                        }
                        #endregion

                        #region 刪除
                        DataTable dtDeleted = dtTemp.GetChanges(DataRowState.Deleted); ;

                        if (dtDeleted != null)
                        {
                            for (Int32 j = 0; j <= dtDeleted.Rows.Count - 1; j++)
                            {
                                if (bResult)
                                {
                                    ParameterList.Clear();
                                    ParameterList = GetQueryParams();
                                    ParameterList.Add(dtDeleted.Rows[j]["ROUTE", DataRowVersion.Original].ToString());
                                    ParameterList.Add(Session["UID"].ToString());
                                    BCO.DEL_CAL_MONTH_ROUTE(ParameterList, DBT);
                                }
                                else
                                {
                                    break;
                                    DBT.Rollback();//交易失敗
                                }
                            }
                        }
                        #endregion

                        DBT.Commit();//交易成功

                    }
                    catch (Exception ex)
                    {
                        DBT.Rollback();//交易失敗
                        throw ex;
                    }


                    if (bResult && strErrMsg == "")
                    {
                        CurrentPageMode = PageCurrentMode.Readonly;
                        SetControlsByCurrentPageMode();
                        QueryData();
                        ErrorMsgLabel.Text = "更新成功";
                    }
                    else
                    {
                        ErrorMsgLabel.Text = strErrMsg;
                    }
                    #endregion
                }
                //}
            }
            #endregion
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
            UpdatePanel1.Update();
        }
        #endregion
    }//btn_Save_Click
Exemple #15
0
    protected void btn_Save_Click(object sender, EventArgs e)
    {
        #region
        try
        {
            #region
            if (txt_TRANS_NO.Text != "")
            {

                Int32 i32Occupied = 0;
                if (!CheckTransferPostSortIsOccupied(txt_TRANS_NO.Text.Trim(), SLP_TRANSFER_POST_SORT.Text.Trim(), out i32Occupied))
                {
                    ErrorMsgLabel.Text = string.Format("轉運站排序順序:{0},已被其他運費代號使用!", SLP_TRANSFER_POST_SORT.Text.Trim());
                    return;
                }

                if (string.Compare(SLP_START_DATE.Text.Trim(), SLP_END_DATE.Text.Trim(), true) > 0)
                {
                    ErrorMsgLabel.Text = "[適用開始日/適用結束日]迄值不得小於起值";
                    return;
                }

                if (string.Compare(SLP_AC_START_DATE.Text.Trim(), SLP_AC_END_DATE.Text.Trim(), true) > 0)
                {
                    ErrorMsgLabel.Text = "[結算開始日/結算結束日]迄值不得小於起值";
                    return;
                }

                if (CurrentPageMode == PageCurrentMode.Insert)
                {
                    #region
                    TRNModel.VDS_TRN12_BCO BCO = new TRNModel.VDS_TRN12_BCO(ConnectionDB);
                    string strID = "", strErrMsg = "";
                    bool bResult = false;
                    bResult = BCO.ADD_TRN_TRNSPO_INIT(GetQueryParams(), null, out strID, out strErrMsg);

                    if (bResult && strErrMsg == "")
                    {
                        ArrayList aryTmp = new ArrayList();
                        aryTmp.Clear();
                        aryTmp.Add(strID);
                        aryParamsPKey = aryTmp;
                        s_ID = strID;

                        QueryData();

                        CurrentPageMode = PageCurrentMode.Readonly;
                        SetControlsByCurrentPageMode();

                        ErrorMsgLabel.Text = "新增成功";
                    }
                    else
                    {
                        ErrorMsgLabel.Text = strErrMsg;
                    }
                    #endregion
                }
                else if (CurrentPageMode == PageCurrentMode.Edit)
                {
                    #region
                    TRNModel.VDS_TRN12_BCO BCO = new TRNModel.VDS_TRN12_BCO(ConnectionDB);
                    string strID = "", strErrMsg = "";
                    bool bResult = false;
                    bResult = BCO.UPDATE_TRN_TRNSPO_INIT(GetQueryParams(), null, out strErrMsg);

                    if (bResult && strErrMsg == "")
                    {
                        CurrentPageMode = PageCurrentMode.Readonly;
                        SetControlsByCurrentPageMode();
                        ErrorMsgLabel.Text = "更新成功";
                    }
                    else
                    {
                        ErrorMsgLabel.Text = strErrMsg;
                    }
                    #endregion
                }
            }
            else
            {
                ErrorMsgLabel.Text = "請輸入代碼";
            }
            #endregion
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
            UpdatePanel1.Update();
        }
        #endregion
    }//btn_Save_Click
Exemple #16
0
    }//btn_Save_Click

    protected void btn_Cancel_Click(object sender, EventArgs e)
    {
        #region
        try
        {
            if (CurrentPageMode == PageCurrentMode.Readonly)
            {
                Response.Redirect("TRN141.aspx?Code=TRN14&PageTimeStamp=" + PageTimeStamp.Value, false);
            }
            else if (CurrentPageMode == PageCurrentMode.Insert)
            {
                //CurrentPageMode = PageCurrentMode.Readonly;
                //SetControlsByCurrentPageMode();
                Response.Redirect("TRN141.aspx?Code=TRN14&PageTimeStamp=" + PageTimeStamp.Value, false);
            }
            else if (CurrentPageMode == PageCurrentMode.Edit)
            {
                CurrentPageMode = PageCurrentMode.Readonly;
                SetControlsByCurrentPageMode();
                QueryData();
            }

        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        #endregion
    }//btn_Cancel_Click
Exemple #17
0
    }//btn_Cancel_Click

    protected void btn_Edit_Click(object sender, EventArgs e)
    {
        #region
        try
        {
            if (CurrentPageMode == PageCurrentMode.Readonly)
            {
                CurrentPageMode = PageCurrentMode.Edit;
                SetControlsByCurrentPageMode();
            }
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        #endregion
    }//btn_Cancel_Click
Exemple #18
0
    protected void Page_Load(object sender, EventArgs e)
    {
        #region
        try
        {
            ErrorMsgLabel.Text = "";
            ResultMsgLabel.Text = "";

            if (!IsPostBack)
            {
                if (Request.QueryString["PageTimeStamp"] != null)
                    PageTimeStamp.Value = Request.QueryString["PageTimeStamp"];
                else
                    PageTimeStamp.Value = string.Format("{0}{1}{2}{3}{4}{5}{6}",
                                                        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'),
                                                        DateTime.Now.Millisecond.ToString().PadLeft(4, '0')
                                                        );

                #region

                if (Request.QueryString["Mode"] == null)
                {
                    CurrentPageMode = PageCurrentMode.Query;
                }
                else
                {
                    if (Request.QueryString["Mode"] == PageCurrentMode.Readonly.ToString())
                    {
                        CurrentPageMode = PageCurrentMode.Readonly;
                    }
                    else if (Request.QueryString["Mode"] == PageCurrentMode.Insert.ToString())
                    {
                        CurrentPageMode = PageCurrentMode.Insert;
                    }
                    else if (Request.QueryString["Mode"] == PageCurrentMode.Edit.ToString())
                    {
                        CurrentPageMode = PageCurrentMode.Edit;
                    }
                }

                SetControlsByCurrentPageMode();
                #endregion

                GridView1.PageSize = 20;
            }

            btn_Query.Attributes.Add("onclick", "Check_RequiredField();if(Page_IsValid==false){return false;}");
            btn_Add.Attributes.Add("onclick", "Check_RequiredField();if(Page_IsValid==false){return false;}");
            btn_Save.Attributes.Add("onclick", "Check_RequiredField();if(Page_IsValid==false){return false;}");
            SLP_TRN_TransNo1.TextBox_Code.Attributes.Add("onblur", "GetAcDateTimeAtClient();");

            #region 設定TabIndex

            SLP_TRN_TransNo1.TextBox_Code.TabIndex = 1;
            SLP_YearMonth1.TextBoxCode_Object.TabIndex = 2;
            SLP_SLPDate1.DateTextBox.TabIndex = 3;
            SLP_SLPDate2.DateTextBox.TabIndex = 4;
            btn_AddNewDetail.TabIndex = 5;
            btn_Query.TabIndex = 6;
            btn_Add.TabIndex = 7;
            btn_Save.TabIndex = 8;
            btn_Edit.TabIndex = 9;
            btn_Cancel.TabIndex = 10;
            #endregion

            ToolBarInit();
            AuthorityControls(this);
        }
        catch (Exception ex)
        {
            ErrorMsgLabel.Text = ex.Message;
        }
        finally
        {
            UpdatePanel1.Update();
        }
        #endregion
    }//page_load
Exemple #19
0
    protected void Page_Load(object sender, EventArgs e)
    {
        #region
        try
        {

            strReason = SLP_CodeFile1.Text;

            ErrorMsgLabel.Text = "";
            ResultMsgLabel.Text = "";


            if (!IsPostBack)
            {
                this.SmartGridView1.PageSize = 5;//20091113

                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')
                                            );



                //PanelMasterAndDetail.Visible = false;

                Panel_Detail.Visible = false;
                Panel_AddDetail.Visible = false;
                bDetailEditing = false;

                CurrentPageMode = PageCurrentMode.Query;
                LastPageMode = PageCurrentMode.Query;

                #region

                //query
                ((TextBox)SLP_StoreChain1.FindControl("TextBoxCode")).Attributes.Add("onblur", "CompareFromToValues('SLP_StoreChain1_TextBoxCode','SLP_StoreChain3_TextBoxCode','通路');if(Page_IsValid==false){return false;}SetTheSameValue('SLP_StoreChain1_TextBoxCode','SLP_StoreChain3_TextBoxCode');");
                ((TextBox)SLP_StoreChain3.FindControl("TextBoxCode")).Attributes.Add("onblur", "CompareFromToValues('SLP_StoreChain1_TextBoxCode','SLP_StoreChain3_TextBoxCode','通路');");

                //master
                rBtn_SpecType1.Attributes.Add("onclick", "CheckSpecTypeChange();if(Page_IsValid==false){return false;}");
                rBtn_SpecType2.Attributes.Add("onclick", "CheckSpecTypeChange();if(Page_IsValid==false){return false;}");
                rBtn_SpecType3.Attributes.Add("onclick", "CheckSpecTypeChange();if(Page_IsValid==false){return false;}");
                rBtn_SpecType4.Attributes.Add("onclick", "CheckSpecTypeChange();if(Page_IsValid==false){return false;}");
                rBtn_SpecType5.Attributes.Add("onclick", "CheckSpecTypeChange();if(Page_IsValid==false){return false;}");
                rBtn_SpecType6.Attributes.Add("onclick", "CheckSpecTypeChange();if(Page_IsValid==false){return false;}");
                btn_Save.Attributes.Add("onclick", "CompareNexDayValues('SLP_SLPDate3_TextBoxCode','SLP_SLPDate2_TextBoxCode','開始日不可大於結束日');if(Page_IsValid==false){return false;}");

                //detail
                ((TextBox)SLP_NumberS.FindControl("TextBoxCode")).Attributes["onchange"] += "CompareFromToValues('SLP_NumberS_TextBoxCode','SLP_NumberE_TextBoxCode','本數');if(Page_IsValid==false){return false;}SetTheSameValue('SLP_NumberS_TextBoxCode','SLP_NumberE_TextBoxCode');";
                ((TextBox)SLP_NumberE.FindControl("TextBoxCode")).Attributes["onchange"] += "CompareFromToValues('SLP_NumberS_TextBoxCode','SLP_NumberE_TextBoxCode','本數');";
                btn_AddDetail.Attributes.Add("onclick", "ClearAllMsg();");
                btn_UpdateRecord.Attributes.Add("onclick", "CompareFromToValues('SLP_NumberS_TextBoxCode','SLP_NumberE_TextBoxCode','本數');if(Page_IsValid==false){return false;}");


                #endregion

                ToolBarInit();

                RegTextAttr();

                RegClientScript();


                #region 設定TabIndex

                //query
                SLP_RootNo1.TextBox_Code.TabIndex = 1;
                SLP_PMA1.TextBox_Code.TabIndex = 2;
                SLP_Pattern1.TextBox_Code.TabIndex = 3;
                SLP_StoreChain1.TextBox_Code.TabIndex = 4;
                SLP_StoreChain3.TextBox_Code.TabIndex = 5;
                SLP_SLPDate1.DateTextBox.TabIndex = 6;
                SLP_User1.TextBox_Code.TabIndex = 7;
                ((DropDownList)SLP_SpecType.FindControl("D1")).TabIndex = 8;
                btn_Copy.TabIndex = 9;
                TextBoxRowCountLimit.TabIndex = 10;
                TextBoxPagesize.TabIndex = 12;
                btn_New.TabIndex = 12;
                btn_Query.TabIndex = 13;
                btn_Export.TabIndex = 13;

                //master
                SLP_RootNo2.TextBox_Code.TabIndex = 14;
                SLP_PMA2.TextBox_Code.TabIndex = 15;
                SLP_Pattern2.TextBox_Code.TabIndex = 16;
                SLP_StoreChain2.TextBox_Code.TabIndex = 17;
                SLP_Store2.TextBox_Code.TabIndex = 18;
                SLP_SLPDate2.DateTextBox.TabIndex = 19;
                SLP_SLPDate3.DateTextBox.TabIndex = 20;
                rBtn_SpecType1.TabIndex = 21;
                rBtn_SpecType2.TabIndex = 22;
                rBtn_SpecType3.TabIndex = 23;
                rBtn_SpecType4.TabIndex = 24;
                rBtn_SpecType5.TabIndex = 25;
                rBtn_SpecType6.TabIndex = 26;
                btn_Setting.TabIndex = 27;
                SLP_Number1.TextBox_Code.TabIndex = 28;
                ((DropDownList)SLP_CodeFile1.FindControl("D1")).TabIndex = 29;
                btn_Save.TabIndex = 30;
                btn_Cancel.TabIndex = 31;
                //detail
                btn_AddDetail.TabIndex = 32;
                btn_CopyDetail.TabIndex = 33;
                SLP_NumberS.TextBox_Code.TabIndex = 34;
                SLP_NumberE.TextBox_Code.TabIndex = 35;
                SLP_NumberAdj.TextBox_Code.TabIndex = 36;
                btn_UpdateRecord.TabIndex = 37;
                btn_CancelRecord.TabIndex = 38;
                #endregion

                AuthorityControls(this);
            }

            if (CurrentPageMode == PageCurrentMode.Insert)
            {
                SLP_RootNo1.Text = SLP_RootNo2.Text;
                SLP_PMA1.Text = SLP_PMA2.Text;
            }
            else
            {
                SLP_RootNo1.Text = SLP_RootNo1.Text;
                SLP_PMA1.Text = SLP_PMA1.Text;
            }


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