当前位置: 首页>>代码示例>>C#>>正文


C# WorkflowService.GetFirstActivity方法代码示例

本文整理汇总了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;
                }
            }
        }
开发者ID:zengcheng,项目名称:Slickflow,代码行数:75,代码来源:FlowStepSelect.aspx.cs

示例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
//.........这里部分代码省略.........
开发者ID:huoxudong125,项目名称:Slickflow,代码行数:101,代码来源:FlowStepSelect.aspx.cs

示例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");
        }
开发者ID:zengcheng,项目名称:Slickflow,代码行数:88,代码来源:LeaveController.cs


注:本文中的Slickflow.Engine.Service.WorkflowService.GetFirstActivity方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。