protected void btn_SaveComment_Click(object sender, EventArgs e) { #region Button btnSave = sender as Button; Button btnEdit = (Button)FormView1.FindControl("btn_EditComment"); TextBox txt_Comment = (TextBox)FormView1.FindControl("txt_Comment"); STM_SLP_StoreChain SLP_StoreChain1 = (STM_SLP_StoreChain)FormView1.FindControl("SLP_StoreChain1"); PIC.VDS2G.WebUI.SLP.SLP_Store SLP_Store1 = (PIC.VDS2G.WebUI.SLP.SLP_Store)FormView1.FindControl("SLP_Store1"); string strMemo = hiddenMemo.Value.Trim(); if (SLP_StoreChain1.Text.Trim() != "" && SLP_Store1.Text.Trim() != "") { if (GetStringLen(strMemo) > 400) { ResultMsgLabel.Text = "備註限制200中文字"; //ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "ClientScript", "alert('備註限制200中文字');", true); } else { #region bool bResult = false; try { #region Data ArrayList ParameterList = new ArrayList();//20091112 ParameterList.Clear(); ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(SLP_StoreChain1.Text.Trim()); ParameterList.Add(SLP_Store1.Text.Trim()); ParameterList.Add(strMemo == "無設定備註" ? "" : strMemo); #endregion ALOModel.MaintainDisStoreMemo BCO = new ALOModel.MaintainDisStoreMemo(ConnectionDB); bResult = BCO.CreateStoreMemo(ParameterList, null); if (!bResult) { throw new Exception("更新0筆資料!"); } else { ResultMsgLabel.Text = "更改完成"; //ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "ClientScript", "alert('更改完成');", true); } txt_Comment.Text = GetMemoByChanAndStore(); } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } finally { btnEdit.Enabled = true; btnSave.Enabled = false; txt_Comment.ReadOnly = true; } #endregion } } else { if (SLP_StoreChain1.Text.Trim() == "") { ResultMsgLabel.Text = "通路不可空白"; //ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "ClientScript", "alert('通路不可空白');", true); } else if (SLP_Store1.Text.Trim() == "") { ResultMsgLabel.Text = "門市不可空白"; //ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "ClientScript", "alert('門市不可空白');", true); } } #endregion }
protected void btn_SaveComment_Click(object sender, EventArgs e) { #region if (SLP_StoreChain1.Text.Trim() != "" && SLP_Store1.Text.Trim() != "") { if (GetStringLen(txt_Comment.Text.Trim()) > 400) { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "ClientScript", "alert('備註限制200中文字');", true); } else { #region bool bResult = false; try { #region Data ArrayList ParameterList = new ArrayList();//20091112 ParameterList.Clear(); ParameterList.Add(Session["UID"].ToString()); ParameterList.Add(SLP_StoreChain1.Text.Trim()); ParameterList.Add(SLP_Store1.Text.Trim()); ParameterList.Add(strRemark.Trim() == "無設定備註" ? "" : strRemark.Trim()); #endregion ALOModel.MaintainDisStoreMemo BCO = new ALOModel.MaintainDisStoreMemo(ConnectionDB); bResult = BCO.CreateStoreMemo(ParameterList, null); if (!bResult) { throw new Exception("更新0筆資料!"); } else { CheckByChanAndStore(); //ScriptManager.RegisterStartupScript(UpdatePanel1, this.GetType(), "ClientScript", "alert('更改完成');", true); ResultMsgLabel.Text = "更改完成"; } } catch (Exception ex) { ErrorMsgLabel.Text = ex.Message; } finally { btn_EditComment.Enabled = true; btn_SaveComment.Enabled = false; txt_Comment.ReadOnly = true; } #endregion } } else { if (SLP_StoreChain1.Text.Trim() == "") { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "ClientScript", "alert('通路不可空白');", true); } else if (SLP_Store1.Text.Trim() == "") { ScriptManager.RegisterClientScriptBlock(UpdatePanel1, this.GetType(), "ClientScript", "alert('門市不可空白');", true); } } //20090716 added if (CurrentPageMode == PageCurrentMode.Query || CurrentPageMode == PageCurrentMode.Readonly) { ScriptManager.RegisterStartupScript(this, this.GetType(), "", string.Format("SwitchControlDisplay('{0}','',0);", PanelMasterAndDetail.ClientID), true); } #endregion }