一:QuickFlow的安装

1,从http://quickflow.codeplex.com/下载解决方案包以及设计器。

2,将QuickFlow.dll以及QuickFlow.UI.dll添加到程序集引用。

3,将QuickFlow2010.wsp部署到站点上并激活。

4,创建一个任务列表,用来存储工作流运行后的历史。

二:QuickFlow的使用

1,发布工作流;

选择File—Publish to SharePoint—

2,创建变量;

3,给变量赋值;

在开始节点的AfterRule里面给该变量赋值

4,搜集了一些工作流中常用到的代码。

//获取列表项的Id
string itemId =this.GetVariable("ListitemID").ToString();
//获取列表
SPList cfgList = this.Web.Lists["项目备案信息"];
//获取一条数据
var cfgItem = cfgList.GetItemById(Convert.ToInt32(itemId));
//给申请人变量赋值
SPFieldUserValue ProjectUser= cfgItem.Fields.GetField("ProjectUser").GetFieldValue(cfgItem["ProjectUser"].ToString()) as SPFieldUserValue;
//this.SetVariable("人员", ProjectUser.User.LoginName);
//给项目区域赋值
SPFieldLookupValue proprovince=cfgItem.Fields.GetField("ProjectProvince").GetFieldValue(cfgItem["ProjectProvince"].ToString()) as SPFieldLookupValue ;
this.SetVariable("项目区域",proprovince.LookupValue);
//给项目大区赋值
SPFieldLookupValue probigZone=cfgItem.Fields.GetField("BigZone").GetFieldValue(cfgItem["BigZone"].ToString()) as SPFieldLookupValue ;
this.SetVariable("项目大区",probigZone.LookupValue);
//给项目战区赋值
SPFieldLookupValue proWarZone=cfgItem.Fields.GetField("WarZone").GetFieldValue(cfgItem["WarZone"].ToString()) as SPFieldLookupValue ;
this.SetVariable("项目战区",proWarZone.LookupValue); //到员工信息表中查询总经理
QueryField qfloginname=new QueryField("LoginName");
QueryField headManager=new QueryField("Role"); SPList cfgListEmploy = this.Web.Lists["员工信息"];
//获取一条数据
SPListItemCollection cfgItemhead=ListQuery.From(cfgListEmploy).Where(headManager=="总经理").GetItems(); if(cfgItemhead.Count>)
{
this.SetVariable("总经理",cfgItemhead[]["LoginName"]);
} //获取一条数据
var cfgItemEmploy = ListQuery.From(cfgListEmploy).Where(qfloginname==ProjectUser.User.LoginName).GetItems()[];
if(cfgItemEmploy!=null)
{ this.SetVariable("人员",cfgItemEmploy["Title"]); //给人员区域赋值
SPFieldLookupValue provinceEmploy=cfgItemEmploy.Fields.GetField("Province").GetFieldValue(cfgItemEmploy["Province"].ToString()) as SPFieldLookupValue;
this.SetVariable("人员区域",provinceEmploy.LookupValue); //给人员大区赋值
SPFieldLookupValue BigZoneEmploy=cfgItemEmploy.Fields.GetField("BigZone").GetFieldValue(cfgItemEmploy["BigZone"].ToString()) as SPFieldLookupValue;
this.SetVariable("人员大区",BigZoneEmploy.LookupValue); //给人员战区赋值
SPFieldLookupValue WarZoneEmploy=cfgItemEmploy.Fields.GetField("WarZone").GetFieldValue(cfgItemEmploy["WarZone"].ToString()) as SPFieldLookupValue;
this.SetVariable("人员战区",WarZoneEmploy.LookupValue);
//给申请人上级经理赋值
SPFieldUserValue TopManager= cfgItemEmploy.Fields.GetField("Manager").GetFieldValue(cfgItemEmploy["Manager"].ToString()) as SPFieldUserValue;
this.SetVariable("申请人上级经理", TopManager.User.LoginName); //到大区表中查询数据
SPList cfgListBigZone = this.Web.Lists["大区"];
//获取一条数据 var cfgItemUserBigZone = cfgListBigZone.GetItemById(BigZoneEmploy.LookupId);
var cfgItemProBigZone = cfgListBigZone.GetItemById(probigZone.LookupId);
//给申请人大区经理赋值
if(cfgItemUserBigZone!=null)
{
SPFieldUserValue UserBigZoneManager= cfgItemUserBigZone.Fields.GetField("Manager").GetFieldValue(cfgItemUserBigZone["Manager"].ToString()) as SPFieldUserValue;
this.SetVariable("申请人大区经理",UserBigZoneManager.User.LoginName); }
//给项目大区经理赋值
if(cfgItemProBigZone!=null)
{
SPFieldUserValue ProBigZoneManager= cfgItemProBigZone.Fields.GetField("Manager").GetFieldValue(cfgItemProBigZone["Manager"].ToString()) as SPFieldUserValue;
this.SetVariable("项目大区经理", ProBigZoneManager.User.LoginName); }
//到战区表中查询数据
SPList cfgListwarZone = this.Web.Lists["战区"]; //获取一条数据
var cfgItemUserWarZone=cfgListwarZone.GetItemById(WarZoneEmploy.LookupId);
var cfgItemProWarZone=cfgListwarZone.GetItemById(proWarZone.LookupId); if(cfgItemUserWarZone!=null)
{
//给申请人战区经理赋值
SPFieldUserValue UserWarZoneManager= cfgItemUserWarZone.Fields.GetField("Manager").GetFieldValue(cfgItemUserWarZone["Manager"].ToString()) as SPFieldUserValue;
this.SetVariable("申请人战区经理", UserWarZoneManager.User.LoginName);
}
if(cfgItemProWarZone!=null)
{
//给项目战区经理赋值
SPFieldUserValue ProWarZoneManager= cfgItemProWarZone.Fields.GetField("Manager").GetFieldValue(cfgItemProWarZone["Manager"].ToString()) as SPFieldUserValue;
this.SetVariable("项目战区经理", ProWarZoneManager.User.LoginName);
} }

最新文章

  1. 【Python实战】Django建站笔记
  2. C# DateTime 格式化 奇怪问题!
  3. Highcharts使用
  4. NoSQL学习——MongoDB
  5. [转]Stop Sharing Session State between Multiple Tabs of Browser
  6. 在多线程环境中使用CoreData
  7. QC学习二:QC使用中问题点汇总
  8. delphi函数调用约定
  9. mybatis随意sql语句
  10. docke 网络配置
  11. ios 网络数据下载和JSON解析
  12. AVFoundation 框架初探究(一)
  13. [Swift]LeetCode763. 划分字母区间 | Partition Labels
  14. eclipse部分常用快捷键
  15. ansible常用命令
  16. sed memo 2
  17. 利用SVD-推荐未尝过的菜肴
  18. vs2015 编译google v8
  19. mysql 存储过程用程序调的问题
  20. oaf 动态创建table vo (转)

热门文章

  1. safari
  2. hdu5824 graph
  3. cf1060C. Maximum Subrectangle(思维 枚举)
  4. 1142 奖学金 sort做法
  5. laravel开发之-安装laravel-admin
  6. git基础命令。
  7. CSS技巧教程:margin在IE中的表现
  8. Qt初学——我的第一个UI
  9. Sql server字段排序,如果字段是字符型的数字
  10. rabbitmq集群方案