Exemple #1
0
    //確定新增 / 確定修改
    protected void btnAdd_Command(object sender, CommandEventArgs e)
    {
        string strScript;
        if (((DropDownList)SLP_CodeFile4.FindControl("D1")).SelectedItem.Text == "冊")
        {
            strScript = "alert('年度獎勵金〔收取方式=冊〕 暫不提供使用,請重新選擇');";
            strScript += "try { document.getElementById('" + ((DropDownList)SLP_CodeFile4.FindControl("D1")).ClientID + "').focus();}catch(e){}";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "VDM022", strScript, true);
            return;
        }

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


        //牌價檢核 -- 獎勵金
        foreach (GridViewRow ddr in GridView_3.Rows)
        {
            if (((Label)ddr.FindControl("lblPAY_TYPE_Name")).Text == "牌價")
                foreach (DataRow dr in ds.Tables["Table_3"].Rows)
                {
                    if (dr.RowState != DataRowState.Deleted)
                    {
                        if (dr["PAY_TYPE"].ToString() == "4")
                        {
                            DataRow[] drs = ds.Tables["Table_4"].Select("PID='" + dr["ID"].ToString() + "'");
                            if (drs.Length == 0)
                            {
                                ScriptManager.RegisterStartupScript(this, this.GetType(), "VDM022", "alert('" + TargetType[Int16.Parse(dr["TARGET_TYPE"].ToString())] + "沒有設定店群,收取方式不能選擇牌價,請重新設定');", true);
                                return;
                            }
                        }
                    }
                }
        }

        //牌價檢核 -- 年度獎勵金
        if (((DropDownList)SLP_CodeFile4.FindControl("D1")).SelectedItem.Text == "牌價")
        {
            if (ds.Tables["Table_6"].Rows.Count == 0)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "VDM022", "alert('年度獎勵金沒有設定店群,收取方式不能選擇牌價,請重新設定');", true);
                return;
            }
        }

        if (rdoCOUNT_TYPE2.Checked)
        {
            if (GridView_6.Rows.Count == 0)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "VDM022", "alert('年度獎勵金設定[計算方式]=部份店群,請設定店群、門市資料');", true);
                return;
            }
        }


        #region 油價補貼 資料檢核
        //收取方式的規則-成本
        if (ddlSUBSIDY2_PAY_TYPE.SelectedValue == "2")
        {
            //if (rblSUBSIDY2_COUNT_TYPE.SelectedValue == "2")
            //{
            //    ScriptManager.RegisterStartupScript(this, this.GetType(), "VDM022", "alert('油價補貼的收取方式為成本時,計算方式不能選擇部份店群,請重新設定');", true);
            //    return;
            //}

            if (!((ddlSUBSIDY2_RULE.SelectedValue == "2") || (ddlSUBSIDY2_RULE.SelectedValue == "3")))
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "VDM022", "alert('油價補貼的收取方式為成本時,只允許選取[廠進-廠退]或[廠進]規則,請重新設定');", true);
                return;
            }

        }
        //收取方式的規則-牌價
        if (ddlSUBSIDY2_PAY_TYPE.SelectedValue == "4")
        {
            if (rblSUBSIDY2_COUNT_TYPE.SelectedValue == "1")
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "VDM022", "alert('油價補貼的收取方式為牌價時,計算方式不能選擇全店群,請重新設定');", true);
                return;
            }

            if (!((ddlSUBSIDY2_RULE.SelectedValue == "6") || (ddlSUBSIDY2_RULE.SelectedValue == "7")))
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "VDM022", "alert('油價補貼的收取方式為牌價時,只允許選取[店進-店退]或[店進]規則,請重新設定');", true);
                return;
            }
        
        }
        if (rblSUBSIDY2_COUNT_TYPE.SelectedValue == "2")
        {
            if (this.GridView_SUBSIDY2.Rows.Count == 0)
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "VDM022", "alert('油價補貼計算方式選擇部分店群,但是尚未設定計算店群');", true);
                return;
            }
        }

        //檢查油價補貼設定,若計算方式非不計算,則費率%必須要輸入
        if (rblSUBSIDY2_COUNT_TYPE.SelectedValue != "0")
        {
            if (slpSUBSIDY2_RATE.Text.Trim() == "")
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "VDM022", "alert('油價補貼若計算方式非不計算,則費率%必須要輸入');", true);
                return;
            }
        }

        #endregion

        //檢查離島配送設定,若計算方式非不計算,則費率%必須要輸入
        if (rblSUBSIDY1_COUNT_TYPE.SelectedValue != "0")
        {
            if (slpSUBSIDY1_RATE.Text.Trim() == "")
            {
                ScriptManager.RegisterStartupScript(this, this.GetType(), "VDM022", "alert('離島配送若計算方式非不計算,則費率%必須要輸入');", true);
                return;
            }
        }

        //檢查離島配送費設定,收取方式只能設定為牌價
        if (ddlSUBSIDY1_PAY_TYPE.SelectedValue != "4")
        {
            ScriptManager.RegisterStartupScript(this, this.GetType(), "VDM022", "alert('離島配送費的收取方式只能設定為牌價');", true);
            return;
        }

        string s_CheckPage = CheckPage(sender, ds);

        if (s_CheckPage != string.Empty)
        {
            this.ErrorMsgLabel.Text = s_CheckPage;
            ScriptManager.RegisterStartupScript(this, this.GetType(), "VDM022", "document.getElementById('" + VDM022_txtFocus.ClientID + "').focus();document.getElementById('" + VDM022_txtFocus.ClientID + "').select();", true);
            return;
        }
        try
        {
            DateTime DTime = DateTime.Now;
            if (e.CommandName == "確定新增")
            {
                //檢核合約期間是否重複
                ParameterList.Clear();
                ParameterList.Add(txtVENDOR_CODE.Text); //廠商統編
                ParameterList.Add(DateTime.Parse(slpCNT_END_DATE.Text).ToString("yyyy/MM/dd")); //合約結束日
                ParameterList.Add(DateTime.Parse(slpCNT_VALID_DATE.Text).ToString("yyyy/MM/dd")); //合約生效日
                BCO.MaintainVendorAgm bco = new BCO.MaintainVendorAgm(ConntionDB);
                int dupRec = bco.CheckContDup(ParameterList);
                if (dupRec != 0)
                {
                    ScriptManager.RegisterStartupScript(this, this.GetType(), "VDM022", "alert('合約期間重複,請重新設定');", true);
                    return;
                }

                ParameterList.Clear();
                ParameterList.Add(txtVENDOR_CODE.Text);  //0.
                ParameterList.Add(1);//1.N_EDIT_NO
                ParameterList.Add(GetValueSetParameter(this.slpCNT_VALID_DATE.Text.Trim(), "date", false)); //2.
                ParameterList.Add(0);//3.N_CNT_CONFIRM_CODE(1=已審核,0=未審核)
                ParameterList.Add(System.DBNull.Value);//4.D_CNT_CONFIRM_DATE
                ParameterList.Add(GetValueSetParameter(this.slpCNT_END_DATE.Text.Trim(), "date", false));//5.D_CNT_END_DATE
                ParameterList.Add(GetValueSetParameter(this.slpBELOW_SUBVEN.Text.Trim(), "float", false));//6.N_BELOW_SUBVEN
                ParameterList.Add(txtCOL_DAYS.Text);//7.N_COL_DAYS
                ParameterList.Add(GetValueSetParameter(this.ddlPAY_TYPE.Text.Trim(), "int", false));//8.N_PAY_TYPE結帳方式 1:月結,2:期別結
                ParameterList.Add(System.DBNull.Value);//9.D_STOP_DATE
                ParameterList.Add(System.DBNull.Value);//10.V_TRACE_DATE_B
                ParameterList.Add(System.DBNull.Value);//11.V_TRACE_DATE_E
                ParameterList.Add(slpCNT_VALID_DATE.Text);//12.D_RESUME_DATE_B=合約起日
                ParameterList.Add(slpCNT_END_DATE.Text);//13.D_RESUME_DATE_E=合約迄日
                ParameterList.Add(slpBELOW_SUBVEN_TYPE.Text); //14.
                ParameterList.Add(GetValueSetParameter(this.slpBELOW_SUBVEN_RATE.Text.Trim(), "float", false));//15.N_BELOW_SUBVEN_RATE
                ParameterList.Add(slpBELOW_SUBVEN_PAY_TYPE.Text); //16.
                ParameterList.Add((GetRowCount(ds.Tables["Table_2"]) == 0 ? 0 : 1));//17.N_BELOW_SUBVEN_ITEM_FLAG 單品FLAG(0:無設定單品1:有設定單品)
                ParameterList.Add((GetRowCount(ds.Tables["Table_1"]) == 0 ? 0 : 1));//18.N_BELOW_SUBVEN_STORE_FLAG 排除店群門市FLAG(0:無設定1:有設定)
                ParameterList.Add(System.DBNull.Value); //19.V_TRACING_CHECK_MONTH
                ParameterList.Add(Session["UID"].ToString());//20.V_CREATEUID
                ParameterList.Add(DTime);                    //21.D_CREATEDATE
                ParameterList.Add(Session["UID"].ToString());//22.V_UPDATEUID
                ParameterList.Add(DTime);                    //23.D_UPDATEDATE
                ParameterList.Add("");                       //24.V_CNT_NO 履歷使用(這邊沒用到)

                ParameterList.Add(rblSUBSIDY2_TYPE.SelectedValue);      //25.油價補貼 補貼類別
                ParameterList.Add(rblSUBSIDY2_COUNT_TYPE.SelectedValue);//26.油價補貼 計算方式
                ParameterList.Add(slpSUBSIDY2_RATE.Text.Trim());        //27.油價補貼 費率
                ParameterList.Add(ddlSUBSIDY2_PAY_TYPE.SelectedValue);  //28.油價補貼 收取方式
                ParameterList.Add(ddlSUBSIDY2_RULE.SelectedValue);      //29.油價補貼 規則

                ParameterList.Add(rblSUBSIDY1_COUNT_TYPE.SelectedValue);//30.離島配送費 計算方式
                ParameterList.Add(slpSUBSIDY1_RATE.Text.Trim());        //31.離島配送費 費率
                ParameterList.Add(ddlSUBSIDY1_PAY_TYPE.SelectedValue);  //32.離島配送費 收取方式
                ParameterList.Add(ddlSUBSIDY1_RULE.SelectedValue);      //33.離島配送費 規則

                ParameterList.Add(rblSUBSIDY4_COUNT_TYPE.SelectedValue);//34.轉運費 計算方式

                //新增年度獎勵金
                ArrayList ArrList = new ArrayList();
                ArrList.Add(1);//N_EDIT_NO
                ArrList.Add(1);//ANNUAL_TYPE 固定給1
                ArrList.Add(GetValueSetParameter(this.txtVENDOR_CODE.Text.Trim(), "string", false));
                ArrList.Add(GetValueSetParameter((rdoCOUNT_TYPE1.Checked ? "1" : "2"), "int", false));//COUNT_TYPE計算方式,1.全店群2.部份店群
                ArrList.Add(GetValueSetParameter(SLP_CodeFile4.Text.Trim(), "int", false));//PAY_TYPE收取方式(1:冊,2:成本,3:零售價,4:牌價,5:本體價)
                ArrList.Add(GetValueSetParameter(SLP_CodeFile3.SelectedValue, "int", false));//ANNUAL_RULE規則(廠商進+廠商退、廠商進-廠商退、廠商進、廠商退  、店群進+店群退、店群進-店群退、店群進、店群退) 
                ArrList.Add(Session["UID"].ToString());//V_CREATEUID
                ArrList.Add(DTime);//D_CREATEDATE
                ArrList.Add(Session["UID"].ToString());//V_UPDATEUID
                ArrList.Add(DTime);//D_UPDATEDATE             

                string V_CNT_NO = "";

                //給店群門市的TARGET_NO值
                foreach (DataRow dr in ds.Tables["Table_3"].Rows)
                    foreach (DataRow Dr in ds.Tables["Table_4"].Rows)
                        if (Dr["PID"].ToString() == dr["ID"].ToString())
                            Dr["TARGET_NO"] = dr["TARGET_TYPE"];

                //BCO.MaintainVendorAgm bco = new BCO.MaintainVendorAgm(ConntionDB);
                bco.CreateVendorAgm(ParameterList, ArrList, ds, null, false, out V_CNT_NO);
                txtCNT_NO.Text = V_CNT_NO;

                ArrayList arl_Key = new ArrayList();
                arl_Key.Add(V_CNT_NO + "|" + "1");//新增的Edit_No = 1

                Session["VDM021_SortKey" + PageTimeStamp.Value] = arl_Key;
                ScriptManager.RegisterStartupScript(this, this.GetType(), "ClientScript", "alert('新增完成');location.replace('VDM022.aspx?arl_Key=VDM021_SortKey" + PageTimeStamp.Value + "&isToolBar=N&Code=VDM02&VDM021=EDIT&CNT_NO=" + V_CNT_NO + "&EDIT_NO=1');", true);
            }
            else //確定修改
            {
                ParameterList.Clear();
                ParameterList.Add(ds.Tables["Table_0"].Rows[0]["VENDOR_CODE"].ToString());                                          //0.V_OLD_VENDOR_CODE
                ParameterList.Add(ds.Tables["Table_0"].Rows[0]["CNT_NO"].ToString());                                               //1.V_OLD_CNT_NO
                ParameterList.Add(GetValueSetParameter(ds.Tables["Table_0"].Rows[0]["EDIT_NO"].ToString(), "int", false));          //2.N_OLD_EDIT_NO
                ParameterList.Add(GetValueSetParameter(ds.Tables["Table_0"].Rows[0]["CREATEDATE"].ToString(), "datetime", false));  //3.D_OLD_CREATEDATE
                ParameterList.Add(ds.Tables["Table_0"].Rows[0]["CREATEUID"].ToString());                                            //4.V_OLD_CREATEUID
                ParameterList.Add(GetValueSetParameter(ds.Tables["Table_0"].Rows[0]["UPDATEDATE"].ToString(), "datetime", false));  //5.D_OLD_UPDATEDATE
                ParameterList.Add(ds.Tables["Table_0"].Rows[0]["UPDATEUID"].ToString());                                            //6.V_OLD_UPDATEUID
                ParameterList.Add(GetValueSetParameter(this.txtVENDOR_CODE.Text.Trim(), "string", false));                          //7.V_NEW_VENDOR_CODE
                ParameterList.Add(txtCNT_NO.Text);                                                                                  //8.V_NEW_CNT_NO
                ParameterList.Add(ds.Tables["Table_0"].Rows[0]["EDIT_NO"].ToString());                                              //9.N_NEW_EDIT_NO(因畫面上無此欄位可供變更)
                ParameterList.Add(GetValueSetParameter(this.slpCNT_VALID_DATE.Text.Trim(), "date", false));                         //10.D_NEW_CNT_VALID_DATE
                ParameterList.Add(slpCNT_CONFIRM_CODE.SelectedValue);                                                               //11.N_NEW_CNT_CONFIRM_CODE(1=已審核,0=未審核) -- 應該是不能修改的                
                ParameterList.Add(GetValueSetParameter(slpCNT_CONFIRM_DATE.Text.Trim(), "date", false));                            //12.D_NEW_CNT_CONFIRM_DATE
                ParameterList.Add(GetValueSetParameter(slpCNT_END_DATE.Text.Trim(), "date", false));                                //13.D_NEW_CNT_END_DATE
                ParameterList.Add(GetValueSetParameter(slpBELOW_SUBVEN.Text.Trim(), "float", false));                               //14.N_NEW_BELOW_SUBVEN
                ParameterList.Add(txtCOL_DAYS.Text);                                                                                //15.N_NEW_COL_DAYS
                ParameterList.Add(GetValueSetParameter(ddlPAY_TYPE.Text, "int", false));                                            //16.N_NEW_PAY_TYPE結帳方式 1:月結,2:期別結
                ParameterList.Add(System.DBNull.Value);                                                                             //17.D_NEW_STOP_DATE
                ParameterList.Add(System.DBNull.Value);                                                                             //18.V_NEW_TRACE_DATE_B
                ParameterList.Add(System.DBNull.Value);                                                                             //19.V_NEW_TRACE_DATE_E
                if (txtEDIT_NO.Text.Trim() == "1")
                {
                    ParameterList.Add(slpCNT_VALID_DATE.Text);  //20.D_NEW_RESUME_DATE_B=合約生效日(2009/7/23修改)
                    ParameterList.Add(slpCNT_END_DATE.Text);    //21.D_NEW_RESUME_DATE_E=合約終止日(2009/7/23修改)
                }
                else
                {
                    ParameterList.Add(slpRESUME_DATE_B.Text);   //20.D_NEW_RESUME_DATE_B=合約生效日
                    ParameterList.Add(slpRESUME_DATE_E.Text);   //21.D_NEW_RESUME_DATE_E=合約終止日
                }
                ParameterList.Add(GetValueSetParameter(slpBELOW_SUBVEN_TYPE.Text, "int", false));               //22.N_NEW_BELOW_SUBVEN_TYPE
                ParameterList.Add(GetValueSetParameter(this.slpBELOW_SUBVEN_RATE.Text.Trim(), "float", false)); //23.N_NEW_BELOW_SUBVEN_RATE
                ParameterList.Add(GetValueSetParameter(slpBELOW_SUBVEN_PAY_TYPE.Text, "int", false));           //24.N_NEW_BELOW_SUBVEN_PAY_TYPE
                ParameterList.Add((GetRowCount(ds.Tables["Table_2"]) == 0 ? 0 : 1));    //25.N_NEW_BELOW_SUBVEN_ITEM_FLAG 單品FLAG(0:無設定單品1:有設定單品)
                ParameterList.Add((GetRowCount(ds.Tables["Table_1"]) == 0 ? 0 : 1));    //26.N_NEW_BELOW_SUBVEN_STORE_FLAG 排除店群門市FLAG(0:無設定1:有設定)
                ParameterList.Add(ds.Tables["Table_0"].Rows[0]["TRACING_CHECK_MONTH"].ToString());  //27.V_NEW_TRACING_CHECK_MONTH
                ParameterList.Add(DTime);                    //28.D_NEW_UPDATEDATE
                ParameterList.Add(Session["UID"].ToString());//29.V_NEW_UPDATEUID

                ParameterList.Add(rblSUBSIDY2_TYPE.SelectedValue);      //30.油價補貼 補貼類別
                ParameterList.Add(rblSUBSIDY2_COUNT_TYPE.SelectedValue);//31.油價補貼 計算方式
                ParameterList.Add(slpSUBSIDY2_RATE.Text.Trim());        //32.油價補貼 費率
                ParameterList.Add(ddlSUBSIDY2_PAY_TYPE.SelectedValue);  //33.油價補貼 收取方式
                ParameterList.Add(ddlSUBSIDY2_RULE.SelectedValue);      //34.油價補貼 規則

                ParameterList.Add(rblSUBSIDY1_COUNT_TYPE.SelectedValue);//35.離島配送費 計算方式
                ParameterList.Add(slpSUBSIDY1_RATE.Text.Trim());        //36.離島配送費 費率
                ParameterList.Add(ddlSUBSIDY1_PAY_TYPE.SelectedValue);  //37.離島配送費 收取方式
                ParameterList.Add(ddlSUBSIDY1_RULE.SelectedValue);      //38.離島配送費 規則

                ParameterList.Add(rblSUBSIDY4_COUNT_TYPE.SelectedValue);//39.轉運費 計算方式

                //新增年度獎勵金
                ArrayList ArrList = new ArrayList();
                ArrList.Add(ds.Tables["Table_7"].Rows[0]["CNT_NO"].ToString());//V_OLD_CNT_NO
                ArrList.Add(GetValueSetParameter(ds.Tables["Table_7"].Rows[0]["EDIT_NO"].ToString(), "int", false));//N_OLD_EDIT_NO
                ArrList.Add(1);//N_OLD_ANNUAL_TYPE 固定給1
                ArrList.Add(ds.Tables["Table_7"].Rows[0]["UPDATEUID"].ToString());//V_OLD_UPDATEUID
                ArrList.Add(GetValueSetParameter(ds.Tables["Table_7"].Rows[0]["UPDATEDATE"].ToString(), "datetime", false));//D_OLD_UPDATEDATE
                ArrList.Add(ds.Tables["Table_7"].Rows[0]["CREATEUID"].ToString());//V_OLD_CREATEUID
                ArrList.Add(GetValueSetParameter(ds.Tables["Table_7"].Rows[0]["CREATEDATE"].ToString(), "datetime", false));//D_OLD_CREATEDATE

                ArrList.Add(txtCNT_NO.Text);//V_NEW_CNT_NO
                ArrList.Add(ds.Tables["Table_7"].Rows[0]["EDIT_NO"].ToString());//N_NEW_EDIT_NO(因畫面上無此欄位可供變更)
                ArrList.Add(1);//ANNUAL_TYPE 固定給1
                ArrList.Add(GetValueSetParameter(this.txtVENDOR_CODE.Text.Trim(), "string", false));
                ArrList.Add(GetValueSetParameter((rdoCOUNT_TYPE1.Checked ? "1" : "2"), "int", false));//COUNT_TYPE計算方式,1.全店群2.部份店群
                ArrList.Add(GetValueSetParameter(SLP_CodeFile4.Text.Trim(), "int", false));//PAY_TYPE收取方式(1:冊,2:成本,3:零售價,4:牌價,5:本體價)
                ArrList.Add(GetValueSetParameter(SLP_CodeFile3.SelectedValue, "int", false));//ANNUAL_RULE規則(廠商進+廠商退、廠商進-廠商退、廠商進、廠商退  、店群進+店群退、店群進-店群退、店群進、店群退) 
                ArrList.Add(DTime);//D_UPDATEDATE
                ArrList.Add(Session["UID"].ToString());//V_UPDATEUID

                //int N_ID;
                //string V_CODE;
                //string V_CNT_NO = "";

                //給店群門市的TARGET_NO值
                foreach (DataRow dr in ds.Tables["Table_3"].Rows)
                    if (dr.RowState != DataRowState.Deleted)
                        foreach (DataRow Dr in ds.Tables["Table_4"].Rows)
                            if (Dr.RowState != DataRowState.Deleted)
                                if (Dr["PID"].ToString() == dr["ID"].ToString())
                                    Dr["TARGET_NO"] = dr["TARGET_TYPE"];

                BCO.MaintainVendorAgm bco = new BCO.MaintainVendorAgm(ConntionDB);
                bco.UpdateVDM_Contract(ParameterList, ArrList, ds, null);

                ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "ClientScript", "alert('修改完成');", true);
                //資料要重新查詢,因為已異動過,若不重查,使用者於檢視頁按下編輯鈕後,再按修改審核、解除等按鈕時會產生資料已異動的錯誤
                Session.Remove("VDM022_" + PageTimeStamp.Value);
                BuildDataSet(); //建立DATATABLE架構
                ds.AcceptChanges();
                ds = QueryData(ViewState["CNT_NO"].ToString(), ViewState["EDIT_NO"].ToString(), false);

                //獎勵金的預設值
                btnCancel_1_Command(null, new CommandEventArgs("btnCancel_3", null));
                ReadOnlyMode();

                btnAdd_Mode.Visible = true;
                btnModify_Mode.Visible = true;
                btnCopy_Mode.Visible = true;
                btnDel.Visible = true;
                Session["VDM022_" + PageTimeStamp.Value] = ds;
                Cruise(txtCNT_NO.Text, ViewState["EDIT_NO"].ToString());//檢視模式的巡航鈕
                GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Delete, true, "", btnDel, WUI_GMToolbarV.ClickAction.ButtonClick);
                GMToolbar1.ButtonEnableControl(WUI_GMToolbarV.ButtonType.Save, false, "", btnAdd, 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();
            }
        }
        catch (Exception ex)
        {
            if (ex.Message.IndexOf("資料已被他人異動,資料更新失敗") != -1)
                ScriptManager.RegisterStartupScript(this, this.GetType(), "ClientScript", "alert('更新失敗,此資料已被其他使用者異動,請重新查詢再進行儲存');", true);
            else
            {
                ErrorMsgLabel.Text = ex.Message;
                UpdatePanel6.Update();
            }
        }
    }