public virtual JObject GetFolders(HttpContext context) { YZRequest request = new YZRequest(context); StoreZoneType zone = request.GetEnum <StoreZoneType>("zone"); string path = request.GetString("node"); BPMPermision perm = request.GetEnum <BPMPermision>("perm", BPMPermision.Read); bool expand = request.GetBool("expand", false); if (path == "root") { path = null; } using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); JObject rv = new JObject(); JArray items = new JArray(); rv[YZJsonProperty.children] = items; this.ExpandTree(cn, items, path, zone, perm, expand); rv[YZJsonProperty.success] = true; return(rv); } }
public virtual JObject GetProcessesInFolder(HttpContext context) { YZRequest request = new YZRequest(context); string bpmServer = request.GetString("bpmServer", null); string path = request.GetString("path", null); BPMPermision perm = request.GetEnum <BPMPermision>("perm"); BPMProcessCollection processes; //获得数据 using (BPMConnection cn = new BPMConnection()) { this.OpenConnection(cn, bpmServer); processes = cn.GetProcessList(path, perm, true); } //将数据转化为Json集合 JObject rv = new JObject(); rv[YZJsonProperty.total] = processes.Count; JArray children = new JArray(); rv[YZJsonProperty.children] = children; using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { foreach (BPMProcess process in processes) { JObject item = new JObject(); children.Add(item); item["ProcessName"] = process.Name; item["Active"] = process.Active; item["ProcessVersion"] = process.Version.ToString(2); item["Description"] = process.Property.Description; item["RelatedFile"] = process.Property.RelatedFile; item["MobileInitiation"] = process.Property.MobileInitiation; string relatedFile = (string)item["RelatedFile"]; if (!String.IsNullOrEmpty(relatedFile)) { AttachmentInfo attachmentInfo = AttachmentManager.TryGetAttachmentInfo(provider, cn, relatedFile); if (attachmentInfo != null) { item["RelatedFileName"] = attachmentInfo.Name; } } } } } return(rv); }
public virtual JObject GetFormsInFolder(HttpContext context) { YZRequest request = new YZRequest(context); string path = request.GetString("path", null); string rsid = String.IsNullOrEmpty(path) ? WellKnownRSID.FormRoot : StoreZoneType.Form.ToString() + "://" + path; BPMPermision perm = request.GetEnum <BPMPermision>("perm"); BPMFileInfoCollection fileInfos = new BPMFileInfoCollection(); JObject rv = new JObject(); rv["dataVersion"] = new JObject(); rv["dataVersion"]["lastUpdateTime"] = DateTime.Now; //获得数据 using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); if (SecurityManager.CheckPermision(cn, rsid, perm)) { fileInfos = cn.GetFileInfoList(StoreZoneType.Form, path); } } //将数据转化为Json集合 rv[YZJsonProperty.total] = fileInfos.Count; JArray children = new JArray(); rv[YZJsonProperty.children] = children; foreach (BPMFileInfo fileInfo in fileInfos) { if (!FileTypeChecker.IsFormFile(fileInfo.FileName)) { continue; } string fullName = String.IsNullOrEmpty(path) ? fileInfo.FileName : path + "/" + fileInfo.FileName; JObject item = new JObject(); children.Add(item); item["FileName"] = fileInfo.FileName; item["FullName"] = fullName; item["Length"] = fileInfo.Length; item["CreationTime"] = fileInfo.CreationTime; item["LastWriteTime"] = fileInfo.LastWriteTime; } return(rv); }
public virtual JObject GetFolders(HttpContext context) { YZRequest request = new YZRequest(context); BPMPermision perm = request.GetEnum <BPMPermision>("perm"); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); JObject rv = new JObject(); JArray items = new JArray(); rv[YZJsonProperty.children] = items; this.ExpandTree(cn, items, null, perm); rv[YZJsonProperty.success] = true; return(rv); } }
public virtual JArray CheckResourcesPermision(HttpContext context) { YZRequest request = new YZRequest(context); string strRsids = request.GetString("rsids"); BPMPermision perm = request.GetEnum <BPMPermision>("perm"); BPMObjectNameCollection rsids = BPMObjectNameCollection.FromStringList(strRsids, ','); JArray rv = new JArray(); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); foreach (string rsid in rsids) { rv.Add(SecurityManager.CheckPermision(cn, rsid, perm)); } } return(rv); }
public virtual object[] GetServersInFolder(HttpContext context) { YZRequest request = new YZRequest(context); string path = request.GetString("path", null); string rsid = String.IsNullOrEmpty(path) ? WellKnownRSID.ExtServerRoot : StoreZoneType.ExtServer.ToString() + "://" + path; BPMPermision perm = request.GetEnum <BPMPermision>("perm"); ExtServerCollection extServers = new ExtServerCollection(); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); if (SecurityManager.CheckPermision(cn, rsid, perm)) { extServers = cn.GetExtServerList(path, perm); } } List <object> rv = new List <object>(); foreach (ExtServer extServer in extServers) { if (extServer.ServerType == ServerType.Local) { continue; } rv.Add(new { ServerType = extServer.ServerType.ToString(), Name = extServer.Name, Host = extServer.Host }); } return(rv.ToArray()); }
public virtual JObject GetTree(HttpContext context) { YZRequest request = new YZRequest(context); string bpmServer = request.GetString("bpmServer", null); bool process = request.GetBool("process", false); bool checkbox = request.GetBool("checkbox", false); bool expand = request.GetBool("expand", false); BPMPermision perm = request.GetEnum <BPMPermision>("perm"); using (BPMConnection cn = new BPMConnection()) { this.OpenConnection(cn, bpmServer); JObject rv = new JObject(); JArray items = new JArray(); rv[YZJsonProperty.children] = items; this.ExpandTree(cn, items, null, perm, expand, process, checkbox); rv[YZJsonProperty.success] = true; return(rv); } }
protected virtual void ExpandTree(BPMConnection cn, JArray items, string path, BPMPermision perm, bool expand, bool withProcess, bool checkbox) { BPMObjectNameCollection folderNames = cn.GetFolders(StoreZoneType.Process, path, perm); foreach (String folderName in folderNames) { string folderPath; if (String.IsNullOrEmpty(path)) { folderPath = folderName; } else { folderPath = path + "/" + folderName; } JObject item = new JObject(); items.Add(item); item["leaf"] = false; item["text"] = folderName; item["iconCls"] = "folder"; item["expanded"] = expand; item["path"] = folderPath; JArray children = new JArray(); item[YZJsonProperty.children] = children; this.ExpandTree(cn, children, folderPath, perm, expand, withProcess, checkbox); } if (withProcess) { BPMProcessCollection processes = cn.GetProcessList(path, perm, true); foreach (BPMProcess process in processes) { string processPath; if (String.IsNullOrEmpty(path)) { processPath = process.Name; } else { processPath = path + "/" + process.Name; } JObject item = new JObject(); items.Add(item); item["leaf"] = true; item["text"] = process.Name; if (checkbox) { item["checked"] = false; } item["path"] = processPath; item["ProcessName"] = process.Name; item["ProcessVersion"] = process.Version.ToString(2); item["Description"] = process.Property.Description; } } }
protected virtual void ExpandTree(BPMConnection cn, JArray items, string path, BPMPermision perm) { BPMObjectNameCollection folderNames = cn.GetFolders(StoreZoneType.Form, path, perm); foreach (String folderName in folderNames) { string folderPath; if (String.IsNullOrEmpty(path)) { folderPath = folderName; } else { folderPath = path + "/" + folderName; } JObject item = new JObject(); items.Add(item); item["leaf"] = false; item["text"] = folderName; item["iconCls"] = "folder"; item["expanded"] = false; item["path"] = folderPath; JArray children = new JArray(); item[YZJsonProperty.children] = children; this.ExpandTree(cn, children, folderPath, perm); } }
public virtual JObject GetFavoriteProcesses(HttpContext context) { //System.Threading.Thread.Sleep(3000); YZRequest request = new YZRequest(context); string path = request.GetString("path", null); BPMPermision perm = request.GetEnum <BPMPermision>("perm", BPMPermision.Execute); string uid = YZAuthHelper.LoginUserAccount; FavoriteCollection favirites; using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { favirites = FavoriteManager.GetFavorites(provider, cn, uid, YZResourceType.Process); } } BPMProcessCollection processes; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); processes = cn.GetProcessList(path, favirites.ResIDs, perm); } //将数据转化为Json集合 JObject rv = new JObject(); rv[YZJsonProperty.total] = processes.Count; JArray children = new JArray(); rv[YZJsonProperty.children] = children; foreach (BPMProcess process in processes) { if (!process.Property.MobileInitiation) { continue; } JObject item = new JObject(); children.Add(item); item["ProcessName"] = process.Name; item["Active"] = process.Active; item["ProcessVersion"] = process.Version.ToString(2); item["Description"] = process.Property.Description; item["RelatedFile"] = process.Property.RelatedFile; item["ShortName"] = process.Property.ShortName; item["Color"] = process.Property.Color; if (String.IsNullOrEmpty(process.Property.ShortName)) { item["ShortName"] = YZStringHelper.GetProcessDefaultShortName(process.Name); } } return(rv); }