Esempio n. 1
0
        public virtual SpriteLinkCollection GetSpriteUsedByLinks(HttpContext context)
        {
            YZRequest request  = new YZRequest(context);
            string    fileid   = request.GetString("fileid");
            string    spriteid = request.GetString("spriteid");

            using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider)
            {
                using (IDbConnection cn = provider.OpenConnection())
                {
                    SpriteLinkCollection links = BPAManager.GetSpriteUsedByLinks(provider, cn, fileid, spriteid, null);
                    foreach (SpriteLink link in links)
                    {
                        AttachmentInfo attachmentInfo = AttachmentManager.TryGetAttachmentInfo(provider, cn, link.FileID);
                        if (attachmentInfo != null)
                        {
                            link["FileName"]   = attachmentInfo.Name;
                            link["FileExt"]    = attachmentInfo.Ext;
                            link["Attachment"] = JObject.FromObject(attachmentInfo);
                        }

                        SpriteIdentity spriteIdentity = BPAManager.TryGetSpriteIdentity(provider, cn, link.FileID, link.SpriteID);
                        if (spriteIdentity != null)
                        {
                            link["SpriteName"] = spriteIdentity.Name;
                        }
                    }

                    return(links);
                }
            }
        }
Esempio n. 2
0
        protected virtual void AddReference(IYZDbProvider provider, IDbConnection cn, File file, Sprite sprite, ReferenceCollection refs, BPMObjectNameCollection tagfiletype, JArray rv)
        {
            foreach (Reference @ref in refs)
            {
                AttachmentInfo tagAttachment = AttachmentManager.TryGetAttachmentInfo(provider, cn, @ref.FileID);
                if (tagAttachment == null)
                {
                    continue;
                }

                if (tagfiletype.Count != 0 && !tagfiletype.Contains(tagAttachment.Ext))
                {
                    continue;
                }

                File tagFile = File.TryLoad(provider, cn, @ref.FileID);
                if (tagFile == null)
                {
                    continue;
                }

                Sprite tagSprite = tagFile.Sprites.TryGetItem(@ref.SpriteID);

                JObject item = new JObject();
                rv.Add(item);
                item["FileID"]             = file.FileID;
                item["FileName"]           = file.FileName;
                item["SpriteName"]         = SpriteIdentity.ConvertSpriteName(sprite == null ? "" : sprite.Name);
                item["RelatiedFileID"]     = tagFile.FileID;
                item["RelatiedFileName"]   = tagFile.FileName;
                item["RelatiedSpriteName"] = SpriteIdentity.ConvertSpriteName(tagSprite == null ? "" : tagSprite.Name);
            }
        }
Esempio n. 3
0
        public virtual object RelationshipAppGetUsedBy(HttpContext context)
        {
            YZRequest request = new YZRequest(context);
            string    fileid  = request.GetString("fileid");
            BPMObjectNameCollection spriteids   = JArray.Parse(request.GetString("spriteids")).ToObject <BPMObjectNameCollection>();
            BPMObjectNameCollection tagfiletype = JArray.Parse(request.GetString("tagfiletype")).ToObject <BPMObjectNameCollection>();
            JArray rv = new JArray();

            using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider)
            {
                using (IDbConnection cn = provider.OpenConnection())
                {
                    File file = File.Load(provider, cn, fileid);
                    SpriteLinkCollection links = BPAManager.GetFileUsedByLinks(provider, cn, fileid, null);

                    foreach (SpriteLink link in links)
                    {
                        if (!String.IsNullOrEmpty(link.LinkedSpriteID) && spriteids.Count != 0 && !spriteids.Contains(link.LinkedSpriteID))
                        {
                            continue;
                        }

                        File usedbyFile = File.TryLoad(provider, cn, link.FileID);
                        if (usedbyFile == null)
                        {
                            continue;
                        }

                        AttachmentInfo usedByAttachment = AttachmentManager.GetAttachmentInfo(provider, cn, usedbyFile.FileID);
                        if (tagfiletype.Count != 0 && !tagfiletype.Contains(usedByAttachment.Ext))
                        {
                            continue;
                        }

                        Sprite usedbySprite = usedbyFile.Sprites.TryGetItem(link.SpriteID);
                        Sprite sprite       = file.Sprites.TryGetItem(link.LinkedSpriteID);

                        JObject item = new JObject();
                        rv.Add(item);
                        item["FileID"]             = file.FileID;
                        item["FileName"]           = file.FileName;
                        item["SpriteName"]         = SpriteIdentity.ConvertSpriteName(sprite == null ? "" : sprite.Name);
                        item["RelatiedFileID"]     = usedbyFile.FileID;
                        item["RelatiedFileName"]   = usedbyFile.FileName;
                        item["RelatiedSpriteName"] = SpriteIdentity.ConvertSpriteName(usedbySprite == null ? "" : usedbySprite.Name);
                    }

                    return(rv);
                }
            }
        }
Esempio n. 4
0
        public virtual object GetDashboardData(HttpContext context)
        {
            YZRequest               request       = new YZRequest(context);
            List <int>              rootfolderids = JArray.Parse(request.GetString("rootfolders")).ToObject <List <int> >();
            SpriteIdentity          responsible   = JObject.Parse(request.GetString("responsible")).ToObject <SpriteIdentity>();
            BPMObjectNameCollection milestones    = JArray.Parse(request.GetString("milestones")).ToObject <BPMObjectNameCollection>();
            BPMObjectNameCollection moduletypes   = JArray.Parse(request.GetString("moduletypes")).ToObject <BPMObjectNameCollection>();
            BPMObjectNameCollection colors        = JArray.Parse(request.GetString("colors")).ToObject <BPMObjectNameCollection>();
            BPMObjectNameCollection executeStatus = JArray.Parse(request.GetString("executeStatus")).ToObject <BPMObjectNameCollection>();
            string uid = YZAuthHelper.LoginUserAccount;

            FileCollection files = new FileCollection();

            using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider)
            {
                using (IDbConnection cn = provider.OpenConnection())
                {
                    if (rootfolderids.Count == 0)
                    {
                        rootfolderids = this.GetAllReportRootFolders(provider, cn, uid);
                    }

                    FileSystem.FileCollection allfiles = new FileSystem.FileCollection();
                    foreach (int rootfolderid in rootfolderids)
                    {
                        FileSystem.FolderCollection allfolders  = FileSystem.DirectoryManager.GetAllChildFolders(provider, cn, rootfolderid, null, null);
                        FileSystem.FolderCollection rootFolders = allfolders.BuildTree(rootfolderid);
                        allfolders = rootFolders.Expand();

                        FileSystem.FileCollection folderfiles = FileSystem.DirectoryManager.GetFiles(provider, cn, allfolders.IDs, null, null, -1);
                        allfiles.AppendUnique(folderfiles);
                    }

                    foreach (FileSystem.File folderfile in allfiles)
                    {
                        File file = File.TryLoad(provider, cn, folderfile.FileID);
                        if (file == null)
                        {
                            continue;
                        }

                        //responsible过滤
                        if (!String.IsNullOrEmpty(responsible.FileID))
                        {
                            if (!file.Property.Owner.Contains(responsible))
                            {
                                continue;
                            }
                        }

                        //milestone过滤
                        if (milestones.Count != 0)
                        {
                            if (!milestones.Contains(file.Property.Milestone.ToString()))
                            {
                                continue;
                            }
                        }

                        //moduletypes过滤
                        if (moduletypes.Count != 0)
                        {
                            if (!moduletypes.Contains(file.AttachmentInfo.Ext))
                            {
                                continue;
                            }
                        }

                        //color过滤
                        if (colors.Count != 0)
                        {
                            if (!colors.Contains(file.Property.Color.ToString()))
                            {
                                continue;
                            }
                        }

                        //executeStatus过滤
                        if (executeStatus.Count != 0)
                        {
                            if (!executeStatus.Contains(file.Property.ExecuteStatus.ToString()))
                            {
                                continue;
                            }
                        }

                        files.Add(file);
                    }
                }
            }

            JObject rv = new JObject();
            JObject item;

            //Milestone
            item            = new JObject();
            rv["Milestone"] = item;
            item["Total"]   = files.Count;

            foreach (Milestone milestone in Enum.GetValues(typeof(Milestone)))
            {
                item[milestone.ToString()] = 0;
            }

            foreach (File file in files)
            {
                item[file.Property.Milestone.ToString()] = (int)item[file.Property.Milestone.ToString()] + 1;
            }

            //ExecuteStatus
            item = new JObject();
            rv["ExecuteStatus"] = item;

            foreach (ExecuteStatus executeState in Enum.GetValues(typeof(ExecuteStatus)))
            {
                item[executeState.ToString()] = 0;
            }

            foreach (File file in files)
            {
                item[file.Property.ExecuteStatus.ToString()] = (int)item[file.Property.ExecuteStatus.ToString()] + 1;
            }

            //Color
            item        = new JObject();
            rv["Color"] = item;

            foreach (FileColor fileColor in Enum.GetValues(typeof(FileColor)))
            {
                item[fileColor.ToString()] = 0;
            }

            foreach (File file in files)
            {
                item[file.Property.Color.ToString()] = (int)item[file.Property.Color.ToString()] + 1;
            }

            //分类统计
            item            = new JObject();
            rv["FileTypes"] = item;
            foreach (string ext in ".evc,.flow,.bpmn,.org,.data,.it,.product,.risk,.reg,.kpi".Split(','))
            {
                JObject jTypeCounts = new JObject();
                item[ext] = jTypeCounts;

                foreach (Milestone milestone in Enum.GetValues(typeof(Milestone)))
                {
                    jTypeCounts[milestone.ToString()] = 0;
                }
            }

            foreach (File file in files)
            {
                string ext = file.AttachmentInfo.Ext;
                if (ext != null)
                {
                    ext = ext.ToLower().Trim();
                }

                JObject jTypeCounts = item[ext] as JObject;
                if (jTypeCounts != null)
                {
                    jTypeCounts[file.Property.Milestone.ToString()] = (int)jTypeCounts[file.Property.Milestone.ToString()] + 1;
                }
            }

            //战略流程数量
            item                     = new JObject();
            rv["Strategic"]          = item;
            item["StrategicProcess"] = 0;
            item["OperationProcess"] = 0;
            item["SupportProcess"]   = 0;
            item["Other"]            = 0;

            foreach (File file in files)
            {
                string filetype;

                if (file.isStrategicProces)
                {
                    filetype = "StrategicProcess";
                }
                else if (file.isOperationProcess)
                {
                    filetype = "OperationProcess";
                }
                else if (file.isSupportProces)
                {
                    filetype = "SupportProcess";
                }
                else
                {
                    filetype = "Other";
                }

                item[filetype] = (int)item[filetype] + 1;
            }

            return(rv);
        }
Esempio n. 5
0
        public virtual DataTable GetModuleList(HttpContext context)
        {
            YZRequest               request       = new YZRequest(context);
            List <int>              rootfolderids = JArray.Parse(request.GetString("rootfolders")).ToObject <List <int> >();
            SpriteIdentity          responsible   = JObject.Parse(request.GetString("responsible")).ToObject <SpriteIdentity>();
            BPMObjectNameCollection milestones    = JArray.Parse(request.GetString("milestones")).ToObject <BPMObjectNameCollection>();
            BPMObjectNameCollection moduletypes   = JArray.Parse(request.GetString("moduletypes")).ToObject <BPMObjectNameCollection>();
            BPMObjectNameCollection colors        = JArray.Parse(request.GetString("colors")).ToObject <BPMObjectNameCollection>();
            BPMObjectNameCollection executeStatus = JArray.Parse(request.GetString("executeStatus")).ToObject <BPMObjectNameCollection>();
            string uid = YZAuthHelper.LoginUserAccount;
            BPMObjectNameCollection indexs = BPMObjectNameCollection.FromStringList(".evc,.flow,.bpmn,.org,.data,.it,.product,.risk,.reg,.kpi", ',');

            DataTable table = new DataTable();

            using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider)
            {
                using (IDbConnection cn = provider.OpenConnection())
                {
                    FileCollection files = new FileCollection();

                    if (rootfolderids.Count == 0)
                    {
                        rootfolderids = this.GetAllReportRootFolders(provider, cn, uid);
                    }

                    FileSystem.FileCollection allfiles = new FileSystem.FileCollection();
                    foreach (int rootfolderid in rootfolderids)
                    {
                        FileSystem.FolderCollection allfolders  = FileSystem.DirectoryManager.GetAllChildFolders(provider, cn, rootfolderid, null, null);
                        FileSystem.FolderCollection rootFolders = allfolders.BuildTree(rootfolderid);
                        allfolders = rootFolders.Expand();

                        FileSystem.FileCollection folderfiles = FileSystem.DirectoryManager.GetFiles(provider, cn, allfolders.IDs, null, null, -1);
                        allfiles.AppendUnique(folderfiles);
                    }

                    foreach (FileSystem.File folderfile in allfiles)
                    {
                        File file = File.TryLoad(provider, cn, folderfile.FileID);
                        if (file == null)
                        {
                            continue;
                        }

                        //responsible过滤
                        if (!String.IsNullOrEmpty(responsible.FileID))
                        {
                            if (!file.Property.Owner.Contains(responsible))
                            {
                                continue;
                            }
                        }

                        //milestone过滤
                        if (milestones.Count != 0)
                        {
                            if (!milestones.Contains(file.Property.Milestone.ToString()))
                            {
                                continue;
                            }
                        }

                        //moduletypes过滤
                        if (moduletypes.Count != 0)
                        {
                            if (!moduletypes.Contains(file.AttachmentInfo.Ext))
                            {
                                continue;
                            }
                        }

                        //color过滤
                        if (colors.Count != 0)
                        {
                            if (!colors.Contains(file.Property.Color.ToString()))
                            {
                                continue;
                            }
                        }

                        //executeStatus过滤
                        if (executeStatus.Count != 0)
                        {
                            if (!executeStatus.Contains(file.Property.ExecuteStatus.ToString()))
                            {
                                continue;
                            }
                        }

                        files.Add(file);
                    }

                    DataRow row;

                    table.Columns.Add("OrderIndex", typeof(string));
                    table.Columns.Add("SubOrderIndex", typeof(string));
                    table.Columns.Add("Ext", typeof(string));
                    table.Columns.Add("Category", typeof(string));
                    table.Columns.Add("FileOrderFlag", typeof(int));
                    table.Columns.Add("FileOrder", typeof(string));
                    table.Columns.Add("FileCode", typeof(string));
                    table.Columns.Add("FileID", typeof(string));
                    table.Columns.Add("FileName", typeof(string));
                    table.Columns.Add("Responsible", typeof(string));

                    foreach (File file in files)
                    {
                        string ext = file.AttachmentInfo.Ext;
                        if (ext != null)
                        {
                            ext = ext.ToLower().Trim();
                        }

                        string category;
                        int    subOrderIndex = 0;

                        if (file.isStrategicProces)
                        {
                            category      = "战略流程";
                            subOrderIndex = 0;
                        }
                        else if (file.isOperationProcess)
                        {
                            category      = "运营流程";
                            subOrderIndex = 1;
                        }
                        else if (file.isSupportProces)
                        {
                            category = "支持流程";
                        }
                        else
                        {
                            category = File.GetCategoryNameFromExt(ext);
                        }

                        row = table.NewRow();
                        table.Rows.Add(row);

                        int orderIndex = indexs.IndexOf(ext);
                        row["OrderIndex"]    = orderIndex == -1 ? Int32.MaxValue : orderIndex;
                        row["SubOrderIndex"] = subOrderIndex;
                        row["Ext"]           = ext;
                        row["Category"]      = category;
                        row["FileOrderFlag"] = String.IsNullOrEmpty(file.Property.Order) ? 1 : 0;
                        row["FileOrder"]     = file.Property.Order;
                        row["FileCode"]      = file.Property.Code;
                        row["FileID"]        = file.FileID;
                        row["FileName"]      = file.AttachmentInfo.Name;
                        row["Responsible"]   = String.Join(",", file.Property.Owner.ToString(provider, cn));
                    }
                }
            }

            DataView view = new DataView(table);

            view.Sort = "OrderIndex ASC,SubOrderIndex ASC,FileOrderFlag,FileOrder,FileCode,FileID";
            return(view.ToTable(table.TableName));
        }