本文整理匯總了C#中Slickflow.Engine.Service.WorkflowService.GetFirstActivity方法的典型用法代碼示例。如果您正苦於以下問題:C# WorkflowService.GetFirstActivity方法的具體用法?C# WorkflowService.GetFirstActivity怎麽用?C# WorkflowService.GetFirstActivity使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Slickflow.Engine.Service.WorkflowService
的用法示例。
在下文中一共展示了WorkflowService.GetFirstActivity方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: InitStepMember
/// <summary>
///
/// </summary>
protected void InitStepMember()
{
//流程定義的GUID
string flowGuid = Request.QueryString["ProcessGUID"] == null ? "" : Request.QueryString["ProcessGUID"].ToString();
string Step = Request.QueryString["Step"] == null ? "" : Request.QueryString["Step"].ToString();
if (string.IsNullOrEmpty(flowGuid) || string.IsNullOrEmpty(Step))
{
base.RegisterStartupScript("", "<script>alert('流程GUID為空');</script>");
}
else
{
String processGUID = flowGuid;
IWorkflowService service = new WorkflowService();
switch (Step)
{
case "start"://流程第一步選擇
ActivityEntity firstActivity = service.GetFirstActivity(processGUID);
String firstActivityGUID = firstActivity.ActivityGUID;
string conditions = Request.QueryString["condition"] == null ? "" : Request.QueryString["condition"].ToString();
IList<NodeView> nextNodes = service.GetNextActivity(processGUID, firstActivityGUID, GetCondition(conditions));
if (nextNodes != null)
{
Repeater1.DataSource = nextNodes;
Repeater1.DataBind();
}
else
{
LiteralMSG.Text = "當前沒有需要您辦理的步驟";
}
break;
case "task":
try
{
if (LoginUserID > 0)
{
string condition = Request.QueryString["condition"] == null ? "" : Request.QueryString["condition"].ToString();
string instanceId = Request.QueryString["instanceId"] == null ? string.Empty : Request.QueryString["instanceId"].ToString();
WfAppRunner runner = new WfAppRunner();
runner.AppInstanceID = instanceId;
runner.ProcessGUID = processGUID;
runner.UserID = this.LoginUserID.ToString();
hiddenIsSelectMember.Value = "true";
IList<NodeView> NodeViewList = service.GetNextActivityTree(runner, GetCondition(condition));
if (NodeViewList != null)
{
Repeater1.DataSource = NodeViewList;
Repeater1.DataBind();
if (NodeViewList.Count == 1)
{
string nextActivityGuid = NodeViewList[0].ActivityGUID;
/*
ActivityEntity activityEntity = service.GetActivityInstance(processGUID, nextActivityGuid);
if (activityEntity.ActivityType == ActivityTypeEnum.EndNode)
{
hiddenIsSelectMember.Value = "false";
}*/
}
}
else
{
LiteralMSG.Text = "當前沒有需要您辦理的步驟";
}
}
}
catch (Exception ex)
{ }
break;
}
}
}
示例2: InitStepMember
/// <summary>
///
/// </summary>
protected void InitStepMember()
{
string strNodes = string.Empty;
//流程定義的GUID
string flowGuid = Request.QueryString["ProcessGUID"] == null ? "" : Request.QueryString["ProcessGUID"].ToString();
string Step = Request.QueryString["Step"] == null ? "" : Request.QueryString["Step"].ToString();
if (string.IsNullOrEmpty(flowGuid) || string.IsNullOrEmpty(Step))
{
base.RegisterStartupScript("", "<script>alert('流程GUID為空');</script>");
}
else
{
List<ZTreeEntity> zTreeEntityList = new List<ZTreeEntity>();
String processGUID = flowGuid;
IWorkflowService service = new WorkflowService();
switch (Step)
{
case "start"://流程第一步選擇
ActivityEntity firstActivity = service.GetFirstActivity(processGUID, string.Empty);
String firstActivityGUID = firstActivity.ActivityGUID;
string conditions = Request.QueryString["condition"] == null ? "" : Request.QueryString["condition"].ToString();
IList<NodeView> nextNodes = service.GetNextActivity(processGUID, string.Empty, firstActivityGUID, GetCondition(conditions));
if (nextNodes != null)
{
if (nextNodes != null)
{
ZTreeEntity zTreeEntity = null;
foreach (NodeView item in nextNodes)
{
zTreeEntity = new ZTreeEntity();
zTreeEntity.id = string.Format("step[{0}]", item.ActivityGUID);
zTreeEntity.pId = "0";
zTreeEntity.name = item.ActivityName;
zTreeEntity.nocheck = false;
zTreeEntityList.Add(zTreeEntity);
DataTable dt = GetUsers(item.Roles);
foreach (DataRow dr in dt.Rows)
{
zTreeEntity = new ZTreeEntity();
zTreeEntity.id = string.Format("step[{0}]member[{1}]", item.ActivityGUID, dr["ID"].ToString());
zTreeEntity.pId = string.Format("step[{0}]", item.ActivityGUID);
zTreeEntity.name = dr["UserName"].ToString();
zTreeEntity.nocheck = false;
zTreeEntityList.Add(zTreeEntity);
}
}
}
}
else
{
LiteralMSG.Text = "當前沒有需要您辦理的步驟";
}
break;
case "task":
try
{
if (LoginUserID > 0)
{
string condition = Request.QueryString["condition"] == null ? "" : Request.QueryString["condition"].ToString();
string instanceId = Request.QueryString["instanceId"] == null ? string.Empty : Request.QueryString["instanceId"].ToString();
WfAppRunner runner = new WfAppRunner();
runner.AppInstanceID = instanceId;
runner.ProcessGUID = processGUID;
runner.UserID = this.LoginUserID.ToString();
hiddenIsSelectMember.Value = "true";
IList<NodeView> NodeViewList = service.GetNextActivityTree(runner, GetCondition(condition));
if (NodeViewList != null)
{
ZTreeEntity zTreeEntity = null;
foreach (NodeView item in NodeViewList)
{
zTreeEntity = new ZTreeEntity();
zTreeEntity.id = string.Format("step[{0}]", item.ActivityGUID);
zTreeEntity.pId = "0";
zTreeEntity.name = item.ActivityName;
zTreeEntityList.Add(zTreeEntity);
DataTable dt = GetUsers(item.Roles);
foreach (DataRow dr in dt.Rows)
{
zTreeEntity = new ZTreeEntity();
zTreeEntity.id = string.Format("step[{0}]member[{1}]", item.ActivityGUID, dr["ID"].ToString());
zTreeEntity.pId = string.Format("step[{0}]", item.ActivityGUID);
zTreeEntity.name = dr["UserName"].ToString();
zTreeEntity.nocheck = false;
zTreeEntityList.Add(zTreeEntity);
}
}
}
else
//.........這裏部分代碼省略.........
示例3: Add
public async Task<ActionResult> Add(LeaveViewModel leave)
{
string processGUID = leave.ProcessGUID;
//驗證不通過,重新填寫表單
if (!ModelState.IsValid)
{
return View();
}
IWorkflowService service = new WorkflowService();
//流程開始第一步
ActivityEntity firstActivity = service.GetFirstActivity(leave.ProcessGUID);
//該處較上一版本有變化,上一版本為GUID類型
string firstActivityGUID = firstActivity.ActivityGUID;
IList<NodeView> nextActivity = service.GetNextActivity(leave.ProcessGUID, firstActivityGUID, GetCondition("days-" + leave.Days));
//表示有下一位審批者
if (nextActivity.Count() > 0)
{
//下一步角色ID審批者
string outerId = nextActivity[0].Roles[0].ID.ToString();
//這裏隻取第一個審批者,WebDemo 是彈窗形式選擇
//審批用戶id
IEnumerable<int> userId = RoleManager.FindById(Convert.ToInt32(outerId)).Users.Select(t => t.UserId);
ApplicationUser user = await UserManager.FindByIdAsync(Convert.ToInt32(userId.ToList()[0]));
//提交請假信息
LeaveEntity leaveE = new LeaveEntity()
{
FromDate = leave.BeginTime,
ToDate = leave.EndTime,
Days = leave.Days,
LeaveType = leave.LeaveType,
CurrentActivityText = "",
Status = 0,
CreatedUserID = Convert.ToInt32(User.Identity.GetUserId()),
CreatedUserName = User.Identity.Name,
CreatedDate = DateTime.Now
};
HrsLeaveResult result = new WorkFlowManager().Insert(leaveE);
if (result.Successed)
{
WfAppRunner initiator = new WfAppRunner();
initiator.AppName = "請假流程";
initiator.AppInstanceID = result.ResultIdentities.ToString();
initiator.ProcessGUID = processGUID;
initiator.UserID = User.Identity.GetUserId();
initiator.UserName = User.Identity.Name;
initiator.Conditions = GetCondition(string.Format("days-{0}", leave.Days));
WfExecutedResult startedResult = service.StartProcess(initiator);
if (startedResult.Status != WfExecutedStatus.Success)
{
//給出提示
}
//送往下一步
PerformerList pList = new PerformerList();
//這裏使用真實姓名代替
pList.Add(new Performer(user.Id.ToString(), user.RealName));
initiator.NextActivityPerformers = new Dictionary<String, PerformerList>();
initiator.NextActivityPerformers.Add(nextActivity[0].ActivityGUID, pList);
WfExecutedResult runAppResult = service.RunProcessApp(initiator);
if (runAppResult.Status != WfExecutedStatus.Success)
{
this.Content("<script>alert('" + runAppResult.Message + "');</script>");
}
//保存業務數據
BizAppFlowEntity AppFlowEntity = new BizAppFlowEntity();
AppFlowEntity.AppName = "流程發起";
AppFlowEntity.AppInstanceID = result.ResultIdentities.ToString();
AppFlowEntity.ActivityName = "流程發起";
AppFlowEntity.Remark = string.Format("申請人:{0}-{1}", User.Identity.GetUserId(), User.Identity.Name);
AppFlowEntity.ChangedTime = DateTime.Now;
AppFlowEntity.ChangedUserID = User.Identity.GetUserId();
AppFlowEntity.ChangedUserName = User.Identity.Name;
HrsLeaveResult resultBiz = new WorkFlowManager().Insert(AppFlowEntity);
if (resultBiz.Successed)
{
//給出前台提示
this.Content("", "<script>alert('流程發起成功');</script>");
}
}
}
else
{
//顯示前台錯誤,人事人員審批失敗
ModelState.AddModelError("Human", "該用戶暫時不可提交審批,未查詢到該用戶的下一位審批者");
return View();
}
return RedirectToAction("MySlickflow", "Slickflow");
}