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); } } }
public virtual JObject GetProcessForecastSteps(HttpContext context) { YZRequest request = new YZRequest(context); string processName = request.GetString("processName"); Version version = request.GetVersion("version"); string owner = request.GetString("owner", null); string xmlData = request.GetString("xmlData", null); if (!String.IsNullOrEmpty(xmlData)) { xmlData = Encoding.UTF8.GetString(Convert.FromBase64String(xmlData)); } if (String.IsNullOrEmpty(owner)) { throw new Exception(String.Format(Resources.YZStrings.Aspx_ProcessForecastNoPos, YZAuthHelper.LoginUserAccount)); } JObject rv = new JObject(); //获得数据 BPMStepCollection steps = null; using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); steps = BPMProcess.GetForecastSteps(cn, processName, version, owner, 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 void SaveMobileFormSetting(HttpContext context) { YZRequest request = new YZRequest(context); string processName = request.GetString("processName"); Version version = request.GetVersion("version"); JObject post = request.GetPostData <JObject>(); MobileFormSetting mobileFormSetting = post.ToObject <MobileFormSetting>(); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); BPMProcess.SaveMobileFormSetting(cn, processName, version, mobileFormSetting); } }
public virtual BPMProcess GetProcessDefine(HttpContext context) { YZRequest request = new YZRequest(context); string path = request.GetString("path", null); Version version = request.GetVersion("version", null); BPMProcess process = new BPMProcess(); //获得数据 using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); process.Load(cn, path, version); } return(process); }
public virtual object GetMobileFormSetting(HttpContext context) { YZRequest request = new YZRequest(context); string processName = request.GetString("processName"); Version version = request.GetVersion("version"); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); return(new { tables = BPMProcess.GetProcessGlobalTableIdentitys(cn, processName, version), mobileFormSetting = BPMProcess.GetMobileFormSetting(cn, processName, version) }); } }
public virtual object GetProcessProperty(HttpContext context) { YZRequest request = new YZRequest(context); string processName = request.GetString("processName"); Version version = request.GetVersion("version"); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); return(new { GlobalTableIdentitys = BPMProcess.GetProcessGlobalTableIdentitys(cn, processName, version), Property = BPMProcess.GetProcessProperty(cn, processName, version), MessageGroups = BPMProcess.GetMessageGroups(cn, processName, version), Events = BPMProcess.GetEvents(cn, processName, version) }); } }
public virtual object SaveProcess(HttpContext context) { YZRequest request = new YZRequest(context); string path = request.GetString("path"); Version version = request.GetVersion("version"); JObject post = request.GetPostData <JObject>(); BPMProcess process = post.ToObject <BPMProcess>(); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); process.Save(cn, path, version, true); } return(new { server = WebConfigurationManager.AppSettings["BPMServerName"], version = process.Version.ToString(2) }); }
public virtual object GetProcessDefine(HttpContext context) { YZRequest request = new YZRequest(context); string processName = request.GetString("processName"); Version version = request.GetVersion("version"); NodeItemCollection nodes = new NodeItemCollection(); LinkItemCollection links = new LinkItemCollection(); //获得数据 using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); BPMProcess.GetTaskTraceInfo(cn, processName, version, out nodes, out links); } return(new { Nodes = nodes, Links = links }); }
public virtual void SaveProcessProperty(HttpContext context) { YZRequest request = new YZRequest(context); string folder = request.GetString("folder", ""); string processName = request.GetString("processName"); Version version = request.GetVersion("version"); string path = System.IO.Path.Combine(folder, processName); JObject post = request.GetPostData <JObject>(); ProcessProperty property = post["Property"].ToObject <ProcessProperty>(); MessageGroupCollection messageGroups = post["MessageGroups"].ToObject <MessageGroupCollection>(); EventCollection events = post["Events"].ToObject <EventCollection>(); ACL acl = post["acl"].ToObject <ACL>(); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); BPMProcess.SetProcessProperty(cn, processName, version, property, messageGroups, events); SecurityManager.SaveACL(cn, SecurityResType.Process, path, null, acl); } }
public virtual JObject GetSimulateInfo(HttpContext context) { YZRequest request = new YZRequest(context); string processName = request.GetString("processName"); Version version = request.GetVersion("version"); string permisions = request.GetString("Permisions", null); string uid = request.GetString("uid"); BPMProcStep step; BPMTask task; CommentItemCollection comments; FlowDataSet formdataset; BPMStepCollection steps; ProcessSubModel subModel; JObject perm = null; JObject directSendInfo = null; User user; YZAuthHelper.SetAuthCookie(uid); try { using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); TableIdentityCollection tableIdentities = BPMProcess.GetProcessGlobalTableIdentitys(cn, processName, version); formdataset = DataSourceManager.LoadDataSetSchema(cn, tableIdentities); user = User.TryGetUser(cn, uid); if (user == null) { user = new User(); user.Account = uid; user.DisplayName = "张三"; } } } catch (Exception e) { YZAuthHelper.ClearAuthCookie(); throw e; } task = this.GetSimulateTask(user, processName, version); step = this.GetSimulateStep(task, user); comments = new CommentItemCollection(); steps = this.GetSimulateSteps(task, step, user); subModel = ProcessSubModel.Process; perm = new JObject(); directSendInfo = null; int total = 3; int newMessageCount = 1; //准备返回值 JObject result = new JObject(); JObject jForm = new JObject(); jForm["xclass"] = "YZSoft.form.Form5"; jForm["config"] = new JObject(); result["form"] = jForm; result["subModel"] = subModel.ToString(); result["task"] = this.Serialize(task); result["step"] = this.Serialize(step); result["NodePermisions"] = this.Serialize(NodePermision.Inform); result["Comments"] = step.Comments; result["perm"] = perm; result["socialInfo"] = this.SerializeSocialInfo(total, newMessageCount); result["steps"] = this.SerializeForTrace(steps); result["signcomments"] = JArray.FromObject(comments); result["formdataset"] = this.ToResult(formdataset, true); if (subModel == ProcessSubModel.Process) { result["shareTask"] = step.Share; result["IsConsign"] = step.IsConsignStep; JArray links = new JArray(); result["links"] = links; result["directsend"] = directSendInfo; } return(result); }
public virtual JObject GetSimulateForm(HttpContext context) { YZRequest request = new YZRequest(context); string processName = request.GetString("processName"); Version version = request.GetVersion("version"); string uid = request.GetString("uid"); BPMProcStep step; BPMTask task; MobileFormSetting formSetting; FlowDataSet formdataset; CommentItemCollection comments; User user; YZAuthHelper.SetAuthCookie(uid); try { using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); TableIdentityCollection tableIdentities = BPMProcess.GetProcessGlobalTableIdentitys(cn, processName, version); formdataset = DataSourceManager.LoadDataSetSchema(cn, tableIdentities); user = User.TryGetUser(cn, uid); if (user == null) { user = new User(); user.Account = uid; user.DisplayName = "张三"; } } } catch (Exception e) { YZAuthHelper.ClearAuthCookie(); throw e; } task = this.GetSimulateTask(user, processName, version); step = this.GetSimulateStep(task, user); JObject post = request.GetPostData <JObject>(); if (post != null) { formSetting = post.ToObject <MobileFormSetting>(); } else { formSetting = new MobileFormSetting(); } comments = new CommentItemCollection(); for (int i = 0; i < formdataset.Tables.Count; i++) { FlowDataTable table = formdataset.Tables[i]; if (!table.IsRepeatableTable) { table.Rows.Add(this.CreateNewRow(table, i, 0)); } else { table.Rows.Add(this.CreateNewRow(table, i, 0)); table.Rows.Add(this.CreateNewRow(table, i, 1)); } } //附件的演示数据会导致错误(附件ID没有),必须处理(将附件数据置空) foreach (FlowDataTable table in formSetting.ControlDataSet.Tables) { FlowDataTable dataTable = formdataset.Tables.TryGetTable(table.TableName); if (dataTable != null) { foreach (FlowDataColumn column in table.Columns) { if (column.MapTo == "YZSoft$ux.field.Attachment") { foreach (FlowDataRow row in dataTable.Rows) { row[column.ColumnName] = ""; //不能设置null,设置null附件控件表现形式不同 } } } } } this.ParseMobileFormSetting(formSetting); //准备返回值 JObject result = new JObject(); //填充form域(表单信息) JObject fieldset; JArray items; JObject field; JObject form = new JObject(); result["form"] = form; JArray formitems = new JArray(); form["items"] = formitems; //基本信息的fieldset填充 fieldset = new JObject(); formitems.Add(fieldset); fieldset["xtype"] = "fieldset"; fieldset["innerName"] = "Header"; //fieldset["title", "基本信息"); items = new JArray(); fieldset["items"] = items; field = new JObject(); items.Add(field); field["xclass"] = "YZSoft.form.FormHeader"; field["padding"] = "16 10 10 16"; field["task"] = this.Serialize(task); field = new JObject(); items.Add(field); field["xclass"] = "Ext.field.Field"; field["label"] = Resources.YZMobile.Aspx_FormData_StepName; field["html"] = step.StepDisplayName; field = new JObject(); items.Add(field); field["xclass"] = "Ext.field.Field"; field["label"] = Resources.YZMobile.Aspx_FormData_Date; field["html"] = YZStringHelper.DateToStringL(task.CreateAt); field = new JObject(); items.Add(field); field["xclass"] = "Ext.field.Field"; field["label"] = Resources.YZMobile.Aspx_FormData_Desc; field["html"] = task.Description; //应用移动表单设定字段 - 非可重复表 this.ApplyMasterFields(Model.Process, form, formitems, task, step, formSetting, formdataset); //应用移动表单设定字段 - 可重复表 this.ApplyDetailFields(Model.Process, form, formitems, task, step, formSetting, formdataset); //自定义信息 this.ApplyCustomFields(Model.Process, form, formitems, task, step, formdataset, comments); //控件测试 //this.AddTestingFields(Model.Process, form, formitems, task, step, formdataset, comments); return(result); }
public virtual JObject GetPostForm(HttpContext context) { YZRequest request = new YZRequest(context); string processName = request.GetString("processName"); Version processVersion = request.GetVersion("processVersion"); int restartTaskID = request.GetInt32("restartTaskID", -1); string uid = YZAuthHelper.LoginUserAccount; MobileFormSetting formSetting; FlowDataSet formdataset; CommentItemCollection comments = new CommentItemCollection(); User user = new User(); using (BPMConnection cn = new BPMConnection()) { cn.WebOpen(); user.Open(cn, uid); formSetting = BPMProcess.GetMobileFormSetting(cn, processName, processVersion); formdataset = BPMProcess.GetFormData(cn, processName, processVersion, null, restartTaskID); } this.ParseMobileFormSetting(formSetting); //准备返回值 JObject result = new JObject(); //填充form域(表单信息) JObject fieldset; JArray items; JObject form = new JObject(); result["form"] = form; JArray formitems = new JArray(); form["items"] = formitems; //基本信息的fieldset填充 fieldset = new JObject(); formitems.Add(fieldset); fieldset["xtype"] = "fieldset"; fieldset["hidden"] = true; fieldset["innerName"] = "Header"; //fieldset["title", "基本信息"); items = new JArray(); fieldset["items"] = items; //field = new JObject(); //items.Add(field); //field["xclass"] = "Ext.field.Field"; //field["label"] = "提交人"; //field["html"] = user.ShortName; //field = new JObject(); //items.Add(field); //field["xclass"] = "Ext.field.Field"; //field["label"] = Resources.YZMobile.Aspx_FormData_Date; //field["html"] = YZStringHelper.DateToStringM(DateTime.Today); //field = new JObject(); //items.Add(field); //field["xclass"] = "Ext.field.Field"; //field["label"] = "部门"; //field["html"] = "财务部"; //应用移动表单设定字段 - 非可重复表 this.ApplyMasterFields(Model.Post, form, formitems, null, null, formSetting, formdataset); //应用移动表单设定字段 - 可重复表 this.ApplyDetailFields(Model.Post, form, formitems, null, null, formSetting, formdataset); //自定义信息 this.ApplyCustomFields(Model.Post, form, formitems, null, null, formdataset, comments); //控件测试 //this.AddTestingFields(Model.Post, form, formitems, null, null, formdataset, comments); return(result); }
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); }