SharePoint State Machine Workflow +ASP.NET ASPX Form step by step(3)-创建Instantiation Form
2008-12-19 09:50
435 查看
创建一个Instantiation表单,其实和创建一个Association表单是十分相识的,我也不像在这里把代码一一的贴出来,最后我会把所有的工程一次性的贴出来的.
在前面创建Association Form的时候,为了简化过程,我没有讲如何将Association Data传到workflow中,并在Instantiation Form中使用.
首先,为了简化,Association表单和Instantiation表单是一样的,两个表单都是一个PeoplePicker和一个TextBox,所以用于表示两个表单数据的类是相同的,只不过为了让代码看起来更清楚点,我定义了两个类,完全一样,只不过名字是不同的.
Code
public string serializeInstantiationFormDataToXML()
{
InstantiationData mydata = new InstantiationData();
string serializedDataToReturn;
foreach (PickerEntity pe in Reviewers.ResolvedEntities)
{
mydata.AddContact(pe.Key);
}
mydata.Description = Description.Text;
.
using (MemoryStream stream = new MemoryStream())
{
XmlSerializer serializer = new XmlSerializer(typeof(InstantiationData));
serializer.Serialize(stream, mydata);
stream.Position = 0;
byte[] bytes = new byte[stream.Length];
stream.Read(bytes, 0, bytes.Length);
serializedDataToReturn = Encoding.UTF8.GetString(bytes);
}
return serializedDataToReturn;
}
private AssociationData DeserializeAssoicationData(string dataPassedIn)
{
XmlSerializer serializer = new XmlSerializer(typeof(AssociationData));
XmlTextReader reader = new XmlTextReader(new System.IO.StringReader(dataPassedIn));
AssociationData deserializedAssociationFormData = (AssociationData)serializer.Deserialize(reader);
return deserializedAssociationFormData;
}
至于Instantiation表单的ASPX页面,对于我来说,是很Assocaition页面是完全一样的,除了最开始的Inherit属性不同之外,其它的完全一样.而其相应的后台代码,和Association的后台代码是十分相似的,大家到时候看看代码就明白了.
在前面创建Association Form的时候,为了简化过程,我没有讲如何将Association Data传到workflow中,并在Instantiation Form中使用.
首先,为了简化,Association表单和Instantiation表单是一样的,两个表单都是一个PeoplePicker和一个TextBox,所以用于表示两个表单数据的类是相同的,只不过为了让代码看起来更清楚点,我定义了两个类,完全一样,只不过名字是不同的.
Code
public string serializeInstantiationFormDataToXML()
{
InstantiationData mydata = new InstantiationData();
string serializedDataToReturn;
foreach (PickerEntity pe in Reviewers.ResolvedEntities)
{
mydata.AddContact(pe.Key);
}
mydata.Description = Description.Text;
.
using (MemoryStream stream = new MemoryStream())
{
XmlSerializer serializer = new XmlSerializer(typeof(InstantiationData));
serializer.Serialize(stream, mydata);
stream.Position = 0;
byte[] bytes = new byte[stream.Length];
stream.Read(bytes, 0, bytes.Length);
serializedDataToReturn = Encoding.UTF8.GetString(bytes);
}
return serializedDataToReturn;
}
private AssociationData DeserializeAssoicationData(string dataPassedIn)
{
XmlSerializer serializer = new XmlSerializer(typeof(AssociationData));
XmlTextReader reader = new XmlTextReader(new System.IO.StringReader(dataPassedIn));
AssociationData deserializedAssociationFormData = (AssociationData)serializer.Deserialize(reader);
return deserializedAssociationFormData;
}
至于Instantiation表单的ASPX页面,对于我来说,是很Assocaition页面是完全一样的,除了最开始的Inherit属性不同之外,其它的完全一样.而其相应的后台代码,和Association的后台代码是十分相似的,大家到时候看看代码就明白了.
相关文章推荐
- SharePoint State Machine Workflow +ASP.NET ASPX Form step by step(2)-创建Association Form
- SharePoint State Machine Workflow +ASP.NET ASPX Form step by step(1)-创建Workflow Content Type
- Session state cannot be used in ASP.NET with Windows SharePoint Services
- Step by step Install SharePoint Workflow Manager
- Step by step create three status workflow in SharePoint 2010
- SharePoint Server 2013 Step By Step创建第一个网站集
- SharePoint Server 2013 Step By Step之创建子网站
- 通过HTTP抓包,深入理解ASP.NET WebForm ViewState
- 在SharePoint Server 2016 RC 中利用ASP.Net SQL MemberShip和Role Provider为Web Application配置Forms-based身份验证
- Step By Step Installing Sharepoint 2013 On Windows Server 2008 R2
- ASP.NET(ASPX)页面获取form表单提交元素的值
- ASP.NET组件设计Step by Step(7)
- Installing SharePoint 2007 by using different versions of .net framework
- ASP.NET组件设计Step by Step
- ASP.NET组件设计Step by Step(7)
- 如何使用SharePoint Designer创建自定义的Workflow?
- 【ASP.NET Step by Step】之三 Master Pages and Site Navigation
- 【ASP.NET Step by Step】之五 Declarative Parameters
- SharePoint Server 2013 Step By Step之管理网站导航
- ASP.NET组件设计Step by Step(5)