Exemple #1
0
        public virtual object GetBPMProcessRACI(HttpContext context)
        {
            YZRequest request     = new YZRequest(context);
            string    processName = request.GetString("processName");
            Version   version     = request.GetVersion("version");

            string             fileid;
            NodeItemCollection nodes;
            LinkItemCollection links;

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                BPMProcess.GetKMInfo(cn, processName, version, out fileid, out nodes, out links);
            }

            if (String.IsNullOrEmpty(fileid))
            {
                throw new Exception(String.Format("流程{0}无关联文件", processName));
            }


            using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider)
            {
                using (IDbConnection cn = provider.OpenConnection())
                {
                    File file = File.Load(provider, cn, fileid);

                    DataTable table = file.Sprites.SortByOrder().GetRACIDetailTable(provider, cn, "result");
                    table = this.Map(table, nodes);
                    return(table);
                }
            }
        }
Exemple #2
0
        public virtual JObject GetBPMProcessOverviewInfo(HttpContext context)
        {
            YZRequest request     = new YZRequest(context);
            string    processName = request.GetString("processName");
            Version   version     = request.GetVersion("version");

            string             fileid;
            NodeItemCollection nodes;
            LinkItemCollection links;

            using (BPMConnection cn = new BPMConnection())
            {
                cn.WebOpen();
                BPMProcess.GetKMInfo(cn, processName, version, out fileid, out nodes, out links);
            }

            if (String.IsNullOrEmpty(fileid))
            {
                throw new Exception(String.Format("流程{0}无关联文件", processName));
            }

            File file;

            YZSoft.FileSystem.FileCollection docs;
            using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider)
            {
                using (IDbConnection cn = provider.OpenConnection())
                {
                    file = File.Load(provider, cn, fileid);
                    docs = FileSystem.DirectoryManager.GetFiles(provider, cn, file.AttachmentInfo.LParam1, null, "ID DESC", -1);
                    docs = docs.PerformAttachmentInfo(provider, cn, null);
                }
            }

            JObject rv = new JObject();

            rv["FileID"]         = file.FileID;
            rv["Purpose"]        = file.Property.Purpose;
            rv["Scope"]          = file.Property.Scope;
            rv["Definition"]     = file.Property.Definition;
            rv["Responsibility"] = file.Property.Responsibility;
            rv["DispatchScope"]  = file.Property.DispatchScope;
            rv["DesignPurpose"]  = file.Property.DesignPurpose;

            JArray activities = new JArray();

            rv["activities"] = activities;
            foreach (NodeItem nodeItem in nodes)
            {
                if (!nodeItem.IsHumanStep)
                {
                    continue;
                }

                JObject activity = new JObject();
                activities.Add(activity);

                activity["NodeName"] = nodeItem.Name;

                if (!String.IsNullOrEmpty(nodeItem.RelatedSpriteId))
                {
                    Sprite sprite = file.Sprites.TryGetItem(nodeItem.RelatedSpriteId);
                    if (sprite != null)
                    {
                        activity["SpriteID"]   = sprite.Id;
                        activity["SpriteName"] = sprite.Name;
                    }
                }
            }

            rv["documents"] = JArray.FromObject(docs);

            return(rv);
        }