您的位置:软件首页 / 应用程序 / Windows Sharepoint Services v3.0,一个简单的审批工作流

Windows Sharepoint Services v3.0,一个简单的审批工作流

ZDNet 软件频道 更新时间:2007-11-03 作者: 来源:cnblogs

本文关键词:技术 微软 工作流 SharePoint

根据微软的视频作的例子,一个简单的审批流程

using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Collections;
using System.Drawing;
using System.Workflow.ComponentModel.Compiler;
using System.Workflow.ComponentModel.Serialization;
using System.Workflow.ComponentModel;
using System.Workflow.ComponentModel.Design;
using System.Workflow.Runtime;
using System.Workflow.Activities;
using System.Workflow.Activities.Rules;
using System.Xml.Serialization;
using System.Xml;
using Microsoft.SharePoint;
using Microsoft.SharePoint.Workflow;
using Microsoft.SharePoint.WorkflowActions;
using Microsoft.Office.Workflow.Utility;

namespace DemoReview
{
    
public sealed partial class Workflow1 : SharePointSequentialWorkflowActivity
    
{
        
public Workflow1()
        
{
            InitializeComponent();
        }


        
public Guid workflowId = default(System.Guid);
        
public Microsoft.SharePoint.Workflow.SPWorkflowActivationProperties workflowProperties = new Microsoft.SharePoint.Workflow.SPWorkflowActivationProperties();
        
public Guid taskId = default(System.Guid);
        
public SPWorkflowTaskProperties taskProps = new Microsoft.SharePoint.Workflow.SPWorkflowTaskProperties();
        
public SPWorkflowTaskProperties afterProps = new Microsoft.SharePoint.Workflow.SPWorkflowTaskProperties();
        
public SPWorkflowTaskProperties beforeProps = new Microsoft.SharePoint.Workflow.SPWorkflowTaskProperties();
        
        
private string assignto = default(System.String);
        
private string instructions = default(System.String);

        
private int currentreviewer = 0;

        
private string itemtitle = default(System.String);

        
private void onWorkflowActivated1_Invoked(object sender, ExternalDataEventArgs e)
        
{
            
this.workflowId = workflowProperties.WorkflowId;

            itemtitle 
= workflowProperties.Item.DisplayName;

            XmlSerializer myserializer 
= new XmlSerializer(typeof(myFields));
            XmlTextReader reader 
= new XmlTextReader(new System.IO.StringReader(workflowProperties.InitiationData));
            myFields myinitf 
= (myFields)myserializer.Deserialize(reader);

            assignto 
= (myinitf.assignees).ToString();
            instructions 
= (myinitf.instructions).ToString();
        }

        
private void workflownotFinished(object sender, ConditionalEventArgs e)
        
{
            
if (this.assignto.Split(Convert.ToChar(";")).Length < currentreviewer + 1)
            
{
                e.Result 
= false;
            }

            
else
            
{
                e.Result 
= true;
            }

        }


        
private bool isFinished = false;
        
private void taskNotFinished(object sender,ConditionalEventArgs e)
        
{
            e.Result 
= !isFinished;
        }


        
private void createTask1_MethodInvoking(object sender, EventArgs e)
        
{
            taskId 
= Guid.NewGuid();

            isFinished 
= false;

            taskProps.Title 
= "Please Review:" + itemtitle;
            taskProps.AssignedTo 
= this.assignto.Split(Convert.ToChar(";"))[this.currentreviewer].ToString();
            taskProps.Description 
= this.instructions;
            taskProps.ExtendedProperties[
"instructions"= instructions;
        }


        
private string comment = default(System.String);
        
private void onTaskChanged1_Invoked(object sender, ExternalDataEventArgs e)
        
{
            
this.isFinished = bool.Parse(afterProps.ExtendedProperties["isFinished"].ToString());
            
this.comment = afterProps.ExtendedProperties["comments"].ToString();
        }


        
private void completeTask1_MethodInvoking(object sender, EventArgs e)
        
{
            
this.currentreviewer++;
        }

    }


}

 
[an error occurred while processing this directive]
技术关注
当前技术类目:
协作办公本类技术关注比例:
2软件关注排行:2--
3企业级技术关注度:3--

协作办公技术相关文章:

文章类型收录数量
94 协作办公的解决方案:
91 协作办公的成功案例:
40 协作办公的相关产品:

软件频道 技术 最新报道

软件频道 微软 最新报道

软件频道 工作流 最新报道

软件频道 SharePoint 最新报道

爱卡汽车网 | CNET科技资讯网 | CWEEK | 蜂鸟网 | GameSpot China | 个人电脑 | 开发者在线 | PChome | Solidot | SPN |
投影顾问网 | 万维家电网 | 网友世界 | 西域IT | ZDNet China | 中关村在线 | 中小企业成长网
CNET Networks
Copyright © 1997-2007 CNET Networks 版权所有。 ZDNet 是CNET Networks公司注册服务商标。
中华人民共和国电信与信息服务业务经营许可证编号:京ICP证010391号