Example #1
0
        public ActionResult Detail(int processInstanceId)
        {
            var history = base.Client.History.Get(processInstanceId);

            List <ActivitiClient.Models.Bpmn.FormProperty> formProperties = null;
            var form              = base.Client.Forms.Get(processDefinitionId: history.ProcessDefinitionId);
            var model             = base.Client.ProcessDefinitions.GetResourcedata(history.ProcessDefinitionId);
            var processComplement = base.Dbc.ProcessComplements.Find(history.ProcessDefinitionId);

            // 未完了
            if (history.DeleteReason == null)
            {
                var variables = base.Client.ProcessInstances.Variables(processInstanceId);
                formProperties = model.StartEvent[0].DetailFormProperties(variables);
            }
            // 完了
            else
            {
                var variableInstance = base.Client.History.VariableInstances(processInstanceId);
                var variables        = variableInstance.Select(v => v.Variable).ToList();
                formProperties = model.StartEvent[0].DetailFormProperties(variables);
            }
            var def = base.Client.ProcessDefinitions.Get(history.ProcessDefinitionId);

            var formModel = new ProcessDetailModel {
                History            = history,
                FormProperties     = formProperties,
                ProcessDefinition  = def,
                ProcessComplements = FitFlowUtil.XmlToModel <ProcessComplement>(processComplement.Resource)
            };

            return(View(formModel));
        }
Example #2
0
        public ActionResult Start(string key, int version, string processId)
        {
            var processDefinitionId = string.Format("{0}:{1}:{2}", key, version, processId);
            var model             = base.Client.ProcessDefinitions.GetResourcedata(processDefinitionId);
            var processComplement = base.Dbc.ProcessComplements.Find(processDefinitionId);

            return(View(new ProcessStartModel {
                ProcessName = model.Name,
                StartTask = model.StartEvent[0],
                ProcessComplements = FitFlowUtil.XmlToModel <ProcessComplement>(processComplement.Resource)
            }));
        }
Example #3
0
        public RedirectToRouteResult Run(HttpPostedFileBase depfile)
        {
            try {
                var filename = Path.GetFileName(depfile.FileName);
                if (!filename.Contains(".fitflow.xml"))
                {
                    throw new Exception("ファイル名が不正です。");
                }
                var processKey          = filename.Replace(".fitflow.xml", string.Empty);
                var processDefinitionId = base.ADbc.ACT_RE_PROCDEF.Where(d => d.KEY_ == processKey)
                                          .OrderByDescending(d => d.VERSION_).Select(d => d.ID_).FirstOrDefault();

                if (processDefinitionId == null)
                {
                    throw new Exception("プロセスキーが見つかりません。");
                }
                var stream = new MemoryStream();
                depfile.InputStream.CopyTo(stream);
                var xml   = Encoding.UTF8.GetString(stream.ToArray());
                var model = FitFlowUtil.XmlToModel <ProcessComplement>(xml);

                var ProcessComplements = new ProcessComplements {
                    ProcessDefinitionId = processDefinitionId,
                    ProcessKey          = processKey,
                    Resource            = FitFlowUtil.ModelToXml(model)
                };
                FitFlowUtil.Transform(dbc => {
                    var record = dbc.ProcessComplements.Find(processDefinitionId);
                    if (record == null)
                    {
                        dbc.ProcessComplements.Add(ProcessComplements);
                    }
                    else
                    {
                        record.Resource = ProcessComplements.Resource;
                    }
                    dbc.SaveChanges();
                });
                var deployment = new Deployment {
                    Name           = filename,
                    DeploymentTime = DateTime.Now
                };
                TempData["Deployment"] = deployment;
            }
            catch (Exception ex) {
                TempData["ErrorMessage"] = ex.Message;
            }

            return(RedirectToAction("Index", "Deploy"));
        }
Example #4
0
        public ActionResult Approve(int taskId)
        {
            var form = base.Client.Forms.Get(taskId);
            var task = base.Client.Tasks.Get(taskId);
            var def  = base.Client.ProcessDefinitions.Get(task.ProcessDefinitionId);
            var processComplement = base.Dbc.ProcessComplements.Find(def.Id);

            var formModel = new FormModel {
                Form = form,
                Task = task,
                ProcessDefinition  = def,
                ProcessComplements = FitFlowUtil.XmlToModel <ProcessComplement>(processComplement.Resource)
            };

            return(View(formModel));
        }
Example #5
0
 public static ProcessComplement GetResource(this ProcessComplements @this)
 {
     return(FitFlowUtil.XmlToModel <ProcessComplement>(@this.Resource));
 }
Example #6
0
 public static void SetResource(this ProcessComplements @this, ProcessComplement model)
 {
     @this.Resource = FitFlowUtil.ModelToXml(model);
 }