/// <summary>
/// 代码发起流程
/// </summary>
/// <param name="id">新发起流程所有者</param>
/// <param name="folderid">新发起流程模型所在文件夹ID</param>
/// <param name="modelid">新发起流程模型ID</param>
/// <param name="newid">新发起流程的PID</param>
/// <returns>true,false</returns>
public bool CreateProcess(int id, int folderid, int modelid, out int newid)
{
BProcess apro = null; bool isCreateOK = false; int subID = 0;
try
{
//先声明一个BProcess对象,然后对它进行SetSessionToken,
string token = "";
if (Request["Token"] != null && Request["Token"].Length > 0)
{
token = Request["Token"];
}
else if (Session["SessionToken"] != null)
{
token = Session["SessionToken"].ToString();
}
if (token != "")
{
apro = new BProcess();
apro.SetSessionToken(token);
BModel bmodel = new BModel(); bmodel.SetSessionToken(token);
int userid = id;
//新发起process名称、新发起流程模型所在文件夹ID、新发起流程所有者、新发起流程模型ID
apro.Add("", folderid, userid, modelid); isCreateOK = true;
}
}
catch (Exception ex)
{
isCreateOK = false;
}
finally
{
apro.Dispose();//释放资源
}
newid = subID;
return isCreateOK;
}