Example #1
0
        public WfActivityBuilderBase GetActivityBuilder(WfActivityType activityType)
        {
            WfActivityConfigurationElement activityElement = Activities[activityType.ToString()];

            (activityElement != null).FalseThrow <SettingsPropertyNotFoundException>("不能根据{0}找到对应的ActivityBuilder", activityType);

            return((WfActivityBuilderBase)activityElement.CreateInstance());
        }
        public static WfActivityDescriptor CreateSimpleServerActivity(string key, string name, WfActivityType actType)
        {
            WfActivityDescriptor actDesp = new WfActivityDescriptor(key, actType);

            actDesp.Name = name;

            actDesp.RelativeLinks.Add(new WfRelativeLinkDescriptor("AR1") { Category = "Activity", Url = "http://www.ak47.com" });

            return actDesp;
        }
        public static WfActivityDescriptor CreateSimpleServerActivity(string key, string name, WfActivityType actType)
        {
            WfActivityDescriptor actDesp = new WfActivityDescriptor(key, actType);

            actDesp.Name = name;

            actDesp.RelativeLinks.Add(new WfRelativeLinkDescriptor("AR1")
            {
                Category = "Activity", Url = "http://www.ak47.com"
            });

            return(actDesp);
        }
        protected override WfKeyedDescriptorBase CreateInstance(string key, IDictionary <string, object> dictionary, Type type, JavaScriptSerializer serializer)
        {
            WfActivityType activityType = DictionaryHelper.GetValue(dictionary, "ActivityType", WfActivityType.NormalActivity);

            return(new WfActivityDescriptor(key, activityType));
        }
Example #5
0
 public static WfClientActivityType ToClientActivityType(this WfActivityType at)
 {
     return((WfClientActivityType)at);
 }
        /// <summary>
        /// 选择下一步骤及人员
        /// </summary>
        /// <param name="type"></param>
        /// <param name="processId"></param>
        /// <param name="currActId"></param>
        /// <param name="conditions"></param>
        /// <returns></returns>
        public async Task <ActionResult> FlowStepSelect(WfActivityType type,
                                                        long processId,
                                                        string currActId,
                                                        string conditions,
                                                        long proInsId = 0)
        {
            var jsonResult = new JsonModel();

            jsonResult.statusCode = 300;

            #region 找流程
            var process = await WorkflowSvc.GetProcessById(processId);

            if (process == null)
            {
                jsonResult.message = $"找不到id为{processId}的流程!";
                return(Json(jsonResult, JsonRequestBehavior.AllowGet));
            }
            #endregion

            #region 找当前节点
            WfActivity currAct = null;
            switch (type)
            {
            case WfActivityType.Start:
                currAct = process.GetFirstActivity();
                break;

            case WfActivityType.Task:
                if (string.IsNullOrEmpty(currActId))
                {
                    jsonResult.message = "请输入当前节点Id!";
                    return(Json(jsonResult, JsonRequestBehavior.AllowGet));
                }
                currAct = process.GetActivity(currActId);
                break;

            default:
                break;
            }
            if (currAct == null)
            {
                jsonResult.message = "当前节点不存在!";
                return(Json(jsonResult, JsonRequestBehavior.AllowGet));
            }
            #endregion

            #region 找可选节点列表
            var condition = GetCondition(conditions);
            var nextList  = process.GetNextActivityList(currAct.key, condition);
            if (nextList == null || nextList.Count == 0)
            {
                jsonResult.message = "可选节点为空!请重新编辑流程!";
                return(Json(jsonResult, JsonRequestBehavior.AllowGet));
            }

            List <Users> launchUsers = new List <Users>();

            var model = new List <WfActivitySelectModel>();
            foreach (var act in nextList)
            {
                switch (act.dealType)
                {
                case WfActivityDealType.Creater:
                    var getResult = await GetLaunchUser(proInsId, launchUsers, model, act, jsonResult);

                    if (!getResult)
                    {
                        return(Json(jsonResult, JsonRequestBehavior.AllowGet));
                    }
                    break;

                case WfActivityDealType.Role:
                    await GetRoleUsers(model, act);

                    break;

                default:
                    break;
                }
            }

            #endregion

            return(View(model));
        }