本文整理汇总了C#中Connection.OpenWorklistItem方法的典型用法代码示例。如果您正苦于以下问题:C# Connection.OpenWorklistItem方法的具体用法?C# Connection.OpenWorklistItem怎么用?C# Connection.OpenWorklistItem使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Connection
的用法示例。
在下文中一共展示了Connection.OpenWorklistItem方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ProcessBase
public ProcessBase(Connection conn, string sn)
{
//Get the WorklistItem object
WorklistItem wi = conn.OpenWorklistItem(sn);
//get the processing instance object
ProcessInstance pi = wi.ProcessInstance;
InitializeDataFields(pi.DataFields);
this._conn = conn;
this._sn = sn;
this.Actions = wi.Actions;
this.Folio = pi.Folio;
}
示例2: ApprovalProcess
/// <summary>
/// 审批流程
/// </summary>
/// <param name="userName"></param>
/// <param name="sn"></param>
/// <param name="actionString"></param>
/// <param name="memo"></param>
/// <param name="dataFields"></param>
public WorklistItem ApprovalProcess(string userName, string sn, string actionString, string memo, Dictionary<string, string> dataFields)
{
Connection k2Connection = new Connection();
try
{
k2Connection.Open(ConfigurationBase.Web.K2Server, ConfigurationBase.Web.K2LoginString);
k2Connection.ImpersonateUser(userName);
//根据SN打开工作项
WorklistItem workList = k2Connection.OpenWorklistItem(sn);
if (workList != null)
{
#region 更新Datafield
if (dataFields != null && dataFields.Count > 0)
{
ProcessInstance currentProcessInst = k2Connection.OpenProcessInstance(workList.ProcessInstance.ID);
//更新Datafields
foreach (string key in dataFields.Keys)
{
if (currentProcessInst.DataFields[key] != null)
{
if (currentProcessInst.DataFields[key].Value!= dataFields[key])
{
currentProcessInst.DataFields[key].Value = dataFields[key];
}
}
}
currentProcessInst.Update();
}
#endregion
#region 审批任务
//批量审批没有actionString,默认第一个操作
if (string.IsNullOrEmpty(actionString))
{
if (workList.Actions[0].Name == REJECTACTION)
{
workList.GotoActivity("流程未通过");
}
else if (workList.Actions[0].Name == UNDOACTION)
{
workList.GotoActivity("流程撤销");
}
else
{
workList.Actions[0].Execute();
}
}
else
{
//执行匹配的操作
if (actionString == UNDOACTION)
{
workList.GotoActivity("流程撤销");
}
else if (actionString == REJECTACTION)
{
workList.GotoActivity("流程未通过");
}
else
{
bool isExcuted = false;
for (int i = 0; i < workList.Actions.Count; i++)
{
if (workList.Actions[i].Name == actionString)
{
workList.Actions[i].Execute();
isExcuted = true;
break;
}
}
}
}
#endregion
}
return workList;
}
catch (Exception)
{
return null;
}
finally
{
if (k2Connection != null)
{
k2Connection.Close();
}
}
}
示例3: RedirectWorklistItem
private void RedirectWorklistItem()
{
string sn = base.GetStringProperty(Constants.SOProperties.ClientWorklist.SerialNumber, true);
string fqn = base.GetStringProperty(Constants.SOProperties.ClientWorklist.FQN, true);
using (Connection k2Con = new Connection())
{
k2Con.Open(base.K2ClientConnectionSetup);
WorklistItem wli = k2Con.OpenWorklistItem(sn);
wli.Redirect(fqn);
k2Con.Close();
}
}
示例4: ReleaseWorklistItem
private void ReleaseWorklistItem()
{
string sn = base.GetStringProperty(Constants.SOProperties.ClientWorklist.SerialNumber, true);
ServiceObject serviceObject = base.ServiceBroker.Service.ServiceObjects[0];
serviceObject.Properties.InitResultTable();
DataTable results = base.ServiceBroker.ServicePackage.ResultTable;
using (Connection k2Con = new Connection())
{
k2Con.Open(base.K2ClientConnectionSetup);
WorklistItem wli = k2Con.OpenWorklistItem(sn);
wli.Release();
k2Con.Close();
}
}
示例5: ApproveK2Process
public ResultModel ApproveK2Process(string sn, int loginId, string actionString, string memo, Dictionary<string, string> dataFields, out string activityName, out string processCode, out int procInstID)
{
Connection k2Connect = null;
WorklistItem workList = null;
ResultModel jr = new ResultModel() { Code = ResultCode.Fail };
activityName = string.Empty;
processCode = string.Empty;
procInstID = 0;
try
{
k2Connect = new Connection();
k2Connect.Open(ConfigurationManager.AppSettings["K2Server"], ConfigurationManager.AppSettings["K2LoginString"]);
k2Connect.ImpersonateUser(SecurityLable(loginId.ToString()));
workList = k2Connect.OpenWorklistItem(sn);
if (workList != null)
{
#region 更新Datafield
if (dataFields != null && dataFields.Count > 0)
{
ProcessInstance CurrentProcessInst = workList.ProcessInstance;
//更新Datafields
foreach (string key in dataFields.Keys)
{
if (CurrentProcessInst.DataFields[key] != null)
{
if (CurrentProcessInst.DataFields[key].Value.ToString() != dataFields[key])
{
CurrentProcessInst.DataFields[key].Value = dataFields[key];
}
}
}
}
#endregion
#region 审批任务
//批量审批没有actionString,默认第一个操作
if (string.IsNullOrEmpty(actionString))
{
if (workList.Actions[0].Name == REJECTACTION)
{
workList.GotoActivity("流程未通过");
}
else if (workList.Actions[0].Name == UNDOACTION)
{
workList.GotoActivity("流程撤销");
}
else
{
workList.Actions[0].Execute();
}
}
else
{
//执行匹配的操作
if (actionString == UNDOACTION)
{
workList.GotoActivity("流程撤销");
}
else if (actionString == REJECTACTION)
{
workList.GotoActivity("流程未通过");
}
else
{
bool isExcute = false;
for (int i = 0; i < workList.Actions.Count; i++)
{
if (workList.Actions[i].Name == actionString)
{
workList.Actions[i].Execute();
isExcute = true;
break;
}
}
if (!isExcute)
{
jr.Code = ResultCode.Fail;
jr.Msg = string.Format("Action:{0}错误", actionString);
return jr;
}
}
}
#endregion
jr.Code = ResultCode.Sucess;
jr.Msg = "";
activityName = workList.ActivityInstanceDestination.Name;
processCode = workList.ProcessInstance.DataFields["ProcessCode"].Value.ToString();
procInstID = workList.ProcessInstance.ID;
}
}
catch (Exception ex)
{
jr.Msg = ex.Message;
}
finally
{
if (workList != null)
{
//.........这里部分代码省略.........
示例6: WorkItemAction
public Boolean WorkItemAction(string serialno, string action)
{
//TODO - Move into K2 Helpers
Connection K2Conn = new Connection();
SCConnectionStringBuilder K2ConnString = new SCConnectionStringBuilder();
//Setup Connection String
K2ConnString.Host = "Win2012-K2";
K2ConnString.Integrated = false;
K2ConnString.UserID = "Sa4Demo\\Tberry";
K2ConnString.Password = "Sa42013!";
K2ConnString.Port = 5252;
K2ConnString.WindowsDomain = "Sa4Demo";
K2ConnString.SecurityLabelName = "K2";
K2ConnString.Authenticate = true;
K2ConnString.IsPrimaryLogin = true;
K2Conn.Open("Win2012-K2", K2ConnString.ConnectionString);
SourceCode.Workflow.Client.WorklistItem worklistItem = K2Conn.OpenWorklistItem(serialno);
// action the workflow by executing the action
if (worklistItem.Actions.Count > 0)
{
worklistItem.Actions[action].Execute();
return (true);
}
else { return (false); }
}
示例7: ReAssign
public ResultModel ReAssign(string sn, int assignFrom, int assignTo, out string activityName, out string processCode, out int procInstID)
{
Connection k2Connect = null;
WorklistItem workList = null;
ResultModel jr = new ResultModel() { Code = ResultCode.Fail };
activityName = string.Empty;
processCode = string.Empty;
procInstID = 0;
try
{
k2Connect = new Connection();
k2Connect.Open(ConfigurationManager.AppSettings["K2Server"], ConfigurationManager.AppSettings["K2LoginString"]);
k2Connect.ImpersonateUser(SecurityLable(assignFrom.ToString()));
workList = k2Connect.OpenWorklistItem(sn);
if (workList != null )
{
workList.Redirect(SecurityLable(assignTo.ToString()));
jr.Code = ResultCode.Sucess;
jr.Msg = "";
activityName = workList.ActivityInstanceDestination.Name;
processCode = workList.ProcessInstance.DataFields["ProcessCode"].Value.ToString();
procInstID = workList.ProcessInstance.ID;
}
}
catch (Exception ex)
{
jr.Msg = ex.Message;
}
finally
{
if (workList != null)
{
if (workList.Status == WorklistStatus.Open)
{
try
{
k2Connect.RevertUser();
workList.Release();
}
catch { }
}
}
if (k2Connect != null)
k2Connect.Close();
}
return jr;
}
示例8: LoadWorklistItem
internal DataTable LoadWorklistItem(string serialNumber)
{
ConnectionSetup connectSetup = new ConnectionSetup();
connectSetup.ConnectionString = _connectionString;
Connection cnn = new Connection();
DataTable dt = GetResultTable();
try
{
cnn.Open(connectSetup);
WorklistItem item = cnn.OpenWorklistItem(serialNumber);
DataRow row = dt.NewRow();
row["AllocatedUser"] = item.AllocatedUser;
row["Data"] = item.Data;
row["ID"] = item.ID;
row["Link"] = "<hyperlink><link>" + HttpUtility.HtmlEncode(item.Data) + "</link><display>Open</display></hyperlink>";
row["SerialNumber"] = item.SerialNumber;
row["Status"] = item.Status;
row["ActivityID"] = item.ActivityInstanceDestination.ActID;
row["ActivityInstanceID"] = item.ActivityInstanceDestination.ActInstID;
row["ActivityName"] = item.ActivityInstanceDestination.Name;
row["Priority"] = item.ActivityInstanceDestination.Priority;
row["StartDate"] = item.EventInstance.StartDate;
row["ActivityInstanceDestinationID"] = item.ActivityInstanceDestination.ID;
row["ProcessInstanceID"] = item.ProcessInstance.ID;
row["ProcessFullName"] = item.ProcessInstance.FullName;
row["ProcessName"] = item.ProcessInstance.Name;
row["Folio"] = item.ProcessInstance.Folio;
row["EventInstanceName"] = item.EventInstance.Name;
dt.Rows.Add(row);
return dt;
}
catch (Exception ex)
{
throw ex;
}
finally
{
cnn.Close();
cnn.Dispose();
}
}
示例9: GetWorklistItemBySN
public WorklistItem GetWorklistItemBySN(string serialNumber, String impersonateUser)
{
using (var k2Connection = new Connection())
{
ConnectionSetup k2Setup = new ConnectionSetup();
k2Setup.ConnectionString = Properties.Settings.Default.WorkflowServerConnectionString;
k2Connection.Open(k2Setup);
if (!String.IsNullOrEmpty(impersonateUser))
k2Connection.ImpersonateUser(impersonateUser);
return k2Connection.OpenWorklistItem(serialNumber);
}
}
示例10: LoadWorklistItem
internal DataTable LoadWorklistItem(string serialNumber)
{
if (string.IsNullOrEmpty(serialNumber))
throw new ArgumentException("Value must not be null or empty.", "serialNumer");
try
{
DataTable dt = GetResultTable();
DataRow row = dt.NewRow();
ConnectionSetup cnnSetup = new ConnectionSetup();
cnnSetup.ConnectionString = this._execSettings.ConnectionString;
using (Connection cnn = new Connection())
{
cnn.Open(cnnSetup);
if (this._execSettings.UseImpersonation)
cnn.ImpersonateUser(this._execSettings.ImpersonateUser);
WorklistItem item = cnn.OpenWorklistItem(serialNumber);
if (item != null)
{
PopulateDataRow(item, row);
dt.Rows.Add(row);
}
cnn.Close();
}
return dt;
}
catch (Exception ex)
{
throw ex;
}
}
示例11: GetWorklistItemBySN
public WorklistItem GetWorklistItemBySN(string serialNumber, String impersonateUser)
{
// if the serial number is null or empty we do not want to do any of this
if (!string.IsNullOrEmpty(serialNumber))
{
using (var k2Connection = new Connection())
{
ConnectionSetup k2Setup = new ConnectionSetup();
k2Setup.ConnectionString = Properties.Settings.Default.WorkflowServerConnectionString;
k2Connection.Open(k2Setup);
if (!String.IsNullOrEmpty(impersonateUser))
k2Connection.ImpersonateUser(impersonateUser);
return k2Connection.OpenWorklistItem(serialNumber);
}
}
return null;
}