本文整理匯總了C#中Slickflow.Engine.Service.WorkflowService.GetProcessById方法的典型用法代碼示例。如果您正苦於以下問題:C# WorkflowService.GetProcessById方法的具體用法?C# WorkflowService.GetProcessById怎麽用?C# WorkflowService.GetProcessById使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Slickflow.Engine.Service.WorkflowService
的用法示例。
在下文中一共展示了WorkflowService.GetProcessById方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: btnSendNext_Click
//送往下一步
protected void btnSendNext_Click(object sender, EventArgs e)
{
try
{
string processGUID = this.txtProcessGUID.Value.ToString();
string stepGuid = this.hiddenStepGuid.Value.ToString();
int stepUserID = Helper.ConverToInt32(this.hiddenStepUser.Value.ToString().Trim());
decimal days = Helper.ConverToDecimal(this.txtDays.Value);
string instanceId = this.hiddenInstanceId.Value;
string DepManagerRemark = this.txtDepmanagerRemark.Value;
string DirectorRemark = this.txtDirectorRemark.Value;
string DeputyGeneralRemark = this.txtDeputyGeneralRemark.Value;
string GeneralManagerRemark = this.txtGeneralManagerRemark.Value;
int activityInstanceID = Helper.ConverToInt32(hiddenActivityInstanceID.Value);
string CurrentActivityText = string.Empty; ;
int nextUserID = 0;
string nextUserName = string.Empty;
SysUserEntity userEntity = WorkFlows.GetSysUserModel(stepUserID);
if (userEntity != null && userEntity.ID > 0)
{
nextUserID = userEntity.ID;
nextUserName = userEntity.UserName;
}
DateTime now = DateTime.Now;
if (!string.IsNullOrEmpty(instanceId))
{
//調用流程
IWorkflowService service = new WorkflowService();
WfAppRunner initiator = new WfAppRunner();
initiator.AppName = "請假流程";
initiator.AppInstanceID = instanceId;
initiator.ProcessGUID = processGUID;
initiator.UserID = LoginUserID.ToString();
initiator.UserName = LoginUserName;
initiator.Conditions = GetCondition(string.Format("days-{0}", days));
//送往下一步
PerformerList pList = new PerformerList();
pList.Add(new Performer(nextUserID.ToString(), nextUserName));
initiator.NextActivityPerformers = new Dictionary<String, PerformerList>();
initiator.NextActivityPerformers.Add(stepGuid, pList);
WfExecutedResult runAppResult = service.RunProcessApp(initiator);
if (runAppResult.Status != WfExecutedStatus.Success)
{
base.RegisterStartupScript("", "<script>alert('" + runAppResult.Message + "');</script>");
return;
}
ProcessEntity processEntity = service.GetProcessById(processGUID);
if (processEntity != null)
{
ActivityInstanceEntity activityInstanceEntity = service.GetActivityInstance(activityInstanceID);
if (activityInstanceEntity != null)
{
CurrentActivityText = activityInstanceEntity.ActivityName;
}
}
try
{
//保存業務數據
BizAppFlowEntity AppFlowEntity = new Entity.BizAppFlowEntity();
AppFlowEntity.AppName = "請假流程";
AppFlowEntity.AppInstanceID = instanceId.ToString();
AppFlowEntity.ActivityName = CurrentActivityText;
AppFlowEntity.Remark = string.Format("申請人:{0}-{1}", LoginUserID, LoginUserName) + CurrentActivityText;
AppFlowEntity.ChangedTime = now;
AppFlowEntity.ChangedUserID = LoginUserID;
AppFlowEntity.ChangedUserName = LoginUserName;
WorkFlows.AddBizAppFlow(AppFlowEntity);
}
catch (Exception ex)
{ }
try
{
HrsLeaveEntity hrsLeaveEntity = new Entity.HrsLeaveEntity();
hrsLeaveEntity.ID = Helper.ConverToInt32(instanceId);
hrsLeaveEntity.DepManagerRemark = DepManagerRemark;
hrsLeaveEntity.DirectorRemark = DirectorRemark;
hrsLeaveEntity.DeputyGeneralRemark = DeputyGeneralRemark;
hrsLeaveEntity.GeneralManagerRemark = GeneralManagerRemark;
hrsLeaveEntity.CurrentActivityText = CurrentActivityText;
WorkFlows.UpdateHrsLeave(hrsLeaveEntity);
}
catch (Exception ex)
{ }
base.RegisterStartupScript("", "<script>alert('辦理成功');window.location.href='FlowList.aspx';</script>");
}
//.........這裏部分代碼省略.........
示例2: InitFlowInfo
protected void InitFlowInfo()
{
int AppInstanceID = Request.QueryString["AppInstanceID"] == null ? 0 : Helper.ConverToInt32(Request.QueryString["AppInstanceID"].ToString());
string ProcessGUID = Request.QueryString["ProcessGUID"] == null ? string.Empty : Request.QueryString["ProcessGUID"].ToString();
int ActivityInstanceID = Request.QueryString["ActivityInstanceID"] == null ? 0 : Helper.ConverToInt32(Request.QueryString["ActivityInstanceID"].ToString());
if (AppInstanceID > 0)
{
HrsLeaveEntity hrsLeaveEntity = WorkFlows.GetHrsLeaveModel(AppInstanceID);
if (hrsLeaveEntity != null && hrsLeaveEntity.ID > 0)
{
selectLeaveType.Value = hrsLeaveEntity.LeaveType.ToString();
selectLeaveType.Disabled = true;
txtDays.Value = hrsLeaveEntity.Days.ToString();
txtFromDate.Value = hrsLeaveEntity.FromDate.ToString("yyyy-MM-dd");
txtToDate.Value = hrsLeaveEntity.ToDate.ToString("yyyy-MM-dd");
hiddenInstanceId.Value = hrsLeaveEntity.ID.ToString();
hiddenActivityInstanceID.Value = ActivityInstanceID.ToString();
this.txtDepmanagerRemark.Value = hrsLeaveEntity.DepManagerRemark;
this.txtDirectorRemark.Value = hrsLeaveEntity.DirectorRemark;//主管總監
this.txtDeputyGeneralRemark.Value = hrsLeaveEntity.DeputyGeneralRemark;//副總經理
this.txtGeneralManagerRemark.Value = hrsLeaveEntity.GeneralManagerRemark;//總經理
//權限設置
IWorkflowService service = new WorkflowService();
ProcessEntity processEntity = service.GetProcessById(ProcessGUID);
if (processEntity != null)
{
this.txtProcessGUID.Value = processEntity.ProcessGUID.ToString();
ActivityInstanceEntity activityInstanceEntity = service.GetActivityInstance(ActivityInstanceID);
if (activityInstanceEntity != null)
{
ActivityEntity activityEntity = service.GetActivityEntity(ProcessGUID, activityInstanceEntity.ActivityGUID);
if (activityEntity != null && activityEntity.Roles != null && activityEntity.Roles.Count > 0)
{
foreach (var role in activityEntity.Roles)
{
if (role.ID == LoginRoleID)
{
switch (role.ID)
{
case 2://部門經理
this.txtDepmanagerRemark.Disabled = false;
hiddenPerformField.Value = "DepManager";
break;
case 4://主管總監
this.txtDirectorRemark.Disabled = false;
hiddenPerformField.Value = "Director";
break;
case 7://副總經理
this.txtDeputyGeneralRemark.Disabled = false;
hiddenPerformField.Value = "Deputy";
break;
case 8://總經理
this.txtGeneralManagerRemark.Disabled = false;
hiddenPerformField.Value = "General";
break;
}
}
}
}
}
}
}
}
}
示例3: UpdateProcess
public ResponseResult UpdateProcess(ProcessEntity entity)
{
var result = ResponseResult.Default();
try
{
var wfService = new WorkflowService();
var processEntity = wfService.GetProcessById(entity.ProcessGUID);
processEntity.ProcessName = entity.ProcessName;
processEntity.XmlFileName = entity.XmlFileName;
processEntity.AppType = entity.AppType;
processEntity.Description = entity.Description;
wfService.UpdateProcess(processEntity);
result = ResponseResult.Success();
}
catch (System.Exception ex)
{
result = ResponseResult.Error(string.Format("更新流程記錄失敗,錯誤:{0}", ex.Message));
}
return result;
}
示例4: GetProcessById
public ResponseResult<ProcessEntity> GetProcessById(string id)
{
var result = ResponseResult<ProcessEntity>.Default();
try
{
var wfService = new WorkflowService();
var entity = wfService.GetProcessById(id);
result = ResponseResult<ProcessEntity>.Success(entity);
}
catch (System.Exception ex)
{
result = ResponseResult<ProcessEntity>.Error(
string.Format("獲取流程基本信息失敗!{0}", ex.Message)
);
}
return result;
}
示例5: Approval
public async Task<ActionResult> Approval(string type = "agree", string processGUID = "", int instanceId = 0, double days = 0)
{
var resolveRequest = HttpContext.Request;
resolveRequest.InputStream.Seek(0, System.IO.SeekOrigin.Begin);
string jsonString = new System.IO.StreamReader(resolveRequest.InputStream).ReadToEnd();
try
{
IWorkflowService service = new WorkflowService();
WfAppRunner runner = new WfAppRunner();
runner.AppInstanceID = instanceId.ToString();
runner.ProcessGUID = processGUID;
runner.UserID = User.Identity.GetUserId();
IList<NodeView> NodeViewList = service.GetNextActivityTree(runner, GetCondition("days-" + days));
var leave = JsonConvert.DeserializeObject<LeaveEntity>(jsonString);
leave.ID = instanceId;
//調用流程
WfAppRunner initiator = new WfAppRunner();
initiator.AppName = "請假流程";
initiator.AppInstanceID = instanceId.ToString();
initiator.ProcessGUID = processGUID;
initiator.UserID = User.Identity.GetUserId();
initiator.UserName = User.Identity.GetUserName();
initiator.Conditions = GetCondition(string.Format("days-{0}", days)); //後續節點不用傳入條件表達式
//獲取下一步審批人信息
//下一步角色ID審批者
PerformerList pList = new PerformerList();
if (NodeViewList[0].Roles.Count > 0)
{
string outerId = NodeViewList[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]));
//送往下一步
pList.Add(new Performer(user.Id.ToString(), user.RealName));
}
initiator.NextActivityPerformers = new Dictionary<String, PerformerList>();
initiator.NextActivityPerformers.Add(NodeViewList[0].ActivityGUID, pList);
WfExecutedResult runAppResult = service.RunProcessApp(initiator);
if (runAppResult.Status != WfExecutedStatus.Success)
{
}
ProcessEntity processEntity = service.GetProcessById(processGUID);
if (processEntity != null)
{
ActivityInstanceEntity activityInstanceEntity = service.GetActivityInstance(instanceId);
if (activityInstanceEntity != null)
{
//CurrentActivityText = activityInstanceEntity.ActivityName;
}
}
new WorkFlowManager().UpdateHrsLeave(leave);
}
catch (Exception ex)
{
return Json(new
{
success = false,
message = ex.Message
});
}
return Json(new
{
success = true,
message = "執行成功"
});
}
示例6: List
public ActionResult List(int id = 1, string processGuid = "", int activityInstanceID = 0)
{
if (id == 1)
{
ViewBag.Message = "非法鏈接";
return View();
}
else
{
if (string.IsNullOrEmpty(processGuid))
{
WorkFlowManager work = new WorkFlowManager();
LeaveEntity entity = work.FindById(id);
string s = @"<table class='table table-bordered'>"
+ "<tr><td>部門經理</td><td>" + entity.DepManagerRemark + "</td></tr>"
+ "<tr><td>主管總監 </td><td>" + entity.DirectorRemark + "</td></tr>"
+ "<tr><td>副總經理</td><td>" + entity.DeputyGeneralRemark + "</td></tr>"
+ "<tr><td>總經理</td><td>" + entity.GeneralManagerRemark + "</td> </tr></table>";
ViewBag.Shenpi = s;
return View(entity);
}
else
{
WorkFlowManager work = new WorkFlowManager();
LeaveEntity entity = work.FindById(id);
//權限設置
IWorkflowService service = new WorkflowService();
ProcessEntity processEntity = service.GetProcessById(processGuid);
if (processEntity != null)
{
ActivityInstanceEntity activityInstanceEntity = service.GetActivityInstance(activityInstanceID);
string s = "";
if (activityInstanceEntity != null)
{
ActivityEntity activityEntity = service.GetActivityEntity(processGuid, activityInstanceEntity.ActivityGUID);
if (activityEntity != null && activityEntity.Roles != null && activityEntity.Roles.Count > 0)
{
//用戶角色列表
IList<string> roleUser = UserManager.GetRoles(Convert.ToInt32(User.Identity.GetUserId()));
foreach (var role in activityEntity.Roles)
{
//為方便起見這裏隻取第一個角色,開發人員可以自行調整
if (role.RoleCode == roleUser[0].ToString())
{
switch (role.ID)
{
case 2:
//部門經理審批
s = @"<table class='table table-bordered'>" +
"<tr><td>部門經理</td><td><input type='text'class='form-control' name='DepManagerRemark'></td></tr>" +
"<tr><td>主管總監 </td><input type='text' class='form-control' name='DirectorRemark' style='display:none'></td></tr>" +
"<tr><td>副總經理</td><td><input type='text' class='form-control' name='DeputyGeneralRemark' style='display:none'></td></tr>" +
"<tr><td>總經理</td><td><input class='form-control' name='GeneralManagerRemark' style='display:none' type='text' /> </td> </tr>"
;
break;
case 3:
//主管總監審批
s = @"<table class='table table-bordered'>" +
"<tr><td>部門經理</td><td>" + entity.DepManagerRemark + "<input type='text'class='form-control' style='display:none' name='DepManagerRemark' value='" + entity.DepManagerRemark + "'></td></tr>" +
"<tr><td>主管總監 </td><input type='text' class='form-control' name='DirectorRemark' ></td></tr>" +
"<tr><td>副總經理</td><td><input type='text' class='form-control' name='DeputyGeneralRemark' style='display:none'></td></tr>" +
"<tr><td>總經理</td><td><input class='form-control' name='GeneralManagerRemark' style='display:none' type='text' /> </td> </tr>"
;
break;
case 7:
//副總經理審批
s = @"<table class='table table-bordered'>" +
"<tr><td>部門經理</td><td>" + entity.DepManagerRemark + "<input type='text'class='form-control' style='display:none' name='DepManagerRemark' value='" + entity.DepManagerRemark + "'></td></tr>" +
"<tr><td>主管總監 </td><td>" + entity.DirectorRemark + "<input type='text' class='form-control' name='DirectorRemark' value='" + entity.DirectorRemark + "' ></td></tr>" +
"<tr><td>副總經理</td><td><input type='text' class='form-control' name='DeputyGeneralRemark' style='display:none'></td></tr>" +
"<tr><td>總經理</td><td><input class='form-control' name='GeneralManagerRemark' style='display:none' type='text' /> </td> </tr>";
break;
case 8:
//總經理審批
s = @"<table class='table table-bordered'>" +
"<tr><td>部門經理</td><td>" + entity.DepManagerRemark + "<input type='text'class='form-control' style='display:none' name='DepManagerRemark' value='" + entity.DepManagerRemark + "'></td></tr>" +
"<tr><td>主管總監 </td><td>" + entity.DirectorRemark + "<input type='text' class='form-control' name='DirectorRemark' value='" + entity.DirectorRemark + "' ></td></tr>" +
"<tr><td>副總經理</td><td><input type='text' class='form-control' name='DeputyGeneralRemark' style='display:none' value='" + entity.DeputyGeneralRemark + "'></td></tr>" +
"<tr><td>總經理</td><td><input class='form-control' name='GeneralManagerRemark' type='text' /> </td> </tr>"
;
break;
}
}
}
}
}
//獲取當前角色
ViewBag.Shenpi = "<form action='' id='Remark'>" + s + "</table></form><button class='btn btn-primary' id='agree'>同意</button><button class='btn btn-primary' id='return'>退回</button>";
ViewBag.processGUID = processGuid;
ViewBag.days = entity.Days;
return View(entity);
}
}
}
//表示出現錯誤
return View();
}