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); } }
/* * AZTEC, * CODABAR, * CODE_39, * CODE_93, * CODE_128, * DATA_MATRIX, * EAN_8, * EAN_13, * ITF, * MAXICODE, * PDF_417, * QR_CODE, * RSS_14, * RSS_EXPANDED, * UPC_A, * UPC_E, * All_1D, * UPC_EAN_EXTENSION, * MSI, * PLESSEY, * IMB, */ public virtual void Encode(HttpContext context) { YZRequest request = new YZRequest(context); string text = request.GetString("text"); int width = request.GetInt32("width", 0); int height = request.GetInt32("height", 42); BarcodeFormat format = request.GetEnum <BarcodeFormat>("format", BarcodeFormat.CODE_128); bool pureBarcode = request.GetBool("pureBarcode", false); EncodingOptions options = new EncodingOptions { //DisableECI = true, //CharacterSet = "UTF-8", PureBarcode = pureBarcode, Margin = 0, Width = width, Height = height }; BarcodeWriter writer = new BarcodeWriter(); writer.Format = format; writer.Options = options; using (Bitmap image = writer.Write(text)) { this.ProcessResponseHeader(context, format + ".gif", false); image.Save(context.Response.OutputStream, ImageFormat.Gif); } }
public virtual void UpdateReaded(HttpContext context) { YZRequest request = new YZRequest(context); YZResourceType resType = request.GetEnum <YZResourceType>("resType"); string resId = request.GetString("resId"); int msgId = request.GetInt32("msgId"); string uid = YZAuthHelper.LoginUserAccount; using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { YZSoft.Web.Social.SocialManager.UpdateReaded(provider, cn, resType, resId, uid, msgId); } } JObject jMessage = new JObject(); YZMessage message = new YZMessage(); message.resType = resType; message.resId = resId; message.uid = uid; message.message = jMessage.ToString(); message.date = DateTime.Now; YZSoft.Web.Push.MessageBus.Instance.PushMessage(null, new string[] { "readed" }, message, false); }
public virtual object AddFavorite(HttpContext context) { YZRequest request = new YZRequest(context); YZResourceType resType = request.GetEnum <YZResourceType>("resType"); string resId = request.GetString("resId"); string comments = request.GetString("comments", null); string uid = YZAuthHelper.LoginUserAccount; using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { if (!FavoriteManager.HasFavorited(provider, cn, uid, resType, resId)) { Favorite favorite = new Favorite() { uid = uid, resType = resType, resId = resId, comments = comments, date = DateTime.Now, orderIndex = FavoriteManager.GetNextOrderIndex(provider, cn, uid, resType) }; FavoriteManager.Insert(provider, cn, favorite); } return(true); } } }
public virtual void MoveObjects(HttpContext context) { YZRequest request = new YZRequest(context); StoreZoneType zone = request.GetEnum <StoreZoneType>("zone"); string folder = request.GetString("folder", null); string tergetname = request.GetString("tergetname", null); MovePosition position = request.GetEnum <MovePosition>("position"); JArray post = request.GetPostData <JArray>(); BPMObjectNameCollection names = post.ToObject <BPMObjectNameCollection>(); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); cn.MoveObjects(zone, folder, names, tergetname, position); } }
public virtual JObject CreateNewFolder(HttpContext context) { YZRequest request = new YZRequest(context); StoreZoneType zone = request.GetEnum <StoreZoneType>("zone"); string path = request.GetString("path", ""); string folderName; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); folderName = cn.CreateNewFolder(zone, path); } string folderPath; if (String.IsNullOrEmpty(path)) { folderPath = folderName; } else { folderPath = path + "/" + folderName; } JObject item = new JObject(); item["leaf"] = false; item["text"] = folderName; item["iconCls"] = "folder"; item["path"] = folderPath; item["rsid"] = zone.ToString() + "://" + folderPath; return(item); }
public virtual JObject GetFolders(HttpContext context) { YZRequest request = new YZRequest(context); int folderid = request.GetInt32("node"); bool checkpermision = request.GetBool("checkpermision", false); SecurityModel securitymodel = request.GetEnum <SecurityModel>("securitymodel", SecurityModel.RBAC); bool withfolder = request.GetBool("folder", true); bool withfile = request.GetBool("file", false); bool iconFromExt = request.GetBool("iconFromExt", false); bool expand = request.GetBool("expand", false); using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { using (BPMConnection bpmcn = new BPMConnection()) { if (checkpermision && securitymodel == SecurityModel.RBAC) { bpmcn.WebOpen(); } JObject rv = new JObject(); JArray items = new JArray(); rv[YZJsonProperty.children] = items; this.ExpandTree(provider, cn, bpmcn, items, folderid, withfolder, withfile, expand, iconFromExt, checkpermision, securitymodel, true); rv[YZJsonProperty.success] = true; return(rv); } } } }
public virtual object GetOrgTree(HttpContext context) { YZRequest request = new YZRequest(context); string path = request.GetString("node", null); string srcoupath = request.GetString("srcoupath", null); GetRootOUsType getRootOUsType = request.GetEnum <GetRootOUsType>("getRootOUsType", GetRootOUsType.All); if (YZStringHelper.EquName(path, "root")) { path = null; } JObject rv = new JObject(); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); JArray children = new JArray(); rv[YZJsonProperty.children] = children; if (String.IsNullOrEmpty(path)) { SecurityToken token = cn.Token; JObject dirParentItem = null; this.Expand(cn, children, path, token, ref dirParentItem, getRootOUsType, srcoupath); if (dirParentItem != null) { dirParentItem["dirou"] = true; //没必要列出所在部门的子部门 //dirParentItem["expanded"] = false; //dirParentItem.ChildItems.Clear(); } } else { OUCollection ous = OU.GetChildren(cn, path); foreach (OU ou in ous) { JObject item = new JObject(); item["leaf"] = false; item["text"] = ou.Name; item["iconCls"] = "folder"; item["id"] = ou.FullName; item["enpandable"] = true; children.Add(item); item["data"] = this.GetNodeData(ou); } } } //输出数据 return(rv); }
/// <summary> /// 返回数据连接列表 /// </summary> /// <param name="context"></param> /// <returns></returns> public JArray GetConnectList(HttpContext context) { YZRequest request = new YZRequest(context); SourceTypeEnum sourceType = request.GetEnum <SourceTypeEnum>("sourceType"); JArray array = new JArray(); ConnectInfoCollection rv = ConnectInfoManager.GetConnectList(sourceType); return(JArray.FromObject(rv)); }
public virtual void MoveFavorites(HttpContext context) { YZRequest request = new YZRequest(context); string uid = YZAuthHelper.LoginUserAccount; YZResourceType resType = request.GetEnum <YZResourceType>("resType"); string target = request.GetString("target"); MovePosition position = request.GetEnum <MovePosition>("position"); JArray post = request.GetPostData <JArray>(); List <string> ids = post.ToObject <List <string> >(); using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { FavoriteManager.MoveFavorites(provider, cn, uid, resType, ids.ToArray(), target, position); } } }
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 void DeleteFolder(HttpContext context) { YZRequest request = new YZRequest(context); StoreZoneType zone = request.GetEnum <StoreZoneType>("zone"); string path = request.GetString("path"); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); cn.DeleteFolder(zone, path); } }
public virtual JObject GetHistoryTasks(HttpContext context) { YZRequest request = new YZRequest(context); GridPageInfo gridPageInfo = new GridPageInfo(context); HistoryTaskType taskType = request.GetEnum <HistoryTaskType>("HistoryTaskType", HistoryTaskType.AllAccessable); string strTaskType = request.GetString("HistoryTaskType"); int year = request.GetString("byYear", "1") == "0" ? -1 : request.GetInt32("Year"); //获得数据 JObject rv = new JObject(); string taskTableFilter; string stepTableFilter; using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { taskTableFilter = this.GetFilterStringHistoryTaskTaskTable(request, provider); stepTableFilter = this.GetFilterStringHistoryTaskStep(request, provider); } using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); int rowcount; BPMTaskCollection tasks = cn.GetHistoryTasks(year, taskType, taskTableFilter, stepTableFilter, request.GetSortString("TaskID DESC", null, "TaskID DESC"), gridPageInfo.Start, gridPageInfo.Limit, out rowcount); rv[YZJsonProperty.total] = rowcount; JArray children = new JArray(); rv[YZJsonProperty.children] = children; foreach (BPMTask task in tasks) { JObject item = new JObject(); children.Add(item); item["TaskID"] = task.TaskID; item["SerialNum"] = task.SerialNum; item["ProcessName"] = task.ProcessName; item["ProcessVersion"] = task.ProcessVersion.ToString(2); item["OwnerAccount"] = task.OwnerAccount; item["OwnerDisplayName"] = task.OwnerFullName; item["AgentAccount"] = task.AgentAccount; item["AgentDisplayName"] = task.AgentFullName; item["CreateAt"] = task.CreateAt; item["State"] = YZJsonHelper.GetTaskStateJObject(cn, task.TaskState, task.TaskID); item["Description"] = String.IsNullOrEmpty(task.Description) ? Resources.YZStrings.All_None : task.Description; } } 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 BPMObjectNameCollection GetStoreFolders(HttpContext context) { YZRequest request = new YZRequest(context); StoreZoneType zone = request.GetEnum <StoreZoneType>("zone"); string folder = request.GetString("folder", null); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); return(cn.GetFolders(zone, folder)); } }
public virtual void ImageStreamFromFileID(HttpContext context) { YZRequest request = new YZRequest(context); string fileid = request.GetString("fileid", null); ScaleMode scale = request.GetEnum <ScaleMode>("scale", ScaleMode.None); ImageFormat format = YZImageHelper.ParseImageFormat(request.GetString("format", "png")); int width = 0; int height = 0; if (scale != ScaleMode.None) { width = request.GetInt32("width"); height = request.GetInt32("height"); } AttachmentInfo attachment; string filePath = this.GetImageFileFromFileID(fileid, scale, width, height, format, out attachment); if (String.IsNullOrEmpty(filePath)) { if (attachment == null) { filePath = context.Server.MapPath("~/YZSoft/Attachment/img/EmptyImageAttachment.png"); } else { if (YZMimeMapping.isVedioFile(attachment.Ext)) { filePath = context.Server.MapPath("~/YZSoft/Attachment/img/EmptyImageAttachment.png"); } else { filePath = context.Server.MapPath("~/YZSoft/Attachment/img/EmptyImageAttachment.png"); } } } string fileName = Path.GetFileNameWithoutExtension(attachment == null ? "empty.png" : attachment.Name); if (String.IsNullOrEmpty(Path.GetExtension(filePath))) //原图 { fileName += attachment.Ext; } else { fileName += Path.GetExtension(filePath); } this.ProcessResponseHeader(context, fileName, true); context.Response.TransmitFile(filePath); }
public virtual string RenameFolder(HttpContext context) { YZRequest request = new YZRequest(context); StoreZoneType zone = request.GetEnum <StoreZoneType>("zone"); string path = request.GetString("path"); string newname = request.GetString("newname"); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); return(cn.RenameFolder(zone, path, newname)); } }
public virtual object MoveFolders(HttpContext context) { YZRequest request = new YZRequest(context); StoreZoneType zone = request.GetEnum <StoreZoneType>("zone"); string targetPath = request.GetString("targetPath", null); MovePosition position = request.GetEnum <MovePosition>("position"); JArray post = request.GetPostData <JArray>(); BPMObjectNameCollection paths = post.ToObject <BPMObjectNameCollection>(); List <string> rv = new List <string>(); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); foreach (string path in paths) { rv.Add(cn.MoveFolder(zone, path, targetPath, position)); } } return(rv); }
public virtual void SaveFolder(HttpContext context) { YZRequest request = new YZRequest(context); SecurityResType securityResType = request.GetEnum <SecurityResType>("securityResType"); string path = request.GetString("path", ""); JObject post = request.GetPostData <JObject>(); ACL acl = post["acl"].ToObject <ACL>(); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); SecurityManager.SaveACL(cn, securityResType, path, null, acl); } }
public virtual void DeleteObjects(HttpContext context) { YZRequest request = new YZRequest(context); StoreZoneType zone = request.GetEnum <StoreZoneType>("zone"); string folder = request.GetString("folder", ""); JArray jPost = request.GetPostData <JArray>(); StoreObjectIdentityCollection objects = jPost.ToObject <StoreObjectIdentityCollection>(); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); cn.DeleteObjects(zone, folder, objects); } }
public virtual void SetOutOfOffice(HttpContext context) { YZRequest request = new YZRequest(context); OutOfOfficeState state = request.GetEnum <OutOfOfficeState>("state"); DateTime dateFrom = request.GetDateTime("DateFrom", DateTime.MinValue); DateTime dateTo = request.GetDateTime("DateTo", DateTime.MinValue); string uid = YZAuthHelper.LoginUserAccount; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); User.SetOutOfOffice(cn, uid, state, dateFrom, dateTo); } }
public virtual void MoveRules(HttpContext context) { YZRequest request = new YZRequest(context); int targetruleid = request.GetInt32("targetruleid"); MovePosition position = request.GetEnum <MovePosition>("position"); JArray post = request.GetPostData <JArray>(); List <int> ruleids = post.ToObject <List <int> >(); string uid = YZAuthHelper.LoginUserAccount; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); TaskRule.MoveTaskRules(cn, uid, ruleids.ToArray(), targetruleid, position); } }
public virtual object GetNewMesssageCount(HttpContext context) { YZRequest request = new YZRequest(context); YZResourceType resType = request.GetEnum <YZResourceType>("resType"); string resId = request.GetString("resId"); string uid = YZAuthHelper.LoginUserAccount; using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { return(YZSoft.Web.Social.SocialManager.GetNewMessageCount(provider, cn, resType, resId, uid)); } } }
public virtual void SaveLeavingSetting(HttpContext context) { string account = YZAuthHelper.LoginUserAccount; YZRequest request = new YZRequest(context); OutOfOfficeState state = request.GetEnum <OutOfOfficeState>("State"); DateTime from = request.GetDateTime("From", DateTime.MinValue); DateTime to = request.GetDateTime("To", DateTime.MinValue); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); User.SetOutOfOffice(cn, account, state, from, to); } }
public virtual void RenameObject(HttpContext context) { YZRequest request = new YZRequest(context); StoreZoneType zone = request.GetEnum <StoreZoneType>("zone"); string folder = request.GetString("folder", ""); string name = request.GetString("name"); string newname = request.GetString("newname"); string path = System.IO.Path.Combine(folder, name); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); cn.RenameObject(zone, path, newname); } }
public virtual void MoveFiles(HttpContext context) { YZRequest request = new YZRequest(context); string root = request.GetString("root"); string path = request.GetString("path", null); BPMObjectNameCollection excludes = BPMObjectNameCollection.FromStringList(request.GetString("excludes", null), ','); string tergetfilename = request.GetString("tergetfilename"); MovePosition position = request.GetEnum <MovePosition>("position"); string rootPath = OSDirectoryManager.GetRootPath(root); string folderPath = Path.Combine(context.Server.MapPath(rootPath), path); JArray post = request.GetPostData <JArray>(); List <string> filenames = post.ToObject <List <string> >(); OSDirectoryManager.MoveFiles(folderPath, excludes, filenames.ToArray(), tergetfilename, position); }
public virtual void MoveObjectsToFolder(HttpContext context) { YZRequest request = new YZRequest(context); StoreZoneType zone = request.GetEnum <StoreZoneType>("zone"); string srcfolder = request.GetString("srcfolder", null); string tagfolder = request.GetString("tagfolder", null); bool copy = request.GetBool("copy", false); JArray post = request.GetPostData <JArray>(); BPMObjectNameCollection objectNames = post.ToObject <BPMObjectNameCollection>(); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); cn.MoveObjectsToFolder(zone, srcfolder, objectNames, tagfolder, copy); } }
public virtual void MoveFolders(HttpContext context) { YZRequest request = new YZRequest(context); int targetfolderid = request.GetInt32("targetfolderid"); MovePosition position = request.GetEnum <MovePosition>("position"); JArray post = request.GetPostData <JArray>(); List <int> folderids = post.ToObject <List <int> >(); using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { DirectoryManager.MoveFolders(provider, cn, folderids.ToArray(), targetfolderid, position); } } }
public JObject Base64ImageFromFileID(HttpContext context) { YZRequest request = new YZRequest(context); string fileid = request.GetString("fileid", null); ScaleMode scale = request.GetEnum <ScaleMode>("scale", ScaleMode.None); ImageFormat format = YZImageHelper.ParseImageFormat(request.GetString("format", "png")); int width = 0; int height = 0; if (scale != ScaleMode.None) { width = request.GetInt32("width"); height = request.GetInt32("height"); } AttachmentInfo attachment; string filePath = this.GetImageFileFromFileID(fileid, scale, width, height, format, out attachment); if (String.IsNullOrEmpty(filePath)) { if (YZMimeMapping.isVedioFile(attachment.Ext)) { filePath = context.Server.MapPath("~/YZSoft/Attachment/img/EmptyImageAttachment.png"); } else { filePath = context.Server.MapPath("~/YZSoft/Attachment/img/EmptyImageAttachment.png"); } } string fileName = Path.GetFileNameWithoutExtension(attachment.Name) + Path.GetExtension(filePath); Bitmap bmp = new Bitmap(filePath); MemoryStream ms = new MemoryStream(); bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Png); byte[] arr = new byte[ms.Length]; ms.Position = 0; ms.Read(arr, 0, (int)ms.Length); ms.Close(); JObject rv = new JObject(); rv["base64"] = Convert.ToBase64String(arr); return(rv); }
public virtual JObject GetStoreObjectPerms(HttpContext context) { YZRequest request = new YZRequest(context); StoreZoneType zone = request.GetEnum <StoreZoneType>("zone"); string path = request.GetString("path", null); string strPerms = request.GetString("perms", null); BPMObjectNameCollection ids = BPMObjectNameCollection.FromStringList(request.GetString("ids", ""), ',');; BPMPermision[] bpmPerms = YZSecurityHelper.ParsePermisions(strPerms); JObject rv = new JObject(); JObject perms = new JObject(); rv["perms"] = perms; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); foreach (string id in ids) { string fullName; if (String.IsNullOrEmpty(path)) { fullName = id; } else { fullName = path + "/" + id; } ACL acl = SecurityManager.GetACL(cn, zone.ToString() + "://" + fullName); JObject jPerm = new JObject(); perms[id] = jPerm; foreach (BPMPermision perm in bpmPerms) { jPerm[perm.ToString()] = acl.HasPermision(cn.Token, perm); } } } rv[YZJsonProperty.success] = true; return(rv); }