选择“操作”会初始化对应的“下一环节处理”,
选择“下一环节处理”会初始化“备选责任人”
//public delegate void EventHandler(object sender, EventArgs e); public event EventHandler PreSubmit; // 提交前事件触发 if (PreSubmit != null) { EventArgs ea = new EventArgs(); PreSubmit(this, ea); }
控件使用:
<!-- 注册用户组件 --> <%@ Register src="../../AspUC/Dispose/Dispose.ascx" tagname="Dispose" tagprefix="uc1" %> <div> <uc1:Dispose ID="Dispose1" runat="server" OnPreSubmit="SaveNetworkInfo"/> </div>
Dispose.ascx:
<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Dispose.ascx.cs" Inherits="OSP.Web.AspUC.Dispose.Dispose" %> <table style="table-layout:fixed;" id="opinionform"> <tr> <td class="leftform"> <table style=" table-layout:fixed;" > <tr> <td> <h2>处理意见</h2> </td> </tr> <tr> <td> <asp:TextBox ID="Comment" runat="server" TextMode="MultiLine" Rows="8"></asp:TextBox> </td> </tr> <tr> <td> <asp:LinkButton ID="LinkButton1" runat="server" onclick="LinkButton1_Click">保存常用意见</asp:LinkButton> <asp:DropDownList ID="UsualComment" runat="server" onselectedindexchanged="UsualComment_SelectedIndexChanged" AutoPostBack="true"> </asp:DropDownList> <asp:LinkButton ID="LinkButton2" runat="server" onclick="LinkButton2_Click">删除意见</asp:LinkButton> </td> </tr> </table> </td> <td class="rightform"> <table style="table-layout:fixed;" > <tr> <td > <h2>选择操作</h2> </td> </tr> <tr> <td> <asp:ListBox ID="Action" runat="server" Rows="4" onselectedindexchanged="Action_SelectedIndexChanged" AutoPostBack="true"></asp:ListBox> </td> </tr> <tr> <td > <h2>下一环节处理(多选时请按ctrl键)</h2> </td> </tr> <tr> <td> <asp:ListBox ID="Activity" runat="server" Rows="4" SelectionMode="Multiple" onselectedindexchanged="Activity_SelectedIndexChanged" AutoPostBack="true"></asp:ListBox> </td> </tr> </table> </td> </tr> <tr> <td colspan="2" class="bottomform"> <table style="width:100%;"> <tr> <td colspan="3" > <h2>选择执行人</h2> </td> </tr> <tr> <td> <h2>备选责任人</h2> </td> <td> </td> <td> <h2>已选责任人</h2> </td> </tr> <tr> <td> <asp:ListBox ID="OptUser1" runat="server" Rows="5"></asp:ListBox> </td> <td style="width:70px;"> <table style=" table-layout:fixed;"> <tr align="center"> <td> <asp:Button ID="Button1" runat="server" Text=">>" Width="50px" onclick="Button1_Click" /> </td> </tr> <tr align="center"> <td> <asp:Button ID="Button2" runat="server" Text=">" Width="50px" onclick="Button2_Click"/> </td> </tr> <tr align="center"> <td> <asp:Button ID="Button3" runat="server" Text="<" Width="50px" onclick="Button3_Click"/> </td> </tr> <tr align="center"> <td> <asp:Button ID="Button4" runat="server" Text="<<" Width="50px" onclick="Button4_Click"/> </td> </tr> </table> </td> <td> <asp:ListBox ID="OptUser2" runat="server" Rows="5"></asp:ListBox> </td> </tr> </table> </td> </tr> <tr> <td colspan="2" align="center"> <div class="button2"> <asp:ImageButton ID="ImageButton2" runat="server" ImageUrl="~/themes/default/images/btn_submit.gif" Width="50" Height="20" onclick="ImageButton2_Click"/> <asp:ImageButton ID="ImageButton3" runat="server" ImageUrl="~/themes/default/images/btn_close.gif" Width="50" Height="20" OnClientClick="window.returnValue=0;window.close();"/> </div> </td> </tr> </table>
Dispose.ascx.cs:
//属性 namespace OSP.Web.AspUC.Dispose { public partial class Dispose : System.Web.UI.UserControl { private BLL.WorkFlowBll workFlow = new BLL.WorkFlowBll(); #region 暴露属性 /// <summary> /// 提交前触发事件 外部设置 /// </summary> public event EventHandler PreSubmit; /// <summary> /// 提交后触发事件 外部设置 /// </summary> public event EventHandler PostSubmit; /// <summary> /// 环节参数:key=value;key=value... 外部设置 /// </summary> public string ActivityParam; /// <summary> /// 流程参数:key=value;key=value... 外部设置 /// </summary> public string ProcessParam; /// <summary> /// 下一环节名称 只读 /// </summary> public string NextActivityName { get { return Activity.SelectedItem.Text; } } /// <summary> /// 下一环节元数据 只读 /// </summary> public string NextActivityMetaData { get { return Activity.SelectedItem.Value; } } private decimal piid; public decimal ProcessInstanceId { get { return piid; } } #endregion
//页面加载 /// <summary> /// 页面加载 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { // 下一环节信息 string fullname = Page.Request.QueryString["fn"]; string sn = Page.Request.QueryString["sn"]; string originator = Page.Request.QueryString["ou"]; DataSet ds = null; if (string.IsNullOrEmpty(fullname)) { #region 流程过程审批 ds = workFlow.GetWorklistItem(sn, false); // 操作初始化 DataTable dta = ds.Tables["Action"]; Action.DataTextField = "Name"; Action.DataValueField = "Name"; Action.DataSource = dta; Action.DataBind(); #endregion } else { #region 流程发起选人 ds = XMLUtil.ConvertDataSet(workFlow.getNextActivityInfo(originator, fullname)); Action.Items.Add(new ListItem("开始","开始")); Action.SelectedIndex = 0; DataTable dta = ds.Tables["NextActivity"]; if (dta != null && dta.Rows.Count > 0) { Activity.Items.Add(new ListItem(dta.Rows[0]["ActName"].ToString(), dta.Rows[0]["MetaData"].ToString())); Activity.SelectedIndex = 0; DataTable dtu = ds.Tables["AvailableUser"]; if (dtu != null && dtu.Rows.Count > 0) { foreach(DataRow dr in dtu.Rows) { OptUser1.Items.Add(new ListItem(dtu.Rows[0]["UserName"].ToString(), dtu.Rows[0]["LoginID"].ToString())); } } } #endregion } this.ViewState["ds"] = ds; // 常用意见信息 DataSet dsoc = workFlow.getOftenComment(); UsualComment.Items.Add(new ListItem("-- 请选择 --", "0")); UsualComment.SelectedIndex = 0; if (dsoc.Tables["OftenComment"] != null) { foreach (DataRow dr in dsoc.Tables["OftenComment"].Rows) { UsualComment.Items.Add(new ListItem(dr["Comment"].ToString(), dr["CommentID"].ToString())); } } } }
//控件联动事件 #region 控件联动事件 /// <summary> /// 根据操作确定环节列表 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Action_SelectedIndexChanged(object sender, EventArgs e) { if (string.IsNullOrEmpty(Page.Request.QueryString["fn"])) { Activity.Items.Clear(); DataSet ds = (DataSet)this.ViewState["ds"]; if (Action.SelectedValue != null) { DataRow[] dr = null; if (ds.Tables["Action"] != null && (dr = ds.Tables["Action"].Select("Name='" + Action.SelectedValue + "'")).Length > 0) { dr = dr[0].GetChildRows(ds.Relations["Action_WFNextActivitys"]); if (dr.Length > 0) { DataRow[] d = dr[0].GetChildRows(ds.Relations["WFNextActivitys_NextActivity"]); foreach (DataRow dr2 in d) { Activity.Items.Add(new ListItem(dr2["ActName"].ToString(), dr2["MetaData"].ToString())); } OptUser1.DataSource = null; OptUser2.DataSource = null; OptUser1.DataBind(); OptUser2.DataBind(); } } } } } protected void Button1_Click(object sender, EventArgs e) { foreach (ListItem li in OptUser1.Items) { OptUser2.Items.Add(li); } OptUser1.Items.Clear(); } protected void Button2_Click(object sender, EventArgs e) { foreach (ListItem li in OptUser1.Items) { if (li.Selected) { OptUser2.Items.Add(li); } } foreach (ListItem li in OptUser2.Items) { OptUser1.Items.Remove(li); } OptUser1.SelectedIndex = -1; OptUser2.SelectedIndex = -1; } protected void Button3_Click(object sender, EventArgs e) { foreach (ListItem li in OptUser2.Items) { if (li.Selected) { OptUser1.Items.Add(li); } } foreach (ListItem li in OptUser1.Items) { OptUser2.Items.Remove(li); } OptUser1.SelectedIndex = -1; OptUser2.SelectedIndex = -1; } protected void Button4_Click(object sender, EventArgs e) { foreach (ListItem li in OptUser2.Items) { OptUser1.Items.Add(li); } OptUser2.Items.Clear(); } protected void Activity_SelectedIndexChanged(object sender, EventArgs e) { if (string.IsNullOrEmpty(Page.Request.QueryString["fn"])) { OptUser1.Items.Clear(); OptUser2.Items.Clear(); DataSet ds = (DataSet)this.ViewState["ds"]; if (Activity.SelectedValue != null) { string sql = "MetaData='" + Activity.Items[Activity.SelectedIndex].Value + "'"; for (int i = Activity.SelectedIndex + 1; i < Activity.Items.Count; i++) { if (Activity.Items[i].Selected) { sql += "or MetaData='" + Activity.Items[i].Value + "'"; } } DataRow[] dr = null; DataRow[] dr3 = null; if (ds.Tables["NextActivity"] != null && (dr = ds.Tables["NextActivity"].Select(sql)).Length > 0) { Dictionary<string, string> dir = new Dictionary<string, string>(); for (int j = 0; j < dr.Length; j++) { dr3 = dr[j].GetChildRows(ds.Relations["NextActivity_AvailableUsers"]); if (dr3.Length > 0) { DataRow[] d = dr3[0].GetChildRows(ds.Relations["AvailableUsers_AvailableUser"]); foreach (DataRow dr2 in d) { dir[dr2["LoginID"].ToString()] = dr2["UserName"].ToString(); } } } foreach (string key in dir.Keys) { OptUser1.Items.Add(new ListItem(dir[key], key)); } } } } } #endregion
// /// <summary> /// 提交审批 /// 提交前和后会触发相应事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void ImageButton2_Click(object sender, ImageClickEventArgs e) { // 表单校验 if (OptUser1.Items.Count > 0 && OptUser2.Items.Count < 1) { ScriptManager.RegisterStartupScript(this, this.GetType(), "showMsg", "showMsg('请选择责任人!');", true); return; } if (Action.SelectedIndex < 0) { ScriptManager.RegisterStartupScript(this, this.GetType(), "showMsg", "showMsg('请选择操作!');", true); return; } if (Activity.SelectedIndex < 0) { ScriptManager.RegisterStartupScript(this, this.GetType(), "showMsg", "showMsg('请选择环节!');", true); return; } // 提交前事件触发 if (PreSubmit != null) { EventArgs ea = new EventArgs(); PreSubmit(this, ea); } #region 提交审批 // 下一环节信息 string fullname = Page.Request.QueryString["fn"]; string sn = Page.Request.QueryString["sn"]; string originator = Page.Request.QueryString["ou"]; string folio = Page.Request.QueryString["folio"]; string msg = ""; if (string.IsNullOrEmpty(fullname)) { string activityParam = "Outcome=k2sql:" + Action.SelectedValue; if (!string.IsNullOrEmpty(ActivityParam)) { activityParam += (";" + ActivityParam); } string processParam = ""; string userInfo = ""; if (OptUser2.Items.Count > 0) { userInfo = Activity.SelectedValue + "=k2sql:" + OptUser2.Items[0].Value; for (int i = 1; i < OptUser2.Items.Count; i ++) { userInfo += ",k2sql:" + OptUser2.Items[i].Value; } } processParam += userInfo; processParam += ";Route01=" + Activity.SelectedValue; if (!string.IsNullOrEmpty(ProcessParam)) { processParam += (";" + ProcessParam); } workFlow.finishWorkListItem(sn, Action.SelectedValue, activityParam, processParam, Comment.Text); msg = "审批成功!"; } else { string processParam = ""; string userInfo = ""; if (OptUser2.Items.Count > 0) { userInfo = Activity.SelectedValue + "=k2sql:" + OptUser2.Items[0].Value; for (int i = 1; i < OptUser2.Items.Count; i++) { userInfo += ",k2sql:" + OptUser2.Items[i].Value; } } processParam += userInfo; piid = Convert.ToDecimal(workFlow.startProcess(originator, fullname, folio, processParam)); msg = "流程发起成功!"; } #endregion // 提交后事件触发 if (PostSubmit != null) { EventArgs ea = new EventArgs(); PostSubmit(this, ea); } // 如果成功,关闭 ScriptManager.RegisterStartupScript(this, this.GetType(), "showMsg", "showMsg('" + msg + "');window.returnValue=1;window.close();", true); } protected void LinkButton2_Click(object sender, EventArgs e) { workFlow.deleOftenComment(UsualComment.SelectedValue); UsualComment.Items.Remove(UsualComment.Items[UsualComment.SelectedIndex]); UsualComment.SelectedIndex = 0; Comment.Text = ""; } protected void LinkButton1_Click(object sender, EventArgs e) { UsualComment.Items.Add(new ListItem(Comment.Text, workFlow.saveOftenComment(Comment.Text))); UsualComment.SelectedIndex = UsualComment.Items.Count - 1; } protected void UsualComment_SelectedIndexChanged(object sender, EventArgs e) { if (UsualComment.SelectedIndex != 0) { Comment.Text = UsualComment.SelectedItem.Text; } }
"常用意见数据源":
DataSet dsoc
//GetOftenComment.xml <?xml version="1.0" encoding="utf-8"?> <OftenComments> <Result>0</Result> <IsOK>true</IsOK> <OftenComment> <CommentID>22684FA6DD0B49B6B248E932666E4CB4</CommentID> <Comment>............hahahah3333同意</Comment> </OftenComment> <OftenComment> <CommentID>B1226234D35B4F7D9581C72D0DB03355</CommentID> <Comment>............hahahah</Comment> </OftenComment> <OftenComment> <CommentID>BE11D9B4767C44D196ABFC6DFF6C5CE2</CommentID> <Comment>............hahahah3333</Comment> </OftenComment> <Action>Get</Action> </OftenComments>
..
相关推荐
API(Application Programming Interface)在Asp.Net审批流程中起着关键作用。我们可以利用ASP.Net Web API来构建RESTful服务,提供审批数据的增删改查接口。这些接口可以被前端页面调用,获取或更新审批状态,也...
《.NET平台开发CRM》课件—03在.NET框架下开发三层结构数据库应用系统.pdf《.NET平台开发CRM》课件—03在.NET框架下开发三层结构数据库应用系统.pdf《.NET平台开发CRM》课件—03在.NET框架下开发三层结构数据库应用...
ASP.NET 4.0 是微软开发的一个强大的Web应用程序框架,用于构建动态、数据驱动的网站和应用程序。这个框架是.NET Framework的一部分,提供了丰富的特性和工具,使得开发者能够更高效地构建高质量的Web应用。 在...
asp.net 开发 OA 系统中的报销多级审批工作流(顺序工作流) 工作流是一个软件系统中的一个非常重要的组件,它可以帮助我们自动化许多业务流程,从而提高工作效率和降低成本。在 asp.net 开发 OA 系统中,工作流...
ASP.NET 实用网站开发知识点总结 本节总结了 ASP.NET 实用网站开发的相关知识点,包括 .NET Framework、ASP.NET 网站开发、HTML、CSS、JavaScript、C#语言等方面。 一、.NET Framework * .NET Framework 主要包括...
本文将详细探讨C# .NET在工控上位机开发中的应用,以及相关的核心知识点。 一、C#语言基础 C#是一种面向对象的编程语言,由微软公司开发,主要用于.NET Framework平台。它的语法简洁明了,支持类型安全和垃圾回收,...
《AutoCAD C#.Net 二次开发》课件,《AutoCAD C#.Net 二次开发》课件《AutoCAD C#.Net 二次开发》课件,《AutoCAD C#.Net 二次开发》课件,《AutoCAD C#.Net 二次开发》课件《AutoCAD C#.Net 二次开发》课件。...
这个"ASP.NET MVC4开发指南"提供了一套全面的学习资源,旨在帮助开发者掌握这一强大的Web开发技术。 MVC(Model-View-Controller)模式是ASP.NET MVC4的核心设计原则,它将应用程序分为三个主要部分:模型(Model)...
用vb.net开始asp.net1.1的开发用vb.net开始asp.net1.1的开发
用于VisualStudio2019以上版本开发.net framework 4.5.2框架的代码。适用于64位操作系统~ 从Visual Studio 2022开始,Microsoft不再包含.NET Framework 4.0到4.5.1的.NET Framework组件,因为这些版本不再受到...
ASP.NET Web 应用开发技术(第二版) 课后答案 喻钧 web应用程序
Web程序设计 : ASP.NET实用网站开发 .pdf
[深入浅出AutoCAD.NET二次开发].李冠亿.扫描版 适合AutoCAD二次开发新手入门
本教程《ASP.NET动态网站开发教程(第二版)》是针对这个技术的深入学习资源,包括源码、电子教案和习题答案,适合初学者和有一定基础的开发者使用。 一、ASP.NET核心概念 1. **Web Forms**: ASP.NET Web Forms是...
ASP.NET电子商务开发实战(完整版)本压缩包内包含:ASP.NET电子商务开发实战(中文版)、ASP.NET电子商务开发实战(英文版)和配书源代码三项内容。 ASP.NET电子商务开发实战(中文版)为完整版本,本资源与网上流传的ASP...
ASP.NET电子商务开发实战(完整版)本压缩包内包含:ASP.NET电子商务开发实战(中文版)、ASP.NET电子商务开发实战(英文版)和配书源代码三项内容。 ASP.NET电子商务开发实战(中文版)为完整版本,本资源与网上流传的ASP...
构架数据库系统入门 网站的架设和服务器配置 建立和配置数据源 连接和操作数据源 使用ADO.NET操作数据库 显示数据库中的内容 (listbox dropdownlist datalist datagrid 及... ASP.NET网络数据库开发 . . . . 附带实例
.net开发的开发模板,拥有开发前期,中期,后期维护测试等的一些力模板。使用的。