/// <summary> /// 按下彈出視窗[取消]按鈕 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnCancel_Click(object sender, EventArgs e) { Dictionary <string, string> dicContext = Util.getDictionary(ucModalPopup1.ucContextData); Util_ucGridView oView = (Util_ucGridView)Util.FindControlEx(this, dicContext["SourceView"]); oView.Visible = true; oView.Refresh(); }
/// <summary> /// 按下彈出視窗[確定]按鈕 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnOK_Click(object sender, EventArgs e) { DbHelper db = new DbHelper(LegalSample._LegalSysDBName); CommandHelper sb = db.CreateCommandHelper(); UserInfo oUser = UserInfo.getUserInfo(); Dictionary <string, string> dicContext = Util.getDictionary(ucModalPopup1.ucContextData); Util_ucGridView oView = (Util_ucGridView)Util.FindControlEx(this, dicContext["SourceView"]); switch (dicContext["Mode"].ToUpper()) { case "ADD": sb.Reset(); sb.AppendStatement("Insert LegalDocKind "); sb.Append("(KindNo,KindName,IsEnabled,ParentKindNo,Remark,UpdUser,UpdUserName,UpdDateTime)"); sb.Append(" Values (").AppendParameter("KindNo", ucKindNo.ucTextData); sb.Append(" ,").AppendParameter("KindName", ucKindName.ucTextData); sb.Append(" ,").AppendParameter("IsEnabled", ddlIsEnabled.SelectedValue); sb.Append(" ,").AppendParameter("ParentKindNo", dicContext["ParentKindNo"]); sb.Append(" ,").AppendParameter("Remark", ucRemark.ucTextData); sb.Append(" ,").AppendParameter("UpdUser", oUser.UserID); sb.Append(" ,").AppendParameter("UpdUserName", oUser.UserName); sb.Append(" ,").AppendDbDateTime(); sb.Append(")"); try { db.ExecuteNonQuery(sb.BuildCommand()); Util.NotifyMsg(RS.Resources.Msg_AddSucceed, Util.NotifyKind.Success); oView.Visible = true; oView.Refresh(true); } catch { oView.Visible = true; oView.Refresh(); Util.NotifyMsg(RS.Resources.Msg_AddFail, Util.NotifyKind.Error); } break; case "EDIT": sb.Reset(); sb.AppendStatement(" Update LegalDocKind Set KindName = ").AppendParameter("KindName", ucKindName.ucTextData); sb.Append(" ,IsEnabled = ").AppendParameter("IsEnabled", ddlIsEnabled.SelectedValue); sb.Append(" ,Remark = ").AppendParameter("Remark", ucRemark.ucTextData); sb.Append(" ,UpdUser = "******"UpdUser", oUser.UserID); sb.Append(" ,UpdUserName = "******"UpdUserName", oUser.UserName); sb.Append(" ,UpdDateTime = ").AppendDbDateTime(); sb.Append(" Where KindNo = ").AppendParameter("KindNo", ucKindNo.ucTextData); sb.Append(" and ParentKindNo = ").AppendParameter("ParentKindNo", dicContext["ParentKindNo"]); try { db.ExecuteNonQuery(sb.BuildCommand()); Util.NotifyMsg(RS.Resources.Msg_EditSucceed, Util.NotifyKind.Success); oView.Visible = true; oView.Refresh(true); } catch { oView.Visible = true; oView.Refresh(); Util.NotifyMsg(RS.Resources.Msg_EditFail, Util.NotifyKind.Error); } break; default: Util.MsgBox(string.Format(RS.Resources.Msg_Undefined1, dicContext["Mode"])); break; } }