/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { try { string __RedirectURL = string.Empty; ButtonOperationContext __ButtonOperationContext = new ButtonOperationContext(); global::Drision.Framework.Entity.T_Department entityModel = null; entityModel = new global::Drision.Framework.Entity.T_Department(); CreateModel(entityModel); PluginEventArgs __PluginEventArg = new PluginEventArgs() { entityModel = entityModel, RedirectURL = __RedirectURL, CurrentUserID = this.LoginUserID }; { #region 钮前插件 if (!__ButtonOperationContext.IsEnd) { try { PagePluginFactory.InvokeBeforePlugins(sender, __PluginEventArg); __ButtonOperationContext.RedirectURL = __PluginEventArg.RedirectURL; if (!string.IsNullOrEmpty(__ButtonOperationContext.RedirectURL)) { __ButtonOperationContext.IsEnd = true; } } catch (MessageException ex) { __ButtonOperationContext.IsEnd = true; __ButtonOperationContext.AlertMessage = ex.Message; } } #endregion #region 框架自己操作 if (!__ButtonOperationContext.IsEnd) { this.GenericHelper.Save(entityModel); __Id = entityModel.Department_ID; } #endregion #region 钮后插件 if (!__ButtonOperationContext.IsEnd) { try { PagePluginFactory.InvokeAfterPlugins(sender, __PluginEventArg); __ButtonOperationContext.RedirectURL = __PluginEventArg.RedirectURL; if (!string.IsNullOrEmpty(__ButtonOperationContext.RedirectURL)) { __ButtonOperationContext.IsEnd = true; } } catch (MessageException ex) { __ButtonOperationContext.IsEnd = true; __ButtonOperationContext.AlertMessage = ex.Message; } } #endregion //结束事务 #region 最后处理 if (__ButtonOperationContext.IsEnd) { if (!string.IsNullOrEmpty(__ButtonOperationContext.AlertMessage)) { this.AjaxAlert(__ButtonOperationContext.AlertMessage, "EnableButton();"); return; } if (!string.IsNullOrEmpty(__ButtonOperationContext.RedirectURL)) { Response.Redirect(__ButtonOperationContext.RedirectURL); return; } } #endregion } __RedirectURL = DequeueLastUrl("id", __Id); //2013-11-13 V3.0 //如果没有id就加上id __RedirectURL = AppendQueryStringToUrl(__RedirectURL, "id", __Id);//2013-11-13 V3.0 Response.Redirect(__RedirectURL, false); } catch (Exception ex) { DrisionLog.Add(ex); this.AjaxAlert(ex, "EnableButton();"); } }
/// <summary> /// 设置功能 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void lbtn6S_Click(object sender, EventArgs e) { try { string __RedirectURL = string.Empty; ButtonOperationContext __ButtonOperationContext = new ButtonOperationContext(); string id = (sender as LinkButton).CommandArgument; var entityModel = (this.Page as BasePage).GenericHelper.FindById <global::Drision.Framework.Entity.T_Role>(id); PluginEventArgs __PluginEventArg = new PluginEventArgs() { entityModel = entityModel, RedirectURL = __RedirectURL, CurrentUserID = (this.Page as BasePage).LoginUserID }; { #region 钮前插件 if (!__ButtonOperationContext.IsEnd) { try { PagePluginFactory.InvokeBeforePlugins(sender, __PluginEventArg); __ButtonOperationContext.RedirectURL = __PluginEventArg.RedirectURL; if (!string.IsNullOrEmpty(__ButtonOperationContext.RedirectURL)) { __ButtonOperationContext.IsEnd = true; } } catch (MessageException ex) { __ButtonOperationContext.IsEnd = true; __ButtonOperationContext.AlertMessage = ex.Message; } } #endregion #region 框架自己操作 if (!__ButtonOperationContext.IsEnd) { } #endregion #region 钮后插件 if (!__ButtonOperationContext.IsEnd) { try { PagePluginFactory.InvokeAfterPlugins(sender, __PluginEventArg); __ButtonOperationContext.RedirectURL = __PluginEventArg.RedirectURL; if (!string.IsNullOrEmpty(__ButtonOperationContext.RedirectURL)) { __ButtonOperationContext.IsEnd = true; } } catch (MessageException ex) { __ButtonOperationContext.IsEnd = true; __ButtonOperationContext.AlertMessage = ex.Message; } } #endregion //结束事务 #region 最后处理 if (__ButtonOperationContext.IsEnd) { if (!string.IsNullOrEmpty(__ButtonOperationContext.AlertMessage)) { (this.Page as BasePage).AjaxAlert(__ButtonOperationContext.AlertMessage, "EnableButton();"); return; } if (!string.IsNullOrEmpty(__ButtonOperationContext.RedirectURL)) { Response.Redirect(__ButtonOperationContext.RedirectURL); return; } } #endregion } //按钮所有完成后的完善操作,如刷新数据等 } catch (Exception ex) { DrisionLog.Add(ex); (this.Page as BasePage).AjaxAlert(ex, "EnableButton();"); } }
/// <summary> /// 重置密码(123) /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btn2H_Click(object sender, EventArgs e) { try { string __RedirectURL = string.Empty; ButtonOperationContext __ButtonOperationContext = new ButtonOperationContext(); var entityModel = this.GenericHelper.FindById <global::Drision.Framework.Entity.T_User>(Request.QueryString["id"] ?? "-1"); PluginEventArgs __PluginEventArg = new PluginEventArgs() { entityModel = entityModel, RedirectURL = __RedirectURL, CurrentUserID = this.LoginUserID }; { #region 钮前插件 if (!__ButtonOperationContext.IsEnd) { try { PagePluginFactory.InvokeBeforePlugins(sender, __PluginEventArg); __ButtonOperationContext.RedirectURL = __PluginEventArg.RedirectURL; if (!string.IsNullOrEmpty(__ButtonOperationContext.RedirectURL)) { __ButtonOperationContext.IsEnd = true; } } catch (MessageException ex) { __ButtonOperationContext.IsEnd = true; __ButtonOperationContext.AlertMessage = ex.Message; } } #endregion #region 钮后插件 if (!__ButtonOperationContext.IsEnd) { try { PagePluginFactory.InvokeAfterPlugins(sender, __PluginEventArg); __ButtonOperationContext.RedirectURL = __PluginEventArg.RedirectURL; if (!string.IsNullOrEmpty(__ButtonOperationContext.RedirectURL)) { __ButtonOperationContext.IsEnd = true; } } catch (MessageException ex) { __ButtonOperationContext.IsEnd = true; __ButtonOperationContext.AlertMessage = ex.Message; } } #endregion //结束事务 #region 最后处理 if (__ButtonOperationContext.IsEnd) { if (!string.IsNullOrEmpty(__ButtonOperationContext.AlertMessage)) { this.AjaxAlert(__ButtonOperationContext.AlertMessage, "EnableButton();"); return; } if (!string.IsNullOrEmpty(__ButtonOperationContext.RedirectURL)) { Response.Redirect(__ButtonOperationContext.RedirectURL); return; } } #endregion } } catch (Exception ex) { DrisionLog.Add(ex); this.AjaxAlert(ex, "EnableButton();"); } }
/// <summary> /// 确定 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnMMRelationSaveJ6_Click(object sender, EventArgs e) { try { string __RedirectURL = string.Empty; ButtonOperationContext __ButtonOperationContext = new ButtonOperationContext(); PluginEventArgs __PluginEventArg = new PluginEventArgs() { entityModel = null, RedirectURL = __RedirectURL, CurrentUserID = this.LoginUserID }; List <string> childIds = viewcontrolXS.SelectedValues; { #region 钮前插件 if (!__ButtonOperationContext.IsEnd) { try { PagePluginFactory.InvokeBeforePlugins(sender, __PluginEventArg); __ButtonOperationContext.RedirectURL = __PluginEventArg.RedirectURL; if (!string.IsNullOrEmpty(__ButtonOperationContext.RedirectURL)) { __ButtonOperationContext.IsEnd = true; } } catch (MessageException ex) { __ButtonOperationContext.IsEnd = true; __ButtonOperationContext.AlertMessage = ex.Message; } } #endregion #region 框架自己操作 if (!__ButtonOperationContext.IsEnd) { this.GenericHelper.MMSave(typeof(global::Drision.Framework.Entity.T_User), __Id, "T_Role", childIds); } #endregion #region 钮后插件 if (!__ButtonOperationContext.IsEnd) { try { PagePluginFactory.InvokeAfterPlugins(sender, __PluginEventArg); __ButtonOperationContext.RedirectURL = __PluginEventArg.RedirectURL; if (!string.IsNullOrEmpty(__ButtonOperationContext.RedirectURL)) { __ButtonOperationContext.IsEnd = true; } } catch (MessageException ex) { __ButtonOperationContext.IsEnd = true; __ButtonOperationContext.AlertMessage = ex.Message; } } #endregion //结束事务 #region 最后处理 if (__ButtonOperationContext.IsEnd) { if (!string.IsNullOrEmpty(__ButtonOperationContext.AlertMessage)) { this.AjaxAlert(__ButtonOperationContext.AlertMessage, "EnableButton();"); return; } if (!string.IsNullOrEmpty(__ButtonOperationContext.RedirectURL)) { Response.Redirect(__ButtonOperationContext.RedirectURL); return; } } #endregion } __RedirectURL = DequeueLastUrl("id", __Id); //2013-11-13 V3.0 //如果没有id就加上id __RedirectURL = AppendQueryStringToUrl(__RedirectURL, "id", __Id);//2013-11-13 V3.0 Response.Redirect(__RedirectURL, false); } catch (Exception ex) { DrisionLog.Add(ex); this.AjaxAlert(ex, "EnableButton();"); } }/// <summary>
/// <summary> /// 批量删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btn5K_Click(object sender, EventArgs e) { try { ButtonOperationContext __ButtonOperationContext = new ButtonOperationContext(); List <string> SelectedValues = (this.divctrl_userquery_view.FindControl("ctrl_userquery_view") as IUserControl).SelectedValues; PluginEventArgs __PluginEventArg = new PluginEventArgs() { entityModel = null, RedirectURL = string.Empty, CurrentUserID = this.LoginUserID }; { #region 钮前插件 if (!__ButtonOperationContext.IsEnd) { try { PagePluginFactory.InvokeBeforePlugins(sender, __PluginEventArg); } catch (MessageException ex) { __ButtonOperationContext.IsEnd = true; __ButtonOperationContext.AlertMessage = ex.Message; } } #endregion #region 框架自己操作 if (!__ButtonOperationContext.IsEnd) { foreach (var ItemID in SelectedValues) { var item = this.GenericHelper.FindById <global::Drision.Framework.Entity.T_User>(ItemID.ToInt()); if (item != null) { this.GenericHelper.Delete(item); } } } #endregion #region 钮后插件 if (!__ButtonOperationContext.IsEnd) { try { PagePluginFactory.InvokeAfterPlugins(sender, __PluginEventArg); } catch (MessageException ex) { __ButtonOperationContext.IsEnd = true; __ButtonOperationContext.AlertMessage = ex.Message; } } #endregion //结束事务 #region 最后处理 if (__ButtonOperationContext.IsEnd) { if (!string.IsNullOrEmpty(__ButtonOperationContext.AlertMessage)) { this.AjaxAlert(__ButtonOperationContext.AlertMessage, "EnableButton();"); return; } } #endregion } //重新加载数据 (this.divctrl_userquery_view.FindControl("ctrl_userquery_view") as IUserControl).InitData(); } catch (Exception ex) { DrisionLog.Add(ex); this.AjaxAlert(ex, "EnableButton();"); } }
/// <summary> /// 删除 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDeleteH6_Click(object sender, EventArgs e) { try { ButtonOperationContext __ButtonOperationContext = new ButtonOperationContext(); if (__Id != 0) { PluginEventArgs __PluginEventArg = new PluginEventArgs() { entityModel = null, RedirectURL = string.Empty, CurrentUserID = this.LoginUserID }; { #region 钮前插件 if (!__ButtonOperationContext.IsEnd) { try { PagePluginFactory.InvokeBeforePlugins(sender, __PluginEventArg); } catch (MessageException ex) { __ButtonOperationContext.IsEnd = true; __ButtonOperationContext.AlertMessage = ex.Message; } } #endregion #region 框架自己操作 if (!__ButtonOperationContext.IsEnd) { var item = this.GenericHelper.FindById <global::Drision.Framework.Entity.T_Department>(__Id); if (item != null) { this.GenericHelper.Delete(item); } } #endregion #region 钮后插件 if (!__ButtonOperationContext.IsEnd) { try { PagePluginFactory.InvokeAfterPlugins(sender, __PluginEventArg); } catch (MessageException ex) { __ButtonOperationContext.IsEnd = true; __ButtonOperationContext.AlertMessage = ex.Message; } } #endregion //结束事务 #region 最后处理 if (__ButtonOperationContext.IsEnd) { if (!string.IsNullOrEmpty(__ButtonOperationContext.AlertMessage)) { this.AjaxAlert(__ButtonOperationContext.AlertMessage, "EnableButton();"); return; } } #endregion } tree.SelectedValue = null; tree.RemoveNode(__Id.ToString()); __Id = 0; tree.Refresh(); ddlManager_IDNM.SetValue(null); txt_Department_NameMZ.SetValue(null); txt_Department_StatusBE.SetValue(null); txt_RemarkZQ.SetValue(null); txt_Department_Full_Code8J.SetValue(null); txt_Organization_EnCodeP3.SetValue(null); txt_Organization_Code2S.SetValue(null); this.AjaxAlert("删除成功!"); } } catch (Exception ex) { DrisionLog.Add(ex); this.AjaxAlert(ex, "EnableButton();"); } }
/// <summary> /// 保存 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnDeptTreeSave_Click(object sender, EventArgs e) { try { string __RedirectURL = string.Empty; ButtonOperationContext __ButtonOperationContext = new ButtonOperationContext(); global::Drision.Framework.Entity.T_Department entityModel = null; if (!__IsAdd) { entityModel = this.GenericHelper.FindById <global::Drision.Framework.Entity.T_Department>(__Id); if (entityModel == null) { throw new Exception("保存前请先选择节点然后点击“新增”按钮"); } } else { entityModel = new global::Drision.Framework.Entity.T_Department(); } CreateModel(entityModel); PluginEventArgs __PluginEventArg = new PluginEventArgs() { entityModel = entityModel, RedirectURL = __RedirectURL, CurrentUserID = this.LoginUserID }; { #region 钮前插件 if (!__ButtonOperationContext.IsEnd) { try { PagePluginFactory.InvokeBeforePlugins(sender, __PluginEventArg); __ButtonOperationContext.RedirectURL = __PluginEventArg.RedirectURL; if (!string.IsNullOrEmpty(__ButtonOperationContext.RedirectURL)) { __ButtonOperationContext.IsEnd = true; } } catch (MessageException ex) { __ButtonOperationContext.IsEnd = true; __ButtonOperationContext.AlertMessage = ex.Message; } } #endregion #region 框架自己操作 if (!__ButtonOperationContext.IsEnd) { if (__IsAdd) { this.GenericHelper.Save(entityModel); } else { this.GenericHelper.Update(entityModel); tree.SelectedNode.Text = entityModel.Department_Name; } __Id = entityModel.Department_ID; } #endregion #region 钮后插件 if (!__ButtonOperationContext.IsEnd) { try { PagePluginFactory.InvokeAfterPlugins(sender, __PluginEventArg); __ButtonOperationContext.RedirectURL = __PluginEventArg.RedirectURL; if (!string.IsNullOrEmpty(__ButtonOperationContext.RedirectURL)) { __ButtonOperationContext.IsEnd = true; } } catch (MessageException ex) { __ButtonOperationContext.IsEnd = true; __ButtonOperationContext.AlertMessage = ex.Message; } } #endregion //结束事务 #region 最后处理 if (__ButtonOperationContext.IsEnd) { if (!string.IsNullOrEmpty(__ButtonOperationContext.AlertMessage)) { this.AjaxAlert(__ButtonOperationContext.AlertMessage, "EnableButton();"); return; } if (!string.IsNullOrEmpty(__ButtonOperationContext.RedirectURL)) { Response.Redirect(__ButtonOperationContext.RedirectURL); return; } } #endregion } LoadFirstLevel(tree.Nodes, true); tree.SelectedValue = __Id.ToString(); __IsAdd = false; this.AjaxAlert("保存成功!", "EnableButton();"); } catch (Exception ex) { DrisionLog.Add(ex); this.AjaxAlert(ex, "EnableButton();"); } }