예제 #1
0
    protected void btnAdd_Mode_Command(object sender, CommandEventArgs e)
    {
        btnDel.Visible = false;

        if (e.CommandName == "btnAdd_Mode")
        {
            ClearAllField();
            slpRESUME_DATE_B.Text = slpCNT_VALID_DATE.Text;
            slpRESUME_DATE_E.Text = slpCNT_END_DATE.Text;
            txtEDIT_NO.Text = "1";
            this.SLP_SLPDate1.Text = System.DateTime.Now.ToShortDateString();
            this.SLP_User1.Text = Session["UID"].ToString();
            this.SLP_SLPDate2.Text = System.DateTime.Now.ToShortDateString();
            this.SLP_User2.Text = Session["UID"].ToString();
        }
        else if (e.CommandName == "btnCopy_Mode")
        {
            ClearCopyField();
            slpRESUME_DATE_B.Text = slpCNT_VALID_DATE.Text;
            slpRESUME_DATE_E.Text = slpCNT_END_DATE.Text;
            txtEDIT_NO.Text = "1";
            this.SLP_SLPDate1.Text = System.DateTime.Now.ToShortDateString();
            this.SLP_User1.Text = Session["UID"].ToString();
            this.SLP_SLPDate2.Text = System.DateTime.Now.ToShortDateString();
            this.SLP_User2.Text = Session["UID"].ToString();        
        }
        else if (e.CommandName == "btnModify_Mode")
        {
            btnAdd.CommandName = "確定修改";
        }

        if (slpCNT_CONFIRM_CODE.Text == "1") //已審核
        {
            DisableForm(true);//true 不可修改
            SpecCalc(true);//false 不可修改 -> 特殊計算處理            
            btnAdd.Enabled = false;
            slpRESUME_DATE_B.ReadOnly = true;
            if (Request["VDM021"].ToString() != "ADD")
            {
                GMToolbar1.GMToolbarStatus = WUI_GMToolbarV.GMToolbarStatusEnum.UpdateEdit;
                GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Find, true, "VDM021.aspx?Code=VDM02", null, WUI_GMToolbarV.ClickAction.LinkURL);
                GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Save, false, "", btnAdd, WUI_GMToolbarV.ClickAction.ButtonClick);
            }

            //最新合約資料才可新增履歷
            ParameterList.Clear();
            ParameterList.Add(txtVENDOR_CODE.Text); //廠商統編
            ParameterList.Add(txtCNT_NO.Text); //合約編號
            BCO.MaintainVendorAgm bco = new BCO.MaintainVendorAgm(ConntionDB);
            string Dt = bco.QueryMaxEditNo(ParameterList);
            if (txtEDIT_NO.Text != Dt)
            {
                slpRESUME_DATE_E.ReadOnly = true;
                btnADD_RESUME.Enabled = false;
                btnExtendDate.Enabled = false;
            }
            else
            {
                slpRESUME_DATE_E.ReadOnly = false;
                btnADD_RESUME.Enabled = true;
                btnExtendDate.Enabled = true;
            }
        }
        else //未審核
        {
            DisableForm(false);//true 不可修改
            if (txtEDIT_NO.Text.Trim() != "1") //只有異動序號在1的時候才可以修改
            {
                slpCNT_VALID_DATE.ReadOnly = true;
                slpCNT_END_DATE.ReadOnly = true;
            }
            SpecCalc(false);//false 不可修改 -> 特殊計算處理
            btnAdd.Enabled = true;
            //slpCNT_CONFIRM_DATE.Text = DateTime.Today.ToString();
            if (Request["VDM021"].ToString() != "ADD")
            {
                GMToolbar1.GMToolbarStatus = WUI_GMToolbarV.GMToolbarStatusEnum.UpdateEdit;
                GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Find, true, "VDM021.aspx?Code=VDM02", null, WUI_GMToolbarV.ClickAction.LinkURL);
                GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Save, true, "", btnAdd, WUI_GMToolbarV.ClickAction.ButtonClick);
            }
        }
        btnAdd_Mode.Visible = false;
        btnModify_Mode.Visible = false;
        btnCopy_Mode.Visible = false;
        btnAdd.Visible = true;
        slpACCEPT_RATE.ReadOnly = true;
        slpRETURN_RATE.ReadOnly = true;

        radFixAmt.Checked = true;
        radFixPercent.Checked = false;
        slpPAY_TYPE.Text = "";
        slpPAY_TYPE.ReadOnly = true;

        GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Delete, false, "", btnDel, WUI_GMToolbarV.ClickAction.ButtonClick);

        UpdatePanel1.Update();
        UpdatePanel2.Update();
        UpdatePanel3.Update();
        UpdatePanel4.Update();
        UpdatePanel4_1.Update();
        UpdatePanel5.Update();
        UpdatePanel6.Update();
        UpdatePanel_SUBSIDY2.Update();
        UpdatePanel9.Update();
        UpdatePanel7.Update();
    }