public virtual void Delete(HttpContext context) { YZRequest request = new YZRequest(context); this.ApproveCheck(context); int taskid = request.GetInt32("TaskID"); string comments = request.GetString("Comments", null); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); BPMTask.Delete(cn, taskid, comments); } }
public virtual JObject GetReActiveSteps(HttpContext context) { YZRequest request = new YZRequest(context); int taskid = request.GetInt32("TaskID"); JArray children = new JArray(); //获得数据 BPMStepCollection steps = null; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); steps = BPMTask.GetAllSteps(cn, taskid); BPMObjectNameCollection stepNames = new BPMObjectNameCollection(); for (int i = steps.Count - 1; i >= 0; i--) { BPMProcStep step = steps[i]; if (!step.IsHumanStep) { continue; } if (step.IsTaskOptStep || step.IsIndicateStep || step.IsInformStep || step.IsConsignStep) { continue; } if (stepNames.Contains(step.NodeName)) { continue; } stepNames.Add(step.NodeName); children.Add(Serialize(cn, step)); } } //输出数据 JObject rv = new JObject(); rv[YZJsonProperty.success] = true; rv[YZJsonProperty.total] = children.Count; rv[YZJsonProperty.children] = children; return(rv); }
public virtual JArray GetRemindTarget(HttpContext context) { YZRequest request = new YZRequest(context); int taskid = request.GetInt32("TaskID"); JArray rv = new JArray(); //获得数据 BPMStepCollection steps = null; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); steps = BPMTask.GetUnFinishedHumanSteps(cn, taskid); foreach (BPMProcStep step in steps) { if (step.Share && String.IsNullOrEmpty(step.OwnerAccount)) { UserCollection users = BPMProcStep.GetShareUsers(cn, step.StepID); foreach (User user in users) { JObject jStep = new JObject(); rv.Add(jStep); jStep["StepID"] = step.StepID; jStep["Share"] = true; jStep["NodeDisplayName"] = step.StepDisplayName; jStep["Account"] = user.Account; jStep["ShortName"] = user.ShortName; jStep["ElapsedMinutes"] = (DateTime.Now - step.ReceiveAt).TotalMinutes; } } else { JObject jStep = new JObject(); rv.Add(jStep); jStep["StepID"] = step.StepID; jStep["NodeDisplayName"] = step.StepDisplayName; jStep["Account"] = step.RecipientAccount; jStep["ShortName"] = step.RecipientDisplayName; jStep["ElapsedMinutes"] = (DateTime.Now - step.ReceiveAt).TotalMinutes; } } } return(rv); }
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 virtual void UpdateImageFile(HttpContext context) { YZRequest request = new YZRequest(context); int groupid = request.GetInt32("groupid"); string imageid = request.GetString("imageid"); using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { Group.Group group = GroupManager.GetGroup(provider, cn, groupid); group.ImageFileID = imageid; GroupManager.Update(provider, cn, group); } } }
public virtual BPMObjectNameCollection AddGroupMembers(HttpContext context) { YZRequest request = new YZRequest(context); int groupid = request.GetInt32("groupid"); string role = request.GetString("role"); JArray jPost = request.GetPostData <JArray>(); BPMObjectNameCollection uids = jPost.ToObject <BPMObjectNameCollection>(); using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { return(GroupManager.AddGroupMembers(provider, cn, groupid, uids, role)); } } }
/// <summary> /// 获取参数 /// </summary> /// <param name="context"></param> /// <returns></returns> public JObject GetParameter(HttpContext context) { JObject obj = new JObject(); try { YZRequest request = new YZRequest(context); //获取数据连接信息 int connectId = request.GetInt32("connectId"); ConnectInfo con = ConnectInfoManager.GetConnectInfo(connectId); WebServiceLogin login = JObject.Parse(con.connectStr).ToObject <WebServiceLogin>(); ISourceHandle handle = new WebServiceHandle(login); //获取接口信息 string functionName = request.GetString("functionName"); QueryDepictInfo info = handle.GetQueryInfo(functionName); //序列化 JArray parameterArray = new JArray(); obj["parameter"] = parameterArray; if (info.parameter != null && info.parameter.Count > 0) { if (CommonHandle.IsParameterNoType(info.parameter)) { obj[YZJsonProperty.success] = false; obj[YZJsonProperty.errorMessage] = "输入参数中有不符合规定的类型,无法进行配置!"; return(obj); } foreach (ColumnInfo item in info.parameter) { parameterArray.Add(BizCommon.GetColumnJson(item)); } } if (info.schema == null) { obj[YZJsonProperty.success] = false; obj[YZJsonProperty.errorMessage] = "该接口没有返回值,不可调用!"; return(obj); } obj[YZJsonProperty.success] = true; return(obj); } catch (Exception ex) { obj[YZJsonProperty.success] = false; obj[YZJsonProperty.errorMessage] = ex.ToString(); return(obj); } }
public virtual object GetGroupShortcut(HttpContext context) { YZRequest request = new YZRequest(context); int groupid = request.GetInt32("groupid"); using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { return(new { group = GroupManager.GetGroup(provider, cn, groupid), membercount = GroupManager.GetGroupMemberCount(provider, cn, groupid) }); } } }
public virtual void MoveObjectsToFolder(HttpContext context) { YZRequest request = new YZRequest(context); int targetfolderid = request.GetInt32("targetfolderid"); JObject post = request.GetPostData <JObject>(); List <int> fileids = post["fileids"].ToObject <List <int> >(); List <int> folderids = post["folderids"].ToObject <List <int> >(); using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { DirectoryManager.MoveFilesToFolder(provider, cn, fileids.ToArray(), targetfolderid); DirectoryManager.MoveFolders(provider, cn, folderids.ToArray(), targetfolderid, MovePosition.Append); } } }
public virtual JArray GetRecedeBackSteps(HttpContext context) { YZRequest request = new YZRequest(context); int stepid = request.GetInt32("StepID"); JObject rv = new JObject(); //获得数据 BPMStepCollection steps = null; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); steps = BPMProcStep.GetRecedableToSteps(cn, stepid); } return(this.Serialize(steps)); }
public virtual JArray GetPickbackableSteps(HttpContext context) { YZRequest request = new YZRequest(context); int taskid = request.GetInt32("TaskID"); JObject rv = new JObject(); //获得数据 BPMStepCollection steps = null; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); steps = BPMTask.GetPickbackableSteps(cn, taskid); } return(this.Serialize(steps)); }
public virtual object Rename(HttpContext context) { YZRequest request = new YZRequest(context); int itemid = request.GetInt32("itemid"); string comments = request.GetString("comments"); using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { Speak speak = SpeakManager.GetSpeak(provider, cn, itemid); speak.Comments = comments; SpeakManager.Update(provider, cn, speak); return(speak); } } }
public virtual object PickupShareTask(HttpContext context) { YZRequest request = new YZRequest(context); this.ApproveCheck(context); int stepid = request.GetInt32("StepID"); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); return(new { stepid = BPMProcStep.PickupShareStep(cn, stepid) }); } }
public virtual void MoveLibraries(HttpContext context) { YZRequest request = new YZRequest(context); string uid = YZAuthHelper.LoginUserAccount; string libType = request.GetString("libType"); int targetlibid = request.GetInt32("targetlibid"); MovePosition position = request.GetEnum <MovePosition>("position"); JArray post = request.GetPostData <JArray>(); List <int> libids = post.ToObject <List <int> >(); using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { LibraryManager.MoveLibraries(provider, cn, libType, libids.ToArray(), targetlibid, position); } } }
public virtual JObject PickbackRestart(HttpContext context) { YZRequest request = new YZRequest(context); int taskid = request.GetInt32("TaskID"); string comments = request.GetString("Comments", null); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); BPMProcStep step = BPMTask.PickBackRestart(cn, taskid, comments); JObject rv = new JObject(); rv[YZJsonProperty.success] = true; rv["StepName"] = step.NodeName; rv["UserFriendlyName"] = YZStringHelper.GetUserFriendlyName(step.RecipientAccount, step.RecipientFullName); return(rv); } }
public virtual MonthlyReportCollection GetUserReportsByYear(HttpContext context) { YZRequest request = new YZRequest(context); string account = request.GetString("account", YZAuthHelper.LoginUserAccount); int year = request.GetInt32("year"); MonthlyReportCollection rv; using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { rv = MonthlyReportManager.GetReports(provider, cn, account, year); } } return(this.ConvertToYearMonthResult(year, rv)); }
public virtual void DeleteGroupMembers(HttpContext context) { YZRequest request = new YZRequest(context); int groupid = request.GetInt32("groupid"); JArray jPost = request.GetPostData <JArray>(); BPMObjectNameCollection uids = jPost.ToObject <BPMObjectNameCollection>(); using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { foreach (string uid in uids) { GroupManager.DeleteGroupMember(provider, cn, groupid, uid); } } } }
public virtual object GetRootFolders(HttpContext context) { YZRequest request = new YZRequest(context); int groupid = request.GetInt32("groupid", -1); string folderType = request.GetString("folderType"); string uid = YZAuthHelper.LoginUserAccount; FileSystem.FolderCollection rootFolders = new FileSystem.FolderCollection(); using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { string filter = String.Format("FolderType=N'{0}'", provider.EncodeText(folderType)); LibraryCollection libs = LibraryManager.GetLibraries(provider, cn, uid, LibraryType.BPAFile.ToString(), null, null); foreach (Library.Library lib in libs) { FileSystem.FolderCollection folders = FileSystem.DirectoryManager.GetFolders(provider, cn, lib.FolderID, filter, null); foreach (FileSystem.Folder folder in folders) { folder.Name = lib.Name; } rootFolders.AddRange(folders); } if (groupid != -1) { Group.Group group = GroupManager.GetGroup(provider, cn, groupid); FileSystem.FolderCollection folders = FileSystem.DirectoryManager.GetFolders(provider, cn, group.FolderID, filter, null); foreach (FileSystem.Folder folder in folders) { folder.Name = group.Name; } rootFolders.AddRange(folders); } } } return(rootFolders); }
public virtual PageResult GetNotifyTopics(HttpContext context) { YZRequest request = new YZRequest(context); int days = request.GetInt32("days", DefaultDays); string uid = YZAuthHelper.LoginUserAccount; PageResult result; using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { result = YZSoft.Web.Notify.NotifyManager.GetNotifyTopics(provider, cn, uid, days, request.Start, request.Limit); this.PostProcessNotifyTopic(provider, cn, uid, result.Table); } } return(result); }
public virtual object Inform(HttpContext context) { YZRequest request = new YZRequest(context); int taskid = request.GetInt32("TaskID"); JObject jPost = request.GetPostData <JObject>(); string comments = (string)jPost["comments"]; BPMObjectNameCollection uids = jPost["uids"].ToObject <BPMObjectNameCollection>(); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); UserCollection users = BPMTask.Inform(cn, taskid, uids, comments); return(new { UserNameList = YZStringHelper.GetUserShortNameListString(users) }); } }
public virtual JObject RecedeBack(HttpContext context) { YZRequest request = new YZRequest(context); this.ApproveCheck(context); int stepid = request.GetInt32("StepID"); JObject jPost = request.GetPostData <JObject>(); string comments = (string)jPost["comments"]; string formdata = (string)jPost["formdata"]; List <int> toStepIDs = jPost["toStepIDs"].ToObject <List <int> >(); BPMTask task; BPMProcStep srcStep; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); //移动审批不保存表单数据 if (!String.IsNullOrEmpty(formdata)) { BPMProcess.Post(cn, formdata); } srcStep = BPMProcStep.Load(cn, stepid); task = BPMTask.Load(cn, srcStep.TaskID); BPMStepCollection newSteps = BPMProcStep.RecedeBack(cn, stepid, toStepIDs.ToArray(), comments); List <string> to = new List <string>(); foreach (BPMProcStep step in newSteps) { to.Add(String.Format("{0}[{1}]", step.NodeName, YZStringHelper.GetUserFriendlyName(step.RecipientAccount, step.RecipientFullName))); } JObject rv = new JObject(); rv[YZJsonProperty.success] = true; rv["sn"] = task.SerialNum; rv["tosteps"] = String.Join(";", to.ToArray()); return(rv); } }
public virtual object SaveAudio(HttpContext context, HttpPostedFile file, string fileName, long fileSize, string fileExt) { YZRequest request = new YZRequest(context); int duration = request.GetInt32("duration"); AttachmentInfo attachment = new AttachmentInfo(); attachment.Name = fileName; attachment.Ext = fileExt; attachment.LParam1 = duration; attachment = AttachmentManager.SaveAsAttachment(file, attachment); return(new { success = true, fileid = attachment.FileID }); }
public virtual JObject GetTaskForecastSteps(HttpContext context) { YZRequest request = new YZRequest(context); int taskid = request.GetInt32("TaskID"); string xmlData = request.GetString("xmlData", null); if (!String.IsNullOrEmpty(xmlData)) { xmlData = Encoding.UTF8.GetString(Convert.FromBase64String(xmlData)); } JObject rv = new JObject(); //获得数据 BPMStepCollection steps = null; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); steps = BPMTask.GetForecastSteps(cn, taskid, xmlData); //将数据转化为Json集合 JArray children = new JArray(); rv[YZJsonProperty.children] = children; foreach (BPMProcStep step in steps) { if (!step.IsHumanStep) { continue; } children.Add(Serialize(cn, step)); } rv[YZJsonProperty.total] = children.Count; } //输出数据 rv[YZJsonProperty.success] = true; return(rv); }
public virtual object GetPanoramicTree(HttpContext context) { YZRequest request = new YZRequest(context); int folderid = request.GetInt32("node"); using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { FileCollection files = new FileCollection(); FileSystem.FileCollection allfiles = new FileSystem.FileCollection(); FileSystem.FolderCollection allfolders = FileSystem.DirectoryManager.GetAllChildFolders(provider, cn, folderid, null, null); FileSystem.FolderCollection rootFolders = allfolders.BuildTree(folderid); 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; } files.Add(file); } JObject rv = new JObject(); JArray items = new JArray(); rv[YZJsonProperty.children] = items; this.ExpandTree(provider, cn, items, this.GetRootFiles(files), files); rv[YZJsonProperty.success] = true; return(rv); } } }
public virtual void Reject(HttpContext context) { YZRequest request = new YZRequest(context); int taskid = request.GetInt32("TaskID"); JObject jPost = request.GetPostData <JObject>(); string comments = (string)jPost["comments"]; string formdata = (string)jPost["formdata"]; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); if (!String.IsNullOrEmpty(formdata)) { BPMProcess.Post(cn, formdata); } BPMTask.Reject(cn, taskid, comments); } }
public virtual object GetTaskInfo(HttpContext context) { YZRequest request = new YZRequest(context); int taskid = request.GetInt32("TaskID"); BPMTask task = new BPMTask(); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); task.Open(cn, taskid); } return(new { TaskID = task.TaskID, ProcessName = task.ProcessName, ProcessVersion = task.ProcessVersion.ToString(2), SerialNum = task.SerialNum, }); }
public virtual object GetStepOverviewInfo(HttpContext context) { YZRequest request = new YZRequest(context); int stepid = request.GetInt32("stepid"); string fileid; string spriteid; BPMProcStep step; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); BPMProcStep.GetRelatedSprite(cn, stepid, out fileid, out spriteid); step = BPMProcStep.Load(cn, stepid); } using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { File file = File.Load(provider, cn, fileid); Sprite sprite = file.Sprites[spriteid]; sprite.AllReferences.RefreshName(provider, cn); SpriteCollection usedby = sprite.GetUsedBySprites(provider, cn); return(new { sprite = sprite, usedby = usedby.Identities, usedbyFiles = usedby.Files.Identities, parentProcess = new { ProcessName = step.ProcessName, Version = step.ProcessVersion.ToString(2) } }); } } }
public virtual JObject GetTaskProcessedSteps(HttpContext context) { YZRequest request = new YZRequest(context); int taskid = request.GetInt32("TaskID"); JObject rv = new JObject(); //获得数据 BPMStepCollection steps = null; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); steps = BPMTask.GetAllSteps(cn, taskid); //将数据转化为Json集合 JArray children = new JArray(); rv[YZJsonProperty.children] = children; foreach (BPMProcStep step in steps) { if (!step.IsHumanStep) { continue; } if (!step.Finished) { continue; } children.Add(Serialize(cn, step)); } rv[YZJsonProperty.total] = children.Count; } //输出数据 rv[YZJsonProperty.success] = true; return(rv); }
public virtual Library.Library UpdateLibrary(HttpContext context) { YZRequest request = new YZRequest(context); int libid = request.GetInt32("libid"); bool updateProperty = request.GetBool("property", true); bool updateAcl = request.GetBool("acl", true); JObject jPost = request.GetPostData <JObject>(); Library.Library libPost = jPost["data"].ToObject <Library.Library>(); ACL acl = jPost["acl"].ToObject <ACL>(); using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { Library.Library lib = LibraryManager.GetLibrary(provider, cn, libid); if (updateProperty) { lib.ImageFileID = libPost.ImageFileID; lib.Name = libPost.Name; lib.Desc = libPost.Desc; LibraryManager.Update(provider, cn, lib); } if (updateAcl) { using (BPMConnection bpmcn = new BPMConnection()) { bpmcn.WebOpen(); SecurityManager.SaveACL(bpmcn, SecurityResType.Library, lib.LibID.ToString(), null, acl); } } return(lib); } } }
public virtual object PostComments(HttpContext context) { YZRequest request = new YZRequest(context); string clientid = request.GetString("clientid", null); YZResourceType resType = request.GetEnum <YZResourceType>("resType"); string resId = request.GetString("resId"); int duration = request.GetInt32("duration", -1); JObject jPost = request.GetPostData <JObject>(); string msg = (string)jPost["message"]; string uid = YZAuthHelper.LoginUserAccount; YZMessage message = new YZMessage(); message.resType = resType; message.resId = resId; message.uid = uid; message.date = DateTime.Now; message.message = msg; message.replyto = -1; message.duration = duration; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); this.PostProcessMessage(cn, message); } using (IYZDbProvider provider = YZDbProviderManager.DefaultProvider) { using (IDbConnection cn = provider.OpenConnection()) { SocialManager.Insert(provider, cn, message); SocialManager.UpdateReaded(provider, cn, resType, resId, uid, message.id); } } YZSoft.Web.Push.MessageBus.Instance.onPostComments(clientid, message); return(message); }