void ucGridView1_RowCommand(object sender, Util_ucGridView.RowCommandEventArgs e) { switch (e.CommandName) { case "cmdSelect": ucModalPopup1.ucPopupWidth = 750; ucModalPopup1.ucPopupHeight = 550; ucModalPopup1.ucFrameURL = "DocAdmin.aspx?QryMode=Y&DocNo=" + e.DataKeys[0]; ucModalPopup1.Show(); break; default: break; } }
void ucGridView1_RowCommand(object sender, Util_ucGridView.RowCommandEventArgs e) { switch (e.CommandName) { case "cmdSelect": ucModalPopup1.ucPopupWidth = 770; ucModalPopup1.ucPopupHeight = 600; ucModalPopup1.ucFrameURL = "CaseInfo.aspx?CaseNo=" + e.DataKeys[0]; ucModalPopup1.Show(); break; default: break; } }
void ucKind2_RowCommand(object sender, Util_ucGridView.RowCommandEventArgs e) { string strKindNo = (e.DataKeys != null) ? e.DataKeys[0] : ""; Dictionary <string, string> dicContext = new Dictionary <string, string>(); switch (e.CommandName) { case "cmdAdd": ucKind2.Visible = true; dicContext.Clear(); dicContext.Add("Mode", "Add"); dicContext.Add("KindNo", strKindNo); dicContext.Add("SourceView", "ucKind2"); dicContext.Add("ParentKindNo", ucCascadingKind1.ucSelectedValue01); LaunchPopup(dicContext); break; case "cmdEdit": ucKind1.Visible = true; dicContext.Clear(); dicContext.Add("Mode", "Edit"); dicContext.Add("KindNo", strKindNo); dicContext.Add("SourceView", "ucKind2"); dicContext.Add("ParentKindNo", ucCascadingKind1.ucSelectedValue01); LaunchPopup(dicContext); break; case "cmdSelect": TabContainer1.ActiveTabIndex = 2; ucCascadingKind2.ucDefaultSelectedValue01 = ucCascadingKind1.ucSelectedValue01; ucCascadingKind2.ucDefaultSelectedValue02 = strKindNo; RefreshKind3(true, strKindNo); break; case "cmdDelete": DeleteDocKind(strKindNo); ucKind2.Visible = true; break; default: Util.MsgBox(RS.Resources.Msg_Undefined1, e.CommandName); break; } }
/// <summary> /// 資料清單執行命令 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void ucGridView1_RowCommand(object sender, Util_ucGridView.RowCommandEventArgs e) { DbHelper db = new DbHelper(_DBName); DataTable dt = null; CommandHelper sb = db.CreateCommandHelper(); string[] oDataKeys = e.DataKeys; switch (e.CommandName) { case "cmdAdd": //新增模式 divMainGridview.Visible = false; fmMain.ChangeMode(FormViewMode.Insert); fmMain.DataSource = null; fmMain.DataBind(); divMainFormView.Visible = true; break; case "cmdCopy": //資料複製 sb.Reset(); sb.AppendStatement(string.Format("Select * From {0} Where 0 = 0 ", _TableName)); sb.Append(Util.getDataQueryKeySQL(_PKList, oDataKeys)); dt = db.ExecuteDataSet(sb.BuildCommand()).Tables[0]; divMainGridview.Visible = false; fmMain.ChangeMode(FormViewMode.Insert); fmMain.DataSource = dt; fmMain.DataBind(); divMainFormView.Visible = true; break; case "cmdEdit": //資料編輯 divMainGridview.Visible = false; sb.Reset(); sb.AppendStatement(string.Format("Select * From {0} Where 0 = 0 ", _TableName)); sb.Append(Util.getDataQueryKeySQL(_PKList, oDataKeys)); dt = db.ExecuteDataSet(sb.BuildCommand()).Tables[0]; fmMain.ChangeMode(FormViewMode.Edit); fmMain.DataSource = dt; fmMain.DataBind(); divMainFormView.Visible = true; break; case "cmdDelete": //資料刪除 sb.Reset(); sb.AppendStatement(string.Format("Delete From {0} Where 0 = 0 ", _TableName)); sb.Append(Util.getDataQueryKeySQL(_PKList, oDataKeys)); if (db.ExecuteNonQuery(sb.BuildCommand()) > 0) { Util.NotifyMsg(RS.Resources.Msg_DeleteSucceed, Util.NotifyKind.Success); //刪除成功 } else { Util.NotifyMsg(RS.Resources.Msg_DeleteFail, Util.NotifyKind.Error); //刪除失敗 } break; default: Util.MsgBox(string.Format(RS.Resources.Msg_Undefined1, e.CommandName)); //無此命令 break; } }
/// <summary> /// GridView RowCommand 事件訂閱 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void ucGridView1_RowCommand(object sender, Util_ucGridView.RowCommandEventArgs e) { DbHelper db = new DbHelper(LegalSample._LegalSysDBName); DataTable dt = null; CommandHelper sb = db.CreateCommandHelper(); var AppKey = new Tuple <string[], string>(new string[] { "" }, ""); string strNewDocNo = ""; string[] oDataKeys = e.DataKeys; switch (e.CommandName) { case "cmdAdd": //新增模式 divMainGridview.Visible = false; AppKey = Util.getAppKey(LegalSample._LegalSysDBName, LegalSample._LegalDocTableName); if (string.IsNullOrEmpty(AppKey.Item2)) { strNewDocNo = AppKey.Item1[0]; UserInfo oUser = UserInfo.getUserInfo(); sb.Reset(); sb.AppendStatement(string.Format("Insert {0} ", LegalSample._LegalDocTableName)); sb.Append("(DocNo,IsRelease,Subject,CrUser,CrUserName,CrDateTime,UpdUser,UpdUserName,UpdDateTime)"); sb.Append(" Values (").AppendParameter("DocNo", strNewDocNo); sb.Append(" ,").AppendParameter("IsRelease", "N"); sb.Append(" ,").AppendParameter("Subject", "New Doc"); sb.Append(" ,").AppendParameter("CrUser", oUser.UserID); sb.Append(" ,").AppendParameter("CrUserName", oUser.UserName); sb.Append(" ,").AppendDbDateTime(); sb.Append(" ,").AppendParameter("CrUser", oUser.UserID); sb.Append(" ,").AppendParameter("CrUserName", oUser.UserName); sb.Append(" ,").AppendDbDateTime(); sb.Append(")"); if (db.ExecuteNonQuery(sb.BuildCommand()) > 0) { dt = db.ExecuteDataSet(CommandType.Text, string.Format("Select * From {0} Where DocNo = '{1}' ", LegalSample._LegalDocTableName, strNewDocNo)).Tables[0]; divMainGridview.Visible = false; fmMain.ChangeMode(FormViewMode.Edit); fmMain.DataSource = dt; fmMain.DataBind(); divMainFormView.Visible = true; //新增成功,直接編輯 Util.NotifyMsg(RS.Resources.Msg_AddSucceed_Edit, Util.NotifyKind.Success); } else { //新增失敗 Util.NotifyMsg(RS.Resources.Msg_AddFail, Util.NotifyKind.Error); } } else { //取 CaseNo 失敗 Util.MsgBox(AppKey.Item2); } break; case "cmdCopy": //資料複製 AppKey = Util.getAppKey(LegalSample._LegalSysDBName, LegalSample._LegalDocTableName); strNewDocNo = ""; if (string.IsNullOrEmpty(AppKey.Item2)) { strNewDocNo = AppKey.Item1[0]; string strSQL = Util.getDataCopySQL(LegalSample._LegalSysDBName, "DocNo".Split(','), e.DataKeys[0].Split(','), strNewDocNo.Split(','), LegalSample._LegalDocTableName.Split(',')); try { strSQL += string.Format(";Update {0} set CrDateTime = getdate(),UpdDateTime = getdate() Where DocNo = '{1}' ;", LegalSample._LegalDocTableName, strNewDocNo); db.ExecuteNonQuery(CommandType.Text, strSQL); //複製成功,直接切到編輯模式 divMainGridview.Visible = false; sb.Reset(); sb.AppendStatement(string.Format("Select * From {0} Where DocNo = ", LegalSample._LegalDocTableName)).AppendParameter("DocNo", strNewDocNo); dt = db.ExecuteDataSet(sb.BuildCommand()).Tables[0]; fmMain.ChangeMode(FormViewMode.Edit); fmMain.DataSource = dt; fmMain.DataBind(); divMainFormView.Visible = true; //複製成功 Util.NotifyMsg(string.Format(RS.Resources.Msg_CopySucceed_Edit1, strNewDocNo), Util.NotifyKind.Success); } catch { //複製失敗 Util.NotifyMsg(RS.Resources.Msg_CopyFail, Util.NotifyKind.Error); } } else { Util.MsgBox(AppKey.Item2); } break; case "cmdEdit": //資料編輯 sb.Reset(); sb.AppendStatement(string.Format("Select * From {0} Where DocNo = ", LegalSample._LegalDocTableName)).AppendParameter("DocNo", oDataKeys[0]); dt = db.ExecuteDataSet(sb.BuildCommand()).Tables[0]; DataRow dr = dt.Rows[0]; fmMain.ChangeMode(FormViewMode.Edit); fmMain.DataSource = dt; fmMain.DataBind(); divMainGridview.Visible = false; divMainFormView.Visible = true; break; case "cmdDelete": //資料刪除 sb.Reset(); sb.AppendStatement(string.Format("Delete {0} Where DocNo = ", LegalSample._LegalDocTableName)).AppendParameter("DocNo", oDataKeys[0]); if (db.ExecuteNonQuery(sb.BuildCommand()) > 0) { //刪除成功 Util.NotifyMsg(RS.Resources.Msg_DeleteSucceed, Util.NotifyKind.Success); } else { //刪除失敗 Util.NotifyMsg(RS.Resources.Msg_DeleteFail, Util.NotifyKind.Error); } break; default: //未定義 Util.MsgBox(string.Format(RS.Resources.Msg_Undefined1, e.CommandName)); break; } }
void ucGridDetail_RowCommand(object sender, Util_ucGridView.RowCommandEventArgs e) { //承接明細檔 GridView 按鈕事件 DbHelper db = new DbHelper(_DBName); CommandHelper sb = db.CreateCommandHelper(); string[] oDataKeys = e.DataKeys; if (oDataKeys != null) { _RuleID = oDataKeys[0]; _AreaID = oDataKeys[1]; _GrantID = oDataKeys[2]; } ucModalPopup1.Reset(); ucModalPopup1.ucPopupWidth = 640; ucModalPopup1.ucPopupHeight = 320; ucModalPopup1.ucPopupHeader = "項目設定"; ucModalPopup1.ucPanelID = pnlDetailForm.ID; //處理按鈕命令 switch (e.CommandName) { case "cmdAdd": fmDetail.ChangeMode(FormViewMode.Insert); fmDetail.DataSource = null; fmDetail.DataBind(); Util.setJS_AlertDirtyData(fmDetail); ucModalPopup1.Show(); break; case "cmdCopy": sb.Reset(); sb.AppendStatement("Select * From AclAdminRuleAreaGrantList Where 0=0 "); sb.Append(" And RuleID = ").AppendParameter("RuleID", _RuleID); sb.Append(" And AreaID = ").AppendParameter("AreaID", _AreaID); sb.Append(" And GrantID = ").AppendParameter("GrantID", _GrantID); fmDetail.ChangeMode(FormViewMode.Insert); fmDetail.DataSource = db.ExecuteDataSet(sb.BuildCommand()).Tables[0]; fmDetail.DataBind(); Util.setJS_AlertDirtyData(fmDetail); ucModalPopup1.Show(); break; case "cmdEdit": sb.Reset(); sb.AppendStatement("Select * From AclAdminRuleAreaGrantList Where 0=0 "); sb.Append(" And RuleID = ").AppendParameter("RuleID", _RuleID); sb.Append(" And AreaID = ").AppendParameter("AreaID", _AreaID); sb.Append(" And GrantID = ").AppendParameter("GrantID", _GrantID); fmDetail.ChangeMode(FormViewMode.Edit); fmDetail.DataSource = db.ExecuteDataSet(sb.BuildCommand()).Tables[0]; fmDetail.DataBind(); Util.setJS_AlertDirtyData(fmDetail); ucModalPopup1.Show(); break; case "cmdDelete": try { Dictionary <string, string> dicKey = new Dictionary <string, string>(); dicKey.Clear(); dicKey.Add("RuleID", _RuleID); dicKey.Add("AreaID", _AreaID); dicKey.Add("GrantID", _GrantID); AclExpress.IsAclTableLog("AclAdminRuleAreaGrantList", dicKey, LogHelper.AppTableLogType.Delete); sb.Reset(); sb.AppendStatement("Delete From AclAdminRuleAreaGrantList Where 0=0 "); sb.Append(" And RuleID = ").AppendParameter("RuleID", _RuleID); sb.Append(" And AreaID = ").AppendParameter("AreaID", _AreaID); sb.Append(" And GrantID = ").AppendParameter("GrantID", _GrantID); db.ExecuteNonQuery(sb.BuildCommand()); _GrantID = ""; Util.NotifyMsg(RS.Resources.Msg_DeleteSucceed, Util.NotifyKind.Success); } catch { Util.NotifyMsg(RS.Resources.Msg_DeleteFail, Util.NotifyKind.Error); } break; default: //未定義的命令 Util.MsgBox(string.Format(RS.Resources.Msg_Undefined1, e.CommandName)); break; } fmMainRefresh(); }
void ucGridMain_RowCommand(object sender, Util_ucGridView.RowCommandEventArgs e) { DbHelper db = new DbHelper(_DBName); CommandHelper sb = db.CreateCommandHelper(); //處理自訂命令,AP 可視需要自行增加想要的 CommandName switch (e.CommandName) { case "cmdAdd": _IsADD = true; _RuleID = ""; _AreaID = ""; Refresh(true, true); break; case "cmdCopy": _IsADD = true; _RuleID = e.DataKeys[0]; _AreaID = e.DataKeys[1]; Refresh(true, true); break; case "cmdDelete": _IsADD = false; _RuleID = ""; _AreaID = ""; _GrantID = ""; try { Dictionary <string, string> dicKey = new Dictionary <string, string>(); dicKey.Clear(); dicKey.Add("RuleID", e.DataKeys[0]); dicKey.Add("AreaID", e.DataKeys[1]); AclExpress.IsAclTableLog("AclAdminRuleArea", dicKey, LogHelper.AppTableLogType.Delete); AclExpress.IsAclTableLog("AclAdminRuleAreaGrantList", dicKey, LogHelper.AppTableLogType.Delete); sb.Reset(); sb.AppendStatement("Delete AclAdminRuleAreaGrantList Where RuleID = ").AppendParameter("RuleID", e.DataKeys[0]); sb.Append(" and AreaID = ").AppendParameter("AreaID", e.DataKeys[1]); sb.AppendStatement("Delete AclAdminRuleArea Where RuleID = ").AppendParameter("RuleID", e.DataKeys[0]); sb.Append(" and AreaID = ").AppendParameter("AreaID", e.DataKeys[1]); db.ExecuteNonQuery(sb.BuildCommand()); Util.NotifyMsg(RS.Resources.Msg_DeleteSucceed, Util.NotifyKind.Success); } catch { Util.NotifyMsg(RS.Resources.Msg_DeleteFail, Util.NotifyKind.Error); } break; case "cmdEdit": case "cmdSelect": _IsADD = false; _RuleID = e.DataKeys[0]; _AreaID = e.DataKeys[1]; _GrantID = ""; Refresh(false, true); break; case "cmdDownload": //Data Dump 2016.11.08 string strHeader = string.Format("[{0} - {1}] 資料轉儲 SQL", e.DataKeys[0], e.DataKeys[1]); string strDataFilter = string.Format(" RuleID = '{0}' and AreaID = '{1}' ", e.DataKeys[0], e.DataKeys[1]); string strDumpSQL = string.Empty; strDumpSQL += "/* ==================================================================== */ \n"; strDumpSQL += string.Format("/* {0} on [{1}] */ \n", strHeader, DateTime.Now); strDumpSQL += "/* ==================================================================== */ \n"; strDumpSQL += string.Format("Use {0} \nGo\n", AclExpress._AclDBName); strDumpSQL += "/* ==================== */ \n"; strDumpSQL += "/* AclAdminRuleArea 相關物件 */ \n"; strDumpSQL += "/* ==================== */ \n"; strDumpSQL += Util.getDataDumpSQL(AclExpress._AclDBName, "AclAdminRuleArea", strDataFilter); strDumpSQL += "\n"; strDumpSQL += "/* ==================== */ \n"; strDumpSQL += "/* AclAdminRuleAreaGrantList 相關物件 */ \n"; strDumpSQL += "/* ==================== */ \n"; strDumpSQL += Util.getDataDumpSQL(AclExpress._AclDBName, "AclAdminRuleAreaGrantList", strDataFilter); txtDumpSQL.ucTextData = strDumpSQL; ucModalPopup1.Reset(); ucModalPopup1.ucPopupWidth = 850; ucModalPopup1.ucPopupHeight = 600; ucModalPopup1.ucPopupHeader = strHeader; ucModalPopup1.ucPanelID = pnlDumpSQL.ID; ucModalPopup1.Show(); break; default: Util.MsgBox(string.Format("cmd=[{0}],key=[{1}]", e.CommandName, Util.getStringJoin(e.DataKeys))); break; } }
/// <summary> /// 資料清單執行命令 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void ucGridView1_RowCommand(object sender, Util_ucGridView.RowCommandEventArgs e) { DbHelper db = new DbHelper(_DBName); DataTable dt = null; CommandHelper sb = db.CreateCommandHelper(); string[] oDataKeys = e.DataKeys; switch (e.CommandName) { case "cmdAdd": //新增模式 divMainGridview.Visible = false; fmMain.ChangeMode(FormViewMode.Insert); fmMain.DataSource = null; fmMain.DataBind(); divMainFormView.Visible = true; break; case "cmdCopy": //資料複製 sb.Reset(); sb.AppendStatement(string.Format("Select * From {0} Where 0 = 0 ", _TableName)); sb.Append(Util.getDataQueryKeySQL(_PKFieldList, oDataKeys)); dt = db.ExecuteDataSet(sb.BuildCommand()).Tables[0]; divMainGridview.Visible = false; fmMain.ChangeMode(FormViewMode.Insert); fmMain.DataSource = dt; fmMain.DataBind(); divMainFormView.Visible = true; break; case "cmdEdit": //資料編輯 divMainGridview.Visible = false; sb.Reset(); sb.AppendStatement(string.Format("Select * From {0} Where 0 = 0 ", _TableName)); sb.Append(Util.getDataQueryKeySQL(_PKFieldList, oDataKeys)); dt = db.ExecuteDataSet(sb.BuildCommand()).Tables[0]; fmMain.ChangeMode(FormViewMode.Edit); fmMain.DataSource = dt; fmMain.DataBind(); divMainFormView.Visible = true; break; case "cmdDelete": //資料刪除 sb.Reset(); sb.AppendStatement(string.Format("Delete From {0} Where 0 = 0 ", _TableName)); sb.Append(Util.getDataQueryKeySQL(_PKFieldList, oDataKeys)); if (db.ExecuteNonQuery(sb.BuildCommand()) > 0) { Util.NotifyMsg(RS.Resources.Msg_DeleteSucceed, Util.NotifyKind.Success); //刪除成功 PageViewState["_Dic_DefaultEnabledNodeID"] = null; PageViewState["_Dic_ParentNodeID"] = null; } else { Util.NotifyMsg(RS.Resources.Msg_DeleteFail, Util.NotifyKind.Error); //刪除失敗 } break; case "cmdMultilingual": string strURL = string.Format("{0}?DBName={1}&TableName={2}&PKFieldList={3}&PKValueList={4}", Util._MuiAdminUrl, _DBName, _TableName, Util.getStringJoin(_PKFieldList), Util.getStringJoin(e.DataKeys)); ucModalPopup1.Reset(); ucModalPopup1.ucFrameURL = strURL; ucModalPopup1.ucPopupWidth = 650; ucModalPopup1.ucPopupHeight = 350; ucModalPopup1.ucBtnCloselEnabled = true; ucModalPopup1.Show(); break; default: Util.MsgBox(string.Format(RS.Resources.Msg_Undefined1, e.CommandName)); //無此命令 break; } }
void ucGridView1_RowCommand(object sender, Util_ucGridView.RowCommandEventArgs e) { DbHelper db = new DbHelper(_DBName); CommandHelper sb = db.CreateCommandHelper(); string strDataKeys = (e.DataKeys != null) ? Util.getStringJoin(e.DataKeys) : ""; Dictionary <string, string> dicContext = new Dictionary <string, string>(); switch (e.CommandName) { case "cmdAdd": dicContext.Clear(); dicContext.Add("Mode", "Add"); dicContext.Add("DataKeys", strDataKeys); LaunchPopup(dicContext); break; case "cmdEdit": dicContext.Clear(); dicContext.Add("Mode", "Edit"); dicContext.Add("DataKeys", strDataKeys); LaunchPopup(dicContext); break; case "cmdCopy": dicContext.Clear(); dicContext.Add("Mode", "Copy"); dicContext.Add("DataKeys", strDataKeys); LaunchPopup(dicContext); break; case "cmdDelete": if (string.IsNullOrEmpty(strDataKeys)) { Util.MsgBox(Util.getHtmlMessage(Util.HtmlMessageKind.ParaDataError)); return; } else { try { //2016.06.28 新增 if (!string.IsNullOrEmpty(_LogDBName)) { Dictionary <string, string> dicKey = new Dictionary <string, string>(); dicKey.Clear(); dicKey.Add("TabName", strDataKeys.Split(',')[0]); dicKey.Add("FldName", strDataKeys.Split(',')[1]); dicKey.Add("Value", strDataKeys.Split(',')[2]); LogHelper.WriteAppTableLog(_DBName, _LogDBName, _TableName, dicKey, LogHelper.AppTableLogType.Delete); } sb.Reset(); sb.AppendStatement(string.Format("Delete {0} ", _TableName)); sb.Append(" Where TabName = ").AppendParameter("TabName", strDataKeys.Split(',')[0]); sb.Append(" And FldName = ").AppendParameter("FldName", strDataKeys.Split(',')[1]); sb.Append(" And Value = ").AppendParameter("Value", strDataKeys.Split(',')[2]); db.ExecuteNonQuery(sb.BuildCommand()); Util.NotifyMsg(RS.Resources.Msg_DeleteSucceed, Util.NotifyKind.Success); PageViewState["_Dic_TabList"] = null; qryTabName.ucSourceDictionary = _Dic_TabList; qryTabName.ucSelectedID = ""; if (!string.IsNullOrEmpty(_TabName)) { if (_Dic_TabList.ContainsKey(_TabName)) { qryTabName.ucSelectedID = _TabName; } qryTabName.ucIsReadOnly = true; } qryTabName.Refresh(); } catch (Exception ex) { Util.MsgBox(Util.getHtmlMessage(Util.HtmlMessageKind.Error, ex.ToString())); } } break; case "cmdMultilingual": string strURL = string.Format("{0}?DBName={1}&TableName={2}&PKFieldList={3}&PKValueList={4}", Util._MuiAdminUrl, _DBName, _TableName, _PKFieldList, Util.getStringJoin(e.DataKeys)); ucModalPopup1.Reset(); ucModalPopup1.ucFrameURL = strURL; ucModalPopup1.ucPopupWidth = 650; ucModalPopup1.ucPopupHeight = 350; ucModalPopup1.ucBtnCloselEnabled = true; ucModalPopup1.Show(); break; case "cmdDataDump": //Data Dump 2016.11.08 string tmpKey = (!string.IsNullOrEmpty(_TabName)) ? _TabName : qryTabName.ucSelectedID; string strHeader = string.Format("[CodeMap] {0} 資料轉儲 SQL", (!string.IsNullOrEmpty(tmpKey)) ? "[" + tmpKey + "]" : ""); string strDataFilter = (!string.IsNullOrEmpty(tmpKey)) ? string.Format(" TabName = '{0}' ", tmpKey) : ""; string strDumpSQL = string.Empty; strDumpSQL += "/* ==================================================================== */ \n"; strDumpSQL += string.Format("/* {0} on [{1}] */ \n", strHeader, DateTime.Now); strDumpSQL += "/* ==================================================================== */ \n"; strDumpSQL += string.Format("Use {0} \nGo\n", (string.IsNullOrEmpty(_DBName)) ? Util.getAppSetting("app://CfgDefConnDB/") : _DBName); strDumpSQL += "/* ==================== */ \n"; strDumpSQL += "/* CodeMap 相關物件 */ \n"; strDumpSQL += "/* ==================== */ \n"; strDumpSQL += Util.getDataDumpSQL((string.IsNullOrEmpty(_DBName)) ? Util.getAppSetting("app://CfgDefConnDB/") : _DBName, _TableName, strDataFilter); txtDumpSQL.ucTextData = strDumpSQL; ucModalPopup1.Reset(); ucModalPopup1.ucPopupWidth = 850; ucModalPopup1.ucPopupHeight = 600; ucModalPopup1.ucPopupHeader = strHeader; ucModalPopup1.ucPanelID = pnlDumpSQL.ID; ucModalPopup1.Show(); break; default: Util.MsgBox(string.Format(RS.Resources.Msg_Undefined1, e.CommandName)); break; } }
void ucGridDetail_RowCommand(object sender, Util_ucGridView.RowCommandEventArgs e) { //承接明細檔 GridView 按鈕事件 DbHelper db = new DbHelper(_DBName); CommandHelper sb = db.CreateCommandHelper(); string[] oDataKeys = e.DataKeys; if (oDataKeys != null) { _RuleID = oDataKeys[0]; _ChkGrpNo = int.Parse(oDataKeys[1]); _ChkSeqNo = int.Parse(oDataKeys[2]); } ucModalPopup1.Reset(); ucModalPopup1.ucPopupWidth = 640; ucModalPopup1.ucPopupHeight = 320; ucModalPopup1.ucPopupHeader = "條件設定"; ucModalPopup1.ucPanelID = pnlDetailForm.ID; //處理按鈕命令 switch (e.CommandName) { case "cmdAdd": fmDetail.ChangeMode(FormViewMode.Insert); fmDetail.DataSource = null; fmDetail.DataBind(); Util.setJS_AlertDirtyData(fmDetail); ucModalPopup1.Show(); break; case "cmdCopy": sb.Reset(); sb.AppendStatement("Select * From AclRuleExp Where 0=0 "); sb.Append(" And RuleID = ").AppendParameter("RuleID", _RuleID); sb.Append(" And ChkGrpNo = ").AppendParameter("ChkGrpNo", _ChkGrpNo); sb.Append(" And ChkSeqNo = ").AppendParameter("ChkSeqNo", _ChkSeqNo); fmDetail.ChangeMode(FormViewMode.Insert); fmDetail.DataSource = db.ExecuteDataSet(sb.BuildCommand()).Tables[0]; fmDetail.DataBind(); Util.setJS_AlertDirtyData(fmDetail); ucModalPopup1.Show(); break; case "cmdEdit": sb.Reset(); sb.AppendStatement("Select * From AclRuleExp Where 0=0 "); sb.Append(" And RuleID = ").AppendParameter("RuleID", _RuleID); sb.Append(" And ChkGrpNo = ").AppendParameter("ChkGrpNo", _ChkGrpNo); sb.Append(" And ChkSeqNo = ").AppendParameter("ChkSeqNo", _ChkSeqNo); fmDetail.ChangeMode(FormViewMode.Edit); fmDetail.DataSource = db.ExecuteDataSet(sb.BuildCommand()).Tables[0]; fmDetail.DataBind(); Util.setJS_AlertDirtyData(fmDetail); ucModalPopup1.Show(); break; case "cmdDelete": try { Dictionary <string, string> dicKey = new Dictionary <string, string>(); dicKey.Clear(); dicKey.Add("RuleID", _RuleID); dicKey.Add("ChkGrpNo", _ChkGrpNo.ToString()); dicKey.Add("ChkSeqNo", _ChkSeqNo.ToString()); AclExpress.IsAclTableLog("AclRuleExp", dicKey, LogHelper.AppTableLogType.Delete); sb.Reset(); sb.AppendStatement("Delete From AclRuleExp Where 0=0 "); sb.Append(" And RuleID = ").AppendParameter("RuleID", _RuleID); sb.Append(" And ChkGrpNo = ").AppendParameter("ChkGrpNo", _ChkGrpNo); sb.Append(" And ChkSeqNo = ").AppendParameter("ChkSeqNo", _ChkSeqNo); db.ExecuteNonQuery(sb.BuildCommand()); _ChkGrpNo = 0; _ChkSeqNo = 0; Util.NotifyMsg(RS.Resources.Msg_DeleteSucceed, Util.NotifyKind.Success); } catch { Util.NotifyMsg(RS.Resources.Msg_DeleteFail, Util.NotifyKind.Error); } break; case "cmdMultilingual": sb.Reset(); sb.AppendStatement("Select ChkCodeMapFldName From AclRuleExp Where 0=0 "); sb.Append(" And RuleID = ").AppendParameter("RuleID", _RuleID); sb.Append(" And ChkGrpNo = ").AppendParameter("ChkGrpNo", _ChkGrpNo); sb.Append(" And ChkSeqNo = ").AppendParameter("ChkSeqNo", _ChkSeqNo); string strFldName = db.ExecuteDataSet(sb.BuildCommand()).Tables[0].Rows[0][0].ToString(); if (string.IsNullOrEmpty(strFldName)) { Util.MsgBox("「對照表欄位」尚未設定!"); } else { ucModalPopup1.Reset(); ucModalPopup1.ucPopupWidth = 820; ucModalPopup1.ucPopupHeight = 650; ucModalPopup1.ucPopupHeader = "對照表資料維護"; ucModalPopup1.ucFrameURL = string.Format("{0}?DBName={1}&LogDBName={2}&TabName={3}&FldName={4}", Util._CodeMapAdminUrl, AclExpress._AclDBName, AclExpress._AclLogDBName, _RuleID, strFldName); ucModalPopup1.Show(); } break; default: //未定義的命令 Util.MsgBox(string.Format(RS.Resources.Msg_Undefined1, e.CommandName)); break; } fmMainRefresh(); }
/// <summary> /// gvProxyTodoList 呼叫單筆審核 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void gvProxyTodoList_RowCommand(object sender, Util_ucGridView.RowCommandEventArgs e) { StartSingleVerify(HttpUtility.HtmlEncode(e.DataKeys[0]), HttpUtility.HtmlEncode(e.DataKeys[1]), HttpUtility.HtmlEncode(e.DataKeys[2])); }
void ucGridView1_RowCommand(object sender, Util_ucGridView.RowCommandEventArgs e) { //Util.MsgBox(e.CommandName); switch (e.CommandName) { case "cmdSelect": Response.Redirect(string.Format("FlowSpec.aspx?FlowID={0}", HttpUtility.HtmlEncode(e.DataKeys[0]))); break; case "cmdCopy": hidFlowID.Value = e.DataKeys[0]; FlowExpress oFlow = new FlowExpress(e.DataKeys[0], null, false, false); txtNewFlowID.ucTextData = "Cpy-" + oFlow.FlowID.Left(15); txtNewFlowName.ucTextData = "Cpy-" + oFlow.FlowName; txtNewFlowID.ucDispEnteredWordsObjClientID = cntNewFlowID.ClientID; txtNewFlowID.ucIsDispEnteredWords = true; txtNewFlowID.Refresh(); txtNewFlowName.ucDispEnteredWordsObjClientID = cntNewFlowName.ClientID; txtNewFlowName.ucIsDispEnteredWords = true; txtNewFlowName.Refresh(); ucModalPopup1.Reset(); ucModalPopup1.ucPopupWidth = 450; ucModalPopup1.ucPopupHeight = 180; ucModalPopup1.ucPopupHeader = "複製流程"; ucModalPopup1.ucPanelID = pnlNewFlow.ID; ucModalPopup1.Show(); break; case "cmdAdd": hidFlowID.Value = ""; txtNewFlowID.ucTextData = "New-ID"; txtNewFlowName.ucTextData = "New-Name"; txtNewFlowID.ucDispEnteredWordsObjClientID = cntNewFlowID.ClientID; txtNewFlowID.ucIsDispEnteredWords = true; txtNewFlowID.Refresh(); txtNewFlowName.ucDispEnteredWordsObjClientID = cntNewFlowName.ClientID; txtNewFlowName.ucIsDispEnteredWords = true; txtNewFlowName.Refresh(); ucModalPopup1.Reset(); ucModalPopup1.ucPopupWidth = 450; ucModalPopup1.ucPopupHeight = 180; ucModalPopup1.ucPopupHeader = "新增流程"; ucModalPopup1.ucPanelID = pnlNewFlow.ID; ucModalPopup1.Show(); break; case "cmdDelete": DbHelper db = new DbHelper(FlowExpress._FlowSysDB); CommandHelper sb = db.CreateCommandHelper(); sb.Reset(); sb.AppendStatement("Delete FlowSpec Where FlowID =").AppendParameter("FlowID", e.DataKeys[0]); sb.AppendStatement("Delete FlowSpec_MUI Where FlowID =").AppendParameter("FlowID", e.DataKeys[0]); sb.AppendStatement("Delete FlowStep Where FlowID =").AppendParameter("FlowID", e.DataKeys[0]); sb.AppendStatement("Delete FlowStep_MUI Where FlowID =").AppendParameter("FlowID", e.DataKeys[0]); sb.AppendStatement("Delete FlowStepBtn Where FlowID =").AppendParameter("FlowID", e.DataKeys[0]); sb.AppendStatement("Delete FlowStepBtn_MUI Where FlowID =").AppendParameter("FlowID", e.DataKeys[0]); sb.AppendStatement("Delete FlowStepBtnHideExp Where FlowID =").AppendParameter("FlowID", e.DataKeys[0]); sb.AppendStatement("Delete FlowUpdCustDataExp Where FlowID =").AppendParameter("FlowID", e.DataKeys[0]); sb.AppendStatement("Delete FlowCustGrp Where FlowID =").AppendParameter("FlowID", e.DataKeys[0]); sb.AppendStatement("Delete FlowCustGrp_MUI Where FlowID =").AppendParameter("FlowID", e.DataKeys[0]); sb.AppendStatement("Delete FlowCustGrpDetail Where FlowID =").AppendParameter("FlowID", e.DataKeys[0]); sb.AppendStatement("Delete FlowCustGrpDetail_MUI Where FlowID =").AppendParameter("FlowID", e.DataKeys[0]); try { db.ExecuteNonQuery(sb.BuildCommand()); //[刪除]資料異動Log LogHelper.WriteAppDataLog(FlowExpress._FlowSysDB, "FlowSpec", Util.getStringJoin(e.DataKeys), LogHelper.AppDataLogType.Delete); Util.NotifyMsg(RS.Resources.Msg_DeleteSucceed, Util.NotifyKind.Success); } catch (Exception ex) { Util.MsgBox(ex.Message); } break; case "cmdDownload": //Data Dump string strHeader = string.Format("[{0}] 資料轉儲 SQL", e.DataKeys[0]); string strDataFilter = string.Format(" FlowID = '{0}' ", e.DataKeys[0]); string strDumpSQL = string.Empty; strDumpSQL += "/* ==================================================================== */ \n"; strDumpSQL += string.Format("/* {0} on [{1}] */ \n", strHeader, DateTime.Now); strDumpSQL += "/* ==================================================================== */ \n"; strDumpSQL += string.Format("Use {0} \nGo\n", FlowExpress._FlowSysDB); strDumpSQL += "/* ==================== */ \n"; strDumpSQL += "/* FlowSpec 相關物件 */ \n"; strDumpSQL += "/* ==================== */ \n"; strDumpSQL += Util.getDataDumpSQL(FlowExpress._FlowSysDB, "FlowSpec", strDataFilter); strDumpSQL += Util.getDataDumpSQL(FlowExpress._FlowSysDB, "FlowSpec_MUI", strDataFilter); strDumpSQL += "\n"; strDumpSQL += "/* ==================== */ \n"; strDumpSQL += "/* FlowStep 相關物件 */ \n"; strDumpSQL += "/* ==================== */ \n"; strDumpSQL += Util.getDataDumpSQL(FlowExpress._FlowSysDB, "FlowStep", strDataFilter); strDumpSQL += Util.getDataDumpSQL(FlowExpress._FlowSysDB, "FlowStep_MUI", strDataFilter); strDumpSQL += "\n"; strDumpSQL += "/* ==================== */ \n"; strDumpSQL += "/* FlowStepBtn 相關物件 */ \n"; strDumpSQL += "/* ==================== */ \n"; strDumpSQL += Util.getDataDumpSQL(FlowExpress._FlowSysDB, "FlowStepBtn", strDataFilter); strDumpSQL += Util.getDataDumpSQL(FlowExpress._FlowSysDB, "FlowStepBtn_MUI", strDataFilter); strDumpSQL += Util.getDataDumpSQL(FlowExpress._FlowSysDB, "FlowStepBtnHideExp", strDataFilter); strDumpSQL += "\n"; strDumpSQL += "/* =========================== */ \n"; strDumpSQL += "/* FlowUpdCustDataExp 相關物件 */ \n"; strDumpSQL += "/* =========================== */ \n"; strDumpSQL += Util.getDataDumpSQL(FlowExpress._FlowSysDB, "FlowUpdCustDataExp", strDataFilter); strDumpSQL += "\n"; strDumpSQL += "/* ==================== */ \n"; strDumpSQL += "/* FlowCustGrp 相關物件 */ \n"; strDumpSQL += "/* ==================== */ \n"; strDumpSQL += Util.getDataDumpSQL(FlowExpress._FlowSysDB, "FlowCustGrp", strDataFilter); strDumpSQL += Util.getDataDumpSQL(FlowExpress._FlowSysDB, "FlowCustGrp_MUI", strDataFilter); strDumpSQL += Util.getDataDumpSQL(FlowExpress._FlowSysDB, "FlowCustGrpDetail", strDataFilter); strDumpSQL += Util.getDataDumpSQL(FlowExpress._FlowSysDB, "FlowCustGrpDetail_MUI", strDataFilter); txtDumpSQL.ucTextData = strDumpSQL; ucModalPopup1.Reset(); ucModalPopup1.ucPopupWidth = 850; ucModalPopup1.ucPopupHeight = 600; ucModalPopup1.ucPopupHeader = strHeader; ucModalPopup1.ucPanelID = pnlDumpSQL.ID; ucModalPopup1.Show(); break; } (this.Master as FlowExpress_Admin_FlowExpess).RefreshTreeView(); }
/// <summary> /// GridView RowCommand 事件訂閱 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void ucGridView1_RowCommand(object sender, Util_ucGridView.RowCommandEventArgs e) { DbHelper db = new DbHelper(LegalSample._LegalSysDBName); DataTable dt = null; CommandHelper sb = db.CreateCommandHelper(); var AppKey = new Tuple <string[], string>(new string[] { "" }, ""); string strNewCaseNo = ""; string[] oDataKeys = e.DataKeys; switch (e.CommandName) { case "cmdAdd": //新增模式 divMainGridview.Visible = false; AppKey = Util.getAppKey(LegalSample._LegalSysDBName, LegalSample._LegalConsultCaseTableName); if (string.IsNullOrEmpty(AppKey.Item2)) { strNewCaseNo = AppKey.Item1[0]; UserInfo oUser = UserInfo.getUserInfo(); sb.Reset(); sb.AppendStatement(string.Format("Insert {0} ", LegalSample._LegalConsultCaseTableName)); sb.Append(" (CaseNo,CaseStatus,Subject,IsUrgent,CrDept,CrDeptName,CrUser,CrUserName,CrDateTime,UpdDept,UpdDeptName,UpdUser,UpdUserName,UpdDateTime )"); sb.Append(" Values (").AppendParameter("CaseNo", strNewCaseNo); sb.Append(" ,").AppendParameter("CaseStatus", "Draft"); sb.Append(" ,").AppendParameter("Subject", "New Case"); sb.Append(" ,").AppendParameter("IsUrgent", "N"); sb.Append(" ,").AppendParameter("CrDept", oUser.DeptID); sb.Append(" ,").AppendParameter("CrDeptName", oUser.DeptName); sb.Append(" ,").AppendParameter("CrUser", oUser.UserID); sb.Append(" ,").AppendParameter("CrUserName", oUser.UserName); sb.Append(" ,").AppendDbDateTime(); sb.Append(" ,").AppendParameter("UpdDept", oUser.DeptID); sb.Append(" ,").AppendParameter("UpdDeptName", oUser.DeptName); sb.Append(" ,").AppendParameter("UpdUser", oUser.UserID); sb.Append(" ,").AppendParameter("UpdUserName", oUser.UserName); sb.Append(" ,").AppendDbDateTime(); sb.Append(")"); if (db.ExecuteNonQuery(sb.BuildCommand()) > 0) { dt = db.ExecuteDataSet(CommandType.Text, string.Format("Select * From {0} Where CaseNo = '{1}' and CaseStatus = 'Draft' ", LegalSample._LegalConsultCaseTableName, strNewCaseNo)).Tables[0]; divMainGridview.Visible = false; fmMain.ChangeMode(FormViewMode.Edit); fmMain.DataSource = dt; fmMain.DataBind(); divMainFormView.Visible = true; //新增成功,直接編輯 Util.NotifyMsg(RS.Resources.Msg_AddSucceed_Edit, Util.NotifyKind.Success); } else { //新增失敗 Util.NotifyMsg(RS.Resources.Msg_AddFail, Util.NotifyKind.Error); } } else { //取 CaseNo 失敗 Util.MsgBox(AppKey.Item2); } break; case "cmdCopy": //資料複製 AppKey = Util.getAppKey(LegalSample._LegalSysDBName, LegalSample._LegalConsultCaseTableName); if (string.IsNullOrEmpty(AppKey.Item2)) { strNewCaseNo = AppKey.Item1[0]; string strSQL = Util.getDataCopySQL(LegalSample._LegalSysDBName, "CaseNo".Split(','), e.DataKeys[0].Split(','), strNewCaseNo.Split(','), LegalSample._LegalConsultCaseTableName.Split(',')); try { strSQL += string.Format("Update {0} set CrDateTime = getdate(),UpdDateTime = getdate() Where CaseNo = '{1}';", LegalSample._LegalConsultCaseTableName, strNewCaseNo); db.ExecuteNonQuery(CommandType.Text, strSQL); //複製成功,直接切到編輯模式 divMainGridview.Visible = false; sb.Reset(); sb.AppendStatement(string.Format("Select * From {0} Where CaseNo = ", LegalSample._LegalConsultCaseTableName)).AppendParameter("CaseNo", strNewCaseNo); dt = db.ExecuteDataSet(sb.BuildCommand()).Tables[0]; fmMain.ChangeMode(FormViewMode.Edit); fmMain.DataSource = dt; fmMain.DataBind(); divMainFormView.Visible = true; //複製成功 Util.NotifyMsg(string.Format(RS.Resources.Msg_CopySucceed_Edit1, strNewCaseNo), Util.NotifyKind.Success); } catch { //複製失敗 Util.NotifyMsg(RS.Resources.Msg_CopyFail, Util.NotifyKind.Error); } } else { Util.MsgBox(AppKey.Item2); } break; case "cmdEdit": //資料編輯 sb.Reset(); sb.AppendStatement(string.Format("Select * From {0} Where CaseNo = ", LegalSample._LegalConsultCaseTableName)).AppendParameter("CaseNo", oDataKeys[0]); dt = db.ExecuteDataSet(sb.BuildCommand()).Tables[0]; DataRow dr = dt.Rows[0]; fmMain.ChangeMode(FormViewMode.Edit); fmMain.DataSource = dt; fmMain.DataBind(); divMainGridview.Visible = false; divMainFormView.Visible = true; break; case "cmdDelete": //資料刪除 sb.Reset(); sb.AppendStatement(string.Format("Delete {0} Where CaseNo = ", LegalSample._LegalConsultCaseTableName)).AppendParameter("CaseNo", oDataKeys[0]); if (db.ExecuteNonQuery(sb.BuildCommand()) > 0) { //刪除成功 Util.NotifyMsg(RS.Resources.Msg_DeleteSucceed, Util.NotifyKind.Success); } else { //刪除失敗 Util.NotifyMsg(RS.Resources.Msg_DeleteFail, Util.NotifyKind.Error); } break; case "cmdSelect": //提案送審 //流程第一關[A00]的指派對象,有兩種作法: //01.自行設定指派對象,例: // Dictionary<string, string> oAssTo = OrgExpress.getDeptOrganBoss(); //取得所屬Dept及轄下Organ所有主管 //02.將資料設定在 流程關卡[FlowStepBtn],再利用 getNewFlowStepBtnAssignList() 取得所需資料 Dictionary <string, string> oAssTo = FlowExpress.getNewFlowStepBtnAssignList(LegalSample._LegalConsultFlowID, "btn2Prop"); if (oAssTo.Count > 0) { //若有指派對象,才開始組合新增流程 IsFlowInsVerify() 所需的參數 string strQrySQL = @"Select CaseNo,Case When LEN(subject) > 25 then SUBSTRING(Subject,1,25) + '…' else Subject end as 'Subject' ,IsUrgent,Convert(char(10),ExpectCloseDate,111) as 'ExpectCloseDate', Convert(char(10),getdate(),111) as 'PropDate' From {0} Where CaseNo = '{1}' and CaseStatus = 'Draft' "; strQrySQL = string.Format(strQrySQL, LegalSample._LegalConsultCaseTableName, oDataKeys[0]); dt = db.ExecuteDataSet(CommandType.Text, strQrySQL).Tables[0]; if (dt != null && dt.Rows.Count > 0) { //ex:主旨,提案单位,提案日期,急件,預定結案 string strShowValue = dt.Rows[0]["Subject"].ToString().Replace(",", ",") + ","; strShowValue += UserInfo.getUserInfo().DeptName + ","; strShowValue += dt.Rows[0]["PropDate"].ToString() + ","; strShowValue += dt.Rows[0]["IsUrgent"].ToString() + ","; strShowValue += (string.IsNullOrEmpty(dt.Rows[0]["ExpectCloseDate"].ToString())) ? "" : dt.Rows[0]["ExpectCloseDate"].ToString(); //使用 ContextData 傳遞參數 Dictionary <string, string> oContext = new Dictionary <string, string>(); oContext.Add("CaseNo", oDataKeys[0]); oContext.Add("FlowID", LegalSample._LegalConsultFlowID); oContext.Add("FlowKeyValue", oDataKeys[0]); oContext.Add("FlowShowValue", strShowValue); oContext.Add("FlowStepBtnID", "btn2Prop"); ucModalPopup1.Reset(); ucModalPopup1.ucPopupWidth = 320; ucModalPopup1.ucPopupHeight = 180; ucModalPopup1.ucContextData = Util.getJSON(oContext); //組合彈出畫面所需顯示訊息及審核清單 labVerifyCaseInfo.Text = string.Format((string)GetLocalResourceObject("Msg_FlowVerifyCaseInfo"), oDataKeys[0]); labVerifyAssignTo.Text = (string)GetLocalResourceObject("Msg_FlowVerifyAssignTo"); ddlAssignTo.Items.Clear(); ddlAssignTo.DataSource = Util.getDictionary(oAssTo); ddlAssignTo.DataValueField = "key"; ddlAssignTo.DataTextField = "value"; ddlAssignTo.DataBind(); ucModalPopup1.ucPanelID = pnlVerify.ID; btnVerify.Text = RS.Resources.Msg_Confirm_btnOK; btnVerifyCancel.Text = RS.Resources.Msg_Confirm_btnCancel; ucModalPopup1.ucBtnCloselEnabled = false; ucModalPopup1.ucBtnCompleteEnabled = false; ucModalPopup1.ucBtnCancelEnabled = false; ucModalPopup1.Show(); } else { Util.MsgBox(Util.getHtmlMessage(Util.HtmlMessageKind.DataNotFound)); } } else { Util.MsgBox(Util.getHtmlMessage(Util.HtmlMessageKind.DataNotFound)); } break; default: //未定義 Util.MsgBox(string.Format(RS.Resources.Msg_Undefined1, e.CommandName)); break; } }
void ucGridView_Fix_RowCommand(object sender, Util_ucGridView.RowCommandEventArgs e) { Util.MsgBox(string.Format("<b>RowCommand</b><hr>Cmd=[{0}]<br>Keys=[{1}]", e.CommandName, Util.getStringJoin(e.DataKeys))); }
/// <summary> /// 資料清單執行命令 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void ucGridView1_RowCommand(object sender, Util_ucGridView.RowCommandEventArgs e) { DbHelper db = new DbHelper(_DBName); DataTable dt = null; CommandHelper sb = db.CreateCommandHelper(); string[] oDataKeys = e.DataKeys; switch (e.CommandName) { case "cmdAdd": //新增模式 DivQryArea.Visible = false; divMainGridview.Visible = false; fmMain.ChangeMode(FormViewMode.Insert); fmMain.DataSource = null; fmMain.DataBind(); divMainFormView.Visible = true; break; case "cmdCopy": //資料複製 sb.Reset(); sb.AppendStatement("Select * From AclAuthRuleAreaGrantList Where 0 = 0 "); sb.Append(Util.getDataQueryKeySQL(_PKList, oDataKeys)); dt = db.ExecuteDataSet(sb.BuildCommand()).Tables[0]; DivQryArea.Visible = false; divMainGridview.Visible = false; fmMain.ChangeMode(FormViewMode.Insert); fmMain.DataSource = dt; fmMain.DataBind(); divMainFormView.Visible = true; break; case "cmdEdit": //資料編輯 DivQryArea.Visible = false; divMainGridview.Visible = false; sb.Reset(); sb.AppendStatement("Select * From AclAuthRuleAreaGrantList Where 0 = 0 "); sb.Append(Util.getDataQueryKeySQL(_PKList, oDataKeys)); dt = db.ExecuteDataSet(sb.BuildCommand()).Tables[0]; fmMain.ChangeMode(FormViewMode.Edit); fmMain.DataSource = dt; fmMain.DataBind(); divMainFormView.Visible = true; break; case "cmdDelete": //資料刪除 try { Dictionary <string, string> dicKey = Util.getDictionary(_PKList, oDataKeys); AclExpress.IsAclTableLog("AclAuthRuleAreaGrantList", dicKey, LogHelper.AppTableLogType.Delete); sb.Reset(); sb.AppendStatement("Delete From AclAuthRuleAreaGrantList Where 0 = 0 "); sb.Append(Util.getDataQueryKeySQL(_PKList, oDataKeys)); db.ExecuteNonQuery(sb.BuildCommand()); Util.NotifyMsg(RS.Resources.Msg_DeleteSucceed, Util.NotifyKind.Success); //刪除成功 } catch { Util.NotifyMsg(RS.Resources.Msg_DeleteFail, Util.NotifyKind.Error); } break; case "cmdDataDump": //Data Dump 2016.11.08 string strHeader = string.Format("[{0}] 資料轉儲 SQL", "AclAuthRuleAreaGrantList"); string strDumpSQL = string.Empty; strDumpSQL += "/* ==================================================================== */ \n"; strDumpSQL += string.Format("/* {0} on [{1}] */ \n", strHeader, DateTime.Now); strDumpSQL += "/* ==================================================================== */ \n"; strDumpSQL += string.Format("Use {0} \nGo\n", AclExpress._AclDBName); strDumpSQL += "/* ==================== */ \n"; strDumpSQL += "/* AclAuthRuleAreaGrantList 相關物件 */ \n"; strDumpSQL += "/* ==================== */ \n"; strDumpSQL += Util.getDataDumpSQL(AclExpress._AclDBName, "AclAuthRuleAreaGrantList"); txtDumpSQL.ucTextData = strDumpSQL; ucModalPopup1.Reset(); ucModalPopup1.ucPopupWidth = 850; ucModalPopup1.ucPopupHeight = 600; ucModalPopup1.ucPopupHeader = strHeader; ucModalPopup1.ucPanelID = pnlDumpSQL.ID; ucModalPopup1.Show(); break; default: Util.MsgBox(string.Format(RS.Resources.Msg_Undefined1, e.CommandName)); //無此命令 break; } }
void ucGridView1_RowCommand(object sender, Util_ucGridView.RowCommandEventArgs e) { DbHelper db = new DbHelper(_DBName); CommandHelper sb = db.CreateCommandHelper(); string strDataKeys = (e.DataKeys != null) ? Util.getStringJoin(e.DataKeys) : ""; Dictionary <string, string> dicContext = new Dictionary <string, string>(); switch (e.CommandName) { case "cmdAdd": dicContext.Clear(); dicContext.Add("Mode", "Add"); dicContext.Add("DataKeys", strDataKeys); LaunchPopup(dicContext); break; case "cmdEdit": dicContext.Clear(); dicContext.Add("Mode", "Edit"); dicContext.Add("DataKeys", strDataKeys); LaunchPopup(dicContext); break; case "cmdCopy": dicContext.Clear(); dicContext.Add("Mode", "Copy"); dicContext.Add("DataKeys", strDataKeys); LaunchPopup(dicContext); break; case "cmdDelete": if (string.IsNullOrEmpty(strDataKeys)) { Util.MsgBox(Util.getHtmlMessage(Util.HtmlMessageKind.ParaDataError)); return; } else { try { sb.Reset(); sb.AppendStatement(string.Format("Delete {0} ", _TableName)); sb.Append(" Where KindID = ").AppendParameter("KindID", strDataKeys.Split(',')[0]); sb.Append(" And TypeID = ").AppendParameter("TypeID", strDataKeys.Split(',')[1]); sb.Append(" And ItemID = ").AppendParameter("ItemID", strDataKeys.Split(',')[2]); db.ExecuteNonQuery(sb.BuildCommand()); Util.NotifyMsg(SinoPac.WebExpress.Common.Properties.Resources.Msg_DeleteSucceed, Util.NotifyKind.Success); } catch (Exception ex) { Util.MsgBox(Util.getHtmlMessage(Util.HtmlMessageKind.Error, ex.ToString())); } } break; case "cmdMultilingual": string strURL = string.Format("{0}?DBName={1}&TableName={2}&PKFieldList={3}&PKValueList={4}", Util._MuiAdminUrl, _DBName, _TableName, _PKFieldList, Util.getStringJoin(e.DataKeys)); ucModalPopup1.Reset(); ucModalPopup1.ucFrameURL = strURL; ucModalPopup1.ucPopupWidth = 650; ucModalPopup1.ucPopupHeight = 350; ucModalPopup1.ucBtnCloselEnabled = true; ucModalPopup1.Show(); break; default: Util.MsgBox(string.Format(SinoPac.WebExpress.Common.Properties.Resources.Msg_Undefined1, e.CommandName)); break; } }
void gvFlowStepBtn_RowCommand(object sender, Util_ucGridView.RowCommandEventArgs e) { DbHelper db = new DbHelper(FlowExpress._FlowSysDB); CommandHelper sb = db.CreateCommandHelper(); switch (e.CommandName) { case "cmdSelect": Response.Redirect(string.Format("FlowStepBtn.aspx?FlowID={0}&FlowStepID={1}&FlowStepBtnID={2}", HttpUtility.HtmlEncode(e.DataKeys[0]), HttpUtility.HtmlEncode(e.DataKeys[1]), HttpUtility.HtmlEncode(e.DataKeys[2]))); break; case "cmdCopy": hidFlowID.Value = e.DataKeys[0]; hidFlowStepID.Value = e.DataKeys[1]; hidFlowStepBtnID.Value = e.DataKeys[2]; DataRow dr = db.ExecuteDataSet(string.Format("Select * From FlowStepBtn Where FlowID='{0}' and FlowStepID = '{1}' and FlowStepBtnID = '{2}'", e.DataKeys[0], e.DataKeys[1], e.DataKeys[2])).Tables[0].Rows[0]; txtNewFlowStepBtnID.ucTextData = "Cpy-" + dr["FlowStepBtnID"].ToString().Left(15); txtNewFlowStepBtnCaption.ucTextData = "Cpy-" + dr["FlowStepBtnCaption"].ToString().Left(25); txtNewFlowStepBtnSeqNo.ucTextData = dr["FlowStepBtnSeqNo"].ToString(); ucModalPopup1.ucPopupHeader = "複製流程按鈕"; ucModalPopup1.ucPanelID = pnlNewFlowStepBtn.ID; ucModalPopup1.Show(); break; case "cmdAdd": hidFlowID.Value = _FlowID; hidFlowStepID.Value = _FlowStepID; hidFlowStepBtnID.Value = ""; txtNewFlowStepBtnID.ucTextData = "New-BtnID"; txtNewFlowStepBtnCaption.ucTextData = "New-BtnCaprion"; txtNewFlowStepBtnSeqNo.ucTextData = "99"; ucModalPopup1.ucPopupHeader = "新增流程按鈕"; ucModalPopup1.ucPanelID = pnlNewFlowStepBtn.ID; ucModalPopup1.Show(); break; case "cmdDelete": sb.Reset(); sb.AppendStatement("Delete FlowStepBtn Where FlowID =").AppendParameter("FlowID", e.DataKeys[0]); sb.Append(" And FlowStepID =").AppendParameter("FlowStepID", e.DataKeys[1]); sb.Append(" And FlowStepBtnID =").AppendParameter("FlowStepBtnID", e.DataKeys[2]); sb.AppendStatement("Delete FlowStepBtn_MUI Where FlowID =").AppendParameter("FlowID", e.DataKeys[0]); sb.Append(" And FlowStepID =").AppendParameter("FlowStepID", e.DataKeys[1]); sb.Append(" And FlowStepBtnID =").AppendParameter("FlowStepBtnID", e.DataKeys[2]); sb.AppendStatement("Delete FlowStepBtnHideExp Where FlowID =").AppendParameter("FlowID", e.DataKeys[0]); sb.Append(" And FlowStepID =").AppendParameter("FlowStepID", e.DataKeys[1]); sb.Append(" And FlowStepBtnID =").AppendParameter("FlowStepBtnID", e.DataKeys[2]); try { db.ExecuteNonQuery(sb.BuildCommand()); //[刪除]資料異動Log LogHelper.WriteAppDataLog(FlowExpress._FlowSysDB, "FlowStepBtn", Util.getStringJoin(e.DataKeys), LogHelper.AppDataLogType.Delete); Util.NotifyMsg(RS.Resources.Msg_DeleteSucceed, Util.NotifyKind.Success); } catch (Exception ex) { Util.MsgBox(ex.Message); } break; } (this.Master as FlowExpress_Admin_FlowExpess).RefreshTreeView(); }
void ucGridMain_RowCommand(object sender, Util_ucGridView.RowCommandEventArgs e) { DbHelper db = new DbHelper(_DBName); CommandHelper sb = db.CreateCommandHelper(); DbConnection cn = db.OpenConnection(); DbTransaction tx = cn.BeginTransaction(); //取得相關Key值 _MainID = e.DataKeys[0]; //處理自訂命令,AP 可視需要自行增加想要的 CommandName switch (e.CommandName) { case "cmdAdd": _IsADD = true; _MainID = ""; Refresh(true, true); break; case "cmdCopy": _IsADD = false; var AppKeyResult = Util.getAppKey(_DBName, _AppKeyID); string strPOID = AppKeyResult.Item1[0]; string strErrMsg = AppKeyResult.Item2; if (!string.IsNullOrEmpty(strErrMsg)) { Util.MsgBox(strErrMsg); return; } string strSQL = Util.getDataCopySQL(_DBName, "POID".Split(','), e.DataKeys[0].Split(','), strPOID.Split(','), "PO,PODetail".Split(',')); try { db.ExecuteNonQuery(CommandType.Text, strSQL, tx); tx.Commit(); _MainID = strPOID; //新訂單編號 Util.NotifyMsg("訂單複製成功,可直接進行相關編修", Util.NotifyKind.Success); } catch { tx.Rollback(); Util.NotifyMsg("訂單複製失敗", Util.NotifyKind.Error); } finally { cn.Close(); cn.Dispose(); tx.Dispose(); } Refresh(false, true); break; case "cmdDelete": _IsADD = false; _MainID = ""; _DetailSeq = -1; sb.Reset(); sb.AppendStatement("Delete PO Where POID = ").AppendParameter("POID", e.DataKeys[0]); sb.AppendStatement("Delete PODetail Where POID = ").AppendParameter("POID", e.DataKeys[0]); try { db.ExecuteNonQuery(sb.BuildCommand(), tx); tx.Commit(); Util.NotifyMsg("主檔及相關明細檔刪除成功", Util.NotifyKind.Success); } catch { throw; } finally { cn.Close(); cn.Dispose(); tx.Dispose(); } break; case "cmdSelect": _IsADD = false; Refresh(false, true); break; default: Util.MsgBox(string.Format("cmd=[{0}],key=[{1}]", e.CommandName, Util.getStringJoin(e.DataKeys))); break; } }
void ucGridView1_RowCommand(object sender, Util_ucGridView.RowCommandEventArgs e) { Util.NotifyMsg(string.Format("資料鍵值為 [{0}] ", Util.getStringJoin(e.DataKeys)), Util.NotifyKind.Success); }
void ucGridDetail_RowCommand(object sender, Util_ucGridView.RowCommandEventArgs e) { //承接明細檔 GridView 單一按鈕事件 DbHelper db = new DbHelper(_DBName); CommandHelper sb = db.CreateCommandHelper(); string[] oDataKeys = e.DataKeys; if (oDataKeys != null) { _MainID = oDataKeys[0]; _DetailSeq = int.Parse("0" + oDataKeys[1].ToString()); } //初始彈出視窗 ucModalPopup1.Reset(); ucModalPopup1.ucPopupWidth = 550; ucModalPopup1.ucPopupHeight = 280; //處理自訂命令,AP 可視需要自行增加想要的 CommandName switch (e.CommandName) { case "cmdAdd": //新增模式 fmDetail.ChangeMode(FormViewMode.Insert); fmDetail.DataBind(); Util.setJS_AlertDirtyData(fmDetail); ucModalPopup1.ucPopupHeader = "新增明細"; ucModalPopup1.ucPanelID = pnlDetailForm.ID; ucModalPopup1.Show(); break; case "cmdCopy": //複製模式 fmDetail.ChangeMode(FormViewMode.Insert); fmDetail.DataBind(); Util.setJS_AlertDirtyData(fmDetail); sb.Reset(); sb.AppendStatement("Select * From PODetail Where 0=0 "); sb.Append(" And POID = ").AppendParameter("POID", _MainID); sb.Append(" And POSeq = ").AppendParameter("POSeq", _DetailSeq); DataRow dr = db.ExecuteDataSet(sb.BuildCommand()).Tables[0].Rows[0]; ((Util_ucTextBox)fmDetail.FindControl("ItemDesc")).ucTextData = dr["ItemDesc"].ToString(); ((Util_ucDatePicker)fmDetail.FindControl("ItemExpDate")).ucSelectedDate = string.Format("{0:yyyy\\/MM\\/dd}", dr["ItemExpDate"]); ((Util_ucTextBox)fmDetail.FindControl("UnitPrice")).ucTextData = dr["UnitPrice"].ToString(); ((Util_ucTextBox)fmDetail.FindControl("Qty")).ucTextData = dr["Qty"].ToString(); ((Util_ucCommSingleSelect)fmDetail.FindControl("Unit")).ucSelectedID = dr["Unit"].ToString(); ((Util_ucCommSingleSelect)fmDetail.FindControl("Unit")).Refresh(); ucModalPopup1.ucPopupHeader = "複製明細"; ucModalPopup1.ucPanelID = pnlDetailForm.ID; ucModalPopup1.Show(); break; case "cmdEdit": sb.Reset(); sb.AppendStatement("Select * From PODetail Where 0=0 "); sb.Append(" And POID = ").AppendParameter("POID", _MainID); sb.Append(" And POSeq = ").AppendParameter("POSeq", _DetailSeq); fmDetail.ChangeMode(FormViewMode.Edit); fmDetail.DataSource = db.ExecuteDataSet(sb.BuildCommand()).Tables[0]; fmDetail.DataBind(); Util.setJS_AlertDirtyData(fmDetail); ucModalPopup1.ucPopupHeader = "編輯明細"; ucModalPopup1.ucPanelID = pnlDetailForm.ID; ucModalPopup1.Show(); break; case "cmdDelete": sb.Reset(); //刪除明細 sb.AppendStatement("Delete PODetail Where 0=0 "); sb.Append(" And POID =").AppendParameter("POID", _MainID); sb.Append(" And POSeq =").AppendParameter("POSeq", _DetailSeq); //重新計算加總值 sb.AppendStatement(string.Format(_ReCal_BaseUpdSQL, _MainID)); DbConnection cn = db.OpenConnection(); DbTransaction tx = cn.BeginTransaction(); try { db.ExecuteNonQuery(sb.BuildCommand(), tx); tx.Commit(); _DetailSeq = -1; Util.NotifyMsg("明細刪除成功", Util.NotifyKind.Success); } catch { tx.Rollback(); Util.NotifyMsg("明細刪除失敗", Util.NotifyKind.Error); } finally { cn.Close(); cn.Dispose(); tx.Dispose(); } break; default: //未定義的命令 Util.MsgBox(string.Format(RS.Resources.Msg_Undefined1, e.CommandName)); break; } fmMainRefresh(); }