Teamplate 工作流开发技术总结(3)
2008-01-04 13:47
197 查看
http://www.cnblogs.com/nehc/archive/2007/11/16/961783.html
a) 审批日志和关系保存对象(ProcessRelationLog)
这个类主要实现审批日志和关系的保存;
对象成员:
属性:
补充说明:从Source起往下的属性是用于保存流程的业务信息,如果客户有需要,可选择相应的属性保存,不需要的属性允许为空,可不予理会。
方法:
Sample:下面的这个例子是我们在做精量项目时使用的一个调用工作流流转程序的基类,在这个基类当中的流程流转方法中我加入了写日志和任务关系的代码(代码中突出显示的部分),做为本文的最后一个Sample,请大家仔细研究。
namespace TeamplateBase
...{
/**////<summary>
/// TeamplateWebFormBase 的摘要说明。
///</summary>
public class TeamplateWebFormBase : System.Web.UI.Page
...{
public TeamplateWebFormBase()
...{
}
protected void LoadBindingData(BProcess process)
...{
BProcess pro = null;
try
...{
if(process == null)
...{
pro = this.LoadProcess();
}
else
...{
pro = process;
}
this.LoadData(pro);
}
catch(Exception ex)
...{
throw ex;
}
finally
...{
if(process == null && pro != null)
...{
pro.Dispose();
pro = null;
}
}
}
protected BProcess LoadProcess()
...{
int taskId;
int processId;
string token;
BProcess process = new BProcess();
try
...{
taskId = Convert.ToInt32(Request.QueryString["TID"]);
processId = Convert.ToInt32(Request.QueryString["PID"]);
token = Request.QueryString["token"];
if (token==null || taskId==0)
...{
throw new Exception("Error, Invalid process id or token!");
}
process.SetSessionToken(token);
process.Load(processId);
}
catch(Exception ex)
...{
throw ex;
}
return process;
}
protected virtual void LoadData(BProcess process)
...{
}
protected void PromoteProcess(System.Web.UI.Page page)
...{
int taskId = Convert.ToInt32(Request.QueryString["TID"]);
int processId = Convert.ToInt32(Request.QueryString["PID"]);
string token = Request.QueryString["TOKEN"];
BProcess process = null;
// 关系日志对象 Add by Sunmf
ProcessRelationLog relationlog = new ProcessRelationLog();
try
...{
process = new BProcess();
process.SetSessionToken(token);
process.Load(processId);
this.SaveBindingData(process);
process.WorkflowAdvance(taskId, null);
this.SaveRelationLog(relationlog, process);
}
finally
...{
if(process != null)
...{
process.Dispose();
process = null;
}
}
}
//由继承的窗体完成关系和日志信息的赋值
protected virtual void SaveRelationLog(ProcessRelationLog relationlog, BProcess process)
...{
relationlog.AddTaskRelation();
relationlog.WriteLog();
}
protected void SaveBindingData(BProcess process)
...{
BProcess pro = null;
try
...{
if(process == null)
...{
pro = this.LoadProcess();
}
else
...{
pro = process;
}
this.SaveData(pro);
}
catch(Exception ex)
...{
throw ex;
}
finally
...{
if(process == null && pro != null)
...{
pro.Dispose();
pro = null;
}
}
}
protected virtual void SaveData(BProcess process)
...{
}
protected void closeWindow(System.Web.UI.Page page)
...{
string client;
client = page.Request.ServerVariables["HTTP_USER_AGENT"];
int index = client.IndexOf("Windows CE", 0);
if(index == -1)
...{
this.RegisterClientScriptBlock("tpCloseAndReloadParentWindow","<script language=JavaScript> opener.window.location.replace(opener.window.location.href); window.close();</script>");
}
}
}
}
//使用这个基类例子代码片断:
protected override void SaveRelationLog(TeamplateLib.ProcessRelationLog relationlog, BProcess process)
...{
relationlog.TaskID =Request.QueryString["TID"].ToString();
relationlog.ProcessID = Request.QueryString["PID"].ToString();
relationlog.LogonName = this.CurrentUser;
relationlog.DisplayName = this.ApproveControl1.lblApproverDisName.Text;
relationlog.Type = "Actor";
relationlog.Source = process.GetTextValue("Common","Root/Request/RequestBy");
relationlog.Dept = process.GetTextValue("Common","Root/Request/Dept");
relationlog.FormNo ="Purchase Request";
relationlog.Detail =process.GetTextValue("Common","Root/Request/Supplier");
relationlog.Description =process.GetTextValue("Common","Root/Request/Description");
switch (this.ApproveControl1.ddlApproveStatus.SelectedValue)
...{
case "1":
relationlog.ApproveStatus = "Approved";
break;
case "2":
relationlog.ApproveStatus = "Declined";
break;
case "3":
relationlog.ApproveStatus = "Cancelled";
break;
}
relationlog.ApproveComment = this.ApproveControl1.txtComment.Text;
relationlog.ApproveRemark = this.ApproveControl1.txtApproveRemark.Text;
base.SaveRelationLog (relationlog, process);
}
a) 审批日志和关系保存对象(ProcessRelationLog)
这个类主要实现审批日志和关系的保存;
对象成员:
属性:
属性名称 | 属性类型 | 属性说明 |
ProcessID | string | Process ID,必须设置 |
TaskID | string | Task ID,必须设置 |
LogonName | string | 用户登录名,必须设置 |
UserID | string | 用户ID,只读 |
DisplayName | string | 用户的显示名 |
Type | string | 关系类型,必须设置 |
Source | string | 流程发起人 |
FormNo | string | 流程流水号 |
Dept | string | 部门信息 |
Category | string | 类别 |
Description | string | 描述 |
Detail | string | 细节内容 |
Others | string | 其它业务信息 |
方法:
方法名称 | 属性说明 |
AddTaskRelation | 保存任务关系 |
WriteLog | 写日志 |
namespace TeamplateBase
...{
/**////<summary>
/// TeamplateWebFormBase 的摘要说明。
///</summary>
public class TeamplateWebFormBase : System.Web.UI.Page
...{
public TeamplateWebFormBase()
...{
}
protected void LoadBindingData(BProcess process)
...{
BProcess pro = null;
try
...{
if(process == null)
...{
pro = this.LoadProcess();
}
else
...{
pro = process;
}
this.LoadData(pro);
}
catch(Exception ex)
...{
throw ex;
}
finally
...{
if(process == null && pro != null)
...{
pro.Dispose();
pro = null;
}
}
}
protected BProcess LoadProcess()
...{
int taskId;
int processId;
string token;
BProcess process = new BProcess();
try
...{
taskId = Convert.ToInt32(Request.QueryString["TID"]);
processId = Convert.ToInt32(Request.QueryString["PID"]);
token = Request.QueryString["token"];
if (token==null || taskId==0)
...{
throw new Exception("Error, Invalid process id or token!");
}
process.SetSessionToken(token);
process.Load(processId);
}
catch(Exception ex)
...{
throw ex;
}
return process;
}
protected virtual void LoadData(BProcess process)
...{
}
protected void PromoteProcess(System.Web.UI.Page page)
...{
int taskId = Convert.ToInt32(Request.QueryString["TID"]);
int processId = Convert.ToInt32(Request.QueryString["PID"]);
string token = Request.QueryString["TOKEN"];
BProcess process = null;
// 关系日志对象 Add by Sunmf
ProcessRelationLog relationlog = new ProcessRelationLog();
try
...{
process = new BProcess();
process.SetSessionToken(token);
process.Load(processId);
this.SaveBindingData(process);
process.WorkflowAdvance(taskId, null);
this.SaveRelationLog(relationlog, process);
}
finally
...{
if(process != null)
...{
process.Dispose();
process = null;
}
}
}
//由继承的窗体完成关系和日志信息的赋值
protected virtual void SaveRelationLog(ProcessRelationLog relationlog, BProcess process)
...{
relationlog.AddTaskRelation();
relationlog.WriteLog();
}
protected void SaveBindingData(BProcess process)
...{
BProcess pro = null;
try
...{
if(process == null)
...{
pro = this.LoadProcess();
}
else
...{
pro = process;
}
this.SaveData(pro);
}
catch(Exception ex)
...{
throw ex;
}
finally
...{
if(process == null && pro != null)
...{
pro.Dispose();
pro = null;
}
}
}
protected virtual void SaveData(BProcess process)
...{
}
protected void closeWindow(System.Web.UI.Page page)
...{
string client;
client = page.Request.ServerVariables["HTTP_USER_AGENT"];
int index = client.IndexOf("Windows CE", 0);
if(index == -1)
...{
this.RegisterClientScriptBlock("tpCloseAndReloadParentWindow","<script language=JavaScript> opener.window.location.replace(opener.window.location.href); window.close();</script>");
}
}
}
}
//使用这个基类例子代码片断:
protected override void SaveRelationLog(TeamplateLib.ProcessRelationLog relationlog, BProcess process)
...{
relationlog.TaskID =Request.QueryString["TID"].ToString();
relationlog.ProcessID = Request.QueryString["PID"].ToString();
relationlog.LogonName = this.CurrentUser;
relationlog.DisplayName = this.ApproveControl1.lblApproverDisName.Text;
relationlog.Type = "Actor";
relationlog.Source = process.GetTextValue("Common","Root/Request/RequestBy");
relationlog.Dept = process.GetTextValue("Common","Root/Request/Dept");
relationlog.FormNo ="Purchase Request";
relationlog.Detail =process.GetTextValue("Common","Root/Request/Supplier");
relationlog.Description =process.GetTextValue("Common","Root/Request/Description");
switch (this.ApproveControl1.ddlApproveStatus.SelectedValue)
...{
case "1":
relationlog.ApproveStatus = "Approved";
break;
case "2":
relationlog.ApproveStatus = "Declined";
break;
case "3":
relationlog.ApproveStatus = "Cancelled";
break;
}
relationlog.ApproveComment = this.ApproveControl1.txtComment.Text;
relationlog.ApproveRemark = this.ApproveControl1.txtApproveRemark.Text;
base.SaveRelationLog (relationlog, process);
}
相关文章推荐
- Teamplate 工作流开发技术总结(1)
- Teamplate 工作流开发技术总结(2)
- 提升Android开发效率的5个经验总结【同行说技术】
- IOS开发技术问题总结(六)
- linux下C开发中几点技术小总结
- linux下C开发中几点技术小总结
- JEECG V3.0版本 (工作流在线定义+UI快速开发库+代码生成器) 全新架构技术,漂亮的界面+智能代码生成+智能工作流
- Android 音频技术开发总结
- usb驱动程序开发技术总结
- 【《Real-Time Rendering 3rd》 提炼总结】(九) 第十章 · 游戏开发中基于图像的渲染技术总结
- webkit webApp 开发技术要点总结
- 与音频相关的技术知识点总结(Linux方向的开发)
- iPhone 开发过程中的一些小技术的总结
- Android 日常开发技术经验总结
- Android开发60条技术经验总结
- webkit webApp 开发技术要点总结
- Atitit 团队工具链体系打造---开发方面提升效率的软件与技术体系 attilax总结.docx
- 干货!总结19个提升iOS开发技术的必看教程!
- webkit webApp 开发技术要点总结
- [转]webkit webApp 开发技术要点总结