/// <summary>
        /// 根据活动ID 获取路线
        /// </summary>
        /// <returns></returns>
        public JsonResult GetWorkflowProcessPathByActivityId(string activityId)
        {
            var retModel = new JsonReturnModel();

            try
            {
                var listActivity = WorkflowProcessPathDA.GetWorkflowProcessPathByActivityId(activityId);
                //listActivity = listActivity.Where(x => x.NAME == "").ToList();
                //if (listActivity != null)
                //{
                //    for (var i = 0; i < listActivity.Count(); i++)
                //    {
                //        WORKFLOW_PROCESS_PATH obj = listActivity[i];

                //        Item activityItem = ActivityDA.GetActivityById(inn, obj.RELATED_ID);
                //        if (!activityItem.isError())
                //        {
                //            string name = activityItem.getProperty("keyed_name");
                //            obj.NAME = "returnTo" + name;
                //        }
                //    }
                //}
                retModel.data = listActivity;
            }
            catch (Exception ex)
            {
                retModel.AddError("errorMessage", ex.Message);
            }
            return(Json(retModel, JsonRequestBehavior.AllowGet));
        }
Example #2
0
        /// <summary>
        /// 自动完成
        /// </summary>
        public static WORKFLOW_PROCESS_PATH AutoCompleteActivityByParam(string id, string tableName, string lineName = "agree")
        {
            string url         = ConfigurationManager.AppSettings["ArasUrl"];
            string dbName      = ConfigurationManager.AppSettings["ArasDB"];
            string accountName = ConfigurationManager.AppSettings["Administrator"];
            string password    = ConfigurationManager.AppSettings["ArasPassword"];

            //使用管理员帐号登陆
            HttpServerConnection conn = IomFactory.CreateHttpServerConnection(url, dbName, accountName, password);
            Item login_result         = conn.Login();

            if (!login_result.isError())
            {
                var  inn          = login_result.getInnovator();
                Item activityItem = ActivityDA.GetActivityByItemId(inn, id, "Administrators", tableName);
                if (!activityItem.isError())
                {
                    string activityId           = activityItem.getProperty("activityid");
                    string activityAssignmentId = activityItem.getProperty("activityassignmentid");
                    //任务路线
                    var listActivity = WorkflowProcessPathDA.GetWorkflowProcessPathByActivityId(activityId);
                    WORKFLOW_PROCESS_PATH choicePath = listActivity.Where(x => x.NAME == lineName).FirstOrDefault();
                    //替换符
                    ReplaceChars(choicePath);
                    string errorStr = ActivityDA.CompleteActivity(inn, activityId, activityAssignmentId, choicePath.ID, choicePath.NAME, "", "AutoComplete");
                    if (string.IsNullOrEmpty(errorStr))
                    {
                        return(choicePath);
                    }
                }
            }
            return(null);
        }