コード例 #1
0
        public JsonResult DrawProcess()
        {
            AjaxResult ajaxResult = new AjaxResult()
            {
                Result = DoResult.Failed,
                PromptMsg = "操作失败"
            };
            string processDefID = Request.Form["processDefID"];
            string processDefContent = Request.Form["processDefContent"];
            ProcessDefine processDefine = new ProcessDefine(processDefContent, false);
            string processInstID = Request.Form["ProcessInstID"];
            try
            {
                var process = new { processDefID = processDefID, processInstID = processInstID, processDefine = processDefine };
                ajaxResult.RetValue = process;
                ajaxResult.Result = DoResult.Success;
                ajaxResult.PromptMsg = "操作成功";
            }
            catch (Exception ex)
            {
                log.Error("获取流程" + processInstID + "异常,原因:" + ex.Message);
            }

            return Json(ajaxResult, new Newtonsoft.Json.Converters.StringEnumConverter());
        }
コード例 #2
0
        public void ActivityConvertTest()
        {
            IRepository<string> repository = new Repository<string>();
            ProcessDefine processDefine = new ProcessDefine(repository.Query<ProcessDef>().First(o => o.Name == "PatchVirtualMachine").Content);

            //System.Web.Script.Serialization.JavaScriptSerializer javaScriptSerializer = new System.Web.Script.Serialization.JavaScriptSerializer();

            //string ajson = javaScriptSerializer.Serialize(processDefine);
            string json = AgileEAP.Core.JsonConvert.SerializeObject(processDefine, new Newtonsoft.Json.Converters.StringEnumConverter { CamelCaseText = true });
            ProcessDefine processDefine2 = AgileEAP.Core.JsonConvert.DeserializeObject<ProcessDefine>(json, new ActivityConvert());

            Assert.AreEqual(processDefine.Name, processDefine2.Name);
        }
コード例 #3
0
        public JsonResult GetProcessInfo()
        {
            AjaxResult ajaxResult = new AjaxResult()
            {
                Result = DoResult.Failed,
                PromptMsg = "操作失败"
            };

            string processDefID = Request.Form["ProcessDefID"];
            if (!string.IsNullOrEmpty(processDefID))
            {
                ProcessDef processDef = repository.Query<ProcessDef>().Where(p => p.ID == processDefID).FirstOrDefault();
                ProcessDefine processDefine = new ProcessDefine(processDef.Content, false);
                string processInstID = Request.Form["ProcessInstID"];
                if (!string.IsNullOrEmpty(processInstID))
                {
                    IList<TransControl> transList = new List<TransControl>();
                    try
                    {
                        IList<ActivityInst> activityInsts = repository.Query<ActivityInst>().Where(a => a.ProcessInstID == processInstID).OrderBy(a => a.CreateTime).ToList();
                        if (activityInsts != null && activityInsts.Count > 0)
                        {
                            transList = repository.Query<TransControl>().Where(t => t.ProcessInstID == processInstID).OrderByDescending(t => t.TransTime).ToList();
                        }
                        var process = new { processDefID = processDefID, processInstID = processInstID, processDefine = processDefine, activityInsts = activityInsts, transList = transList };
                        ajaxResult.RetValue = process;
                        ajaxResult.Result = DoResult.Success;
                        ajaxResult.PromptMsg = "操作成功";
                    }
                    catch (Exception ex)
                    {
                        log.Error("获取流程" + processInstID + "异常,原因:" + ex.Message);
                    }
                }
                else
                {
                    try
                    {
                        var process = new { processDefID = processDefID, processInstID = processInstID, processDefine = processDefine };
                        ajaxResult.RetValue = process;
                        ajaxResult.Result = DoResult.Success;
                        ajaxResult.PromptMsg = "操作成功";
                    }
                    catch (Exception ex)
                    {
                        log.Error("获取流程" + processInstID + "异常,原因:" + ex.Message);
                    }
                }
            }

            return Json(ajaxResult, new Newtonsoft.Json.Converters.StringEnumConverter());
        }
コード例 #4
0
ファイル: DesignController.cs プロジェクト: AgileEAP/WebStack
        public JsonResult GetProcessInfo()
        {
            AjaxResult ajaxResult = new AjaxResult()
            {
                Result = DoResult.Failed,
                PromptMsg = "操作失败"
            };

            string processDefID = Request.Form["ProcessDefID"];
            if (!string.IsNullOrEmpty(processDefID))
            {
                ProcessDef processDef = repository.Query<ProcessDef>().Where(p => p.ID == processDefID).FirstOrDefault();
                //System.Xml.Linq.XElement xElem = System.Xml.Linq.XElement.Parse(processDef.Content);
                //IList<string> typeNames=xElem.Element("activities").Elements("activity").Select(e =>  e.Element("activityType").Value).ToList();
                //string typeName = typeNames[0];
                //if (!typeName.StartsWith("AgileEAP.Workflow.Definition"))
                //    typeName = string.Format("AgileEAP.Workflow.Definition.{0}", typeName);
                //System.Reflection.Assembly asmb = System.Reflection.Assembly.LoadFrom("AgileEAP.Workflow.dll");
                //Type type = asmb.GetType(typeName);
                //Activity activity = Activator.CreateInstance(type, new object[] { this, xElem }) as Activity;
                ProcessDefine processDefine = new ProcessDefine(processDef.Content, false);
                string processInstID = Request.Form["ProcessInstID"];
                if (!string.IsNullOrEmpty(processInstID))
                {
                    IList<TransControl> transList = new List<TransControl>();
                    try
                    {
                        IList<ActivityInst> activityInsts = repository.Query<ActivityInst>().Where(a => a.ProcessInstID == processInstID).OrderBy(a => a.CreateTime).ToList();
                        if (activityInsts != null && activityInsts.Count > 0)
                        {
                            transList = repository.Query<TransControl>().Where(t => t.ProcessInstID == processInstID).OrderByDescending(t => t.TransTime).ToList();
                        }
                        var process = new { processDefID = processDefID, processInstID = processInstID, processDefine = processDefine, activityInsts = activityInsts, transList = transList };
                        ajaxResult.RetValue = process;
                        ajaxResult.Result = DoResult.Success;
                        ajaxResult.PromptMsg = "操作成功";
                    }
                    catch (Exception ex)
                    {
                        log.Error("获取流程" + processInstID + "异常,原因:" + ex.Message);
                    }
                }
                else
                {
                    try
                    {
                        var process = new { processDefID = processDefID, processInstID = processInstID, processDefine = processDefine };
                        ajaxResult.RetValue = process;
                        ajaxResult.Result = DoResult.Success;
                        ajaxResult.PromptMsg = "操作成功";
                    }
                    catch (Exception ex)
                    {
                        log.Error("获取流程" + processInstID + "异常,原因:" + ex.Message);
                    }
                }
            }

            return Json(ajaxResult, new Newtonsoft.Json.Converters.StringEnumConverter());
        }