public string GetFormByTaskGuid(Guid taskGuid) { RtTask task = db.RtTasks.First(o => o.TaskGuid == taskGuid); RtActivity activity = db.RtActivitys.First(o => o.ActivityGuid == task.ActivityGuid); RtForm form = db.RtForms.First(o => o.TaskPage == activity.TaskPage && o.MasterGuid == task.InstanceGuid); return(form.Html); }
/// <summary> /// 保存表单定义数据(流程定义或流程实例) /// </summary> /// <param name="masterID">InstanceGui的/RepoGuid</param> /// <param name="formID"></param> /// <param name="value">表单html内容</param> /// <returns></returns> public bool SaveFormData(bool isCase, Guid masterID, Guid formID, string value) { if (isCase) { RtForm form = null; if (formID == Guid.Empty) { form = new RtForm(); form.FormGuid = Guid.NewGuid(); form.MasterGuid = masterID; form.Html = value; form.Released = 0; form.CreateTime = DateTime.Now; db.RtForms.Add(form); } else { form = db.RtForms.First(o => o.FormGuid == formID); form.Html = value; form.Released = form.Released + 1; form.UpdateTime = DateTime.Now; } } else { WfForm form = null; if (formID == Guid.Empty) { form = new WfForm(); form.FormGuid = Guid.NewGuid(); form.MasterGuid = masterID; form.Html = value; form.Released = 0; form.CreateTime = DateTime.Now; db.WfForms.Add(form); } else { form = db.WfForms.First(o => o.FormGuid == formID); form.Html = value; form.Released = form.Released + 1; form.UpdateTime = DateTime.Now; } } db.SaveChanges(); return(true); }
public bool SaveFormData(Guid masterID, object content, Guid formID = new Guid()) { RtForm form = null; if (formID == null && masterID != null) { form = new RtForm(); form.FormGuid = Guid.NewGuid(); form.MasterGuid = masterID; form.Html = content.ToString(); form.CreateTime = DateTime.Now; AntApi.DB.RtForms.Add(form); } else { form = AntApi.DB.RtForms.First(o => o.FormGuid == formID); form.Html = content.ToString(); form.UpdateTime = DateTime.Now; } AntApi.DB.SaveChanges(); return(true); }
/// <summary> /// /// </summary> /// <param name="isCase">0.定义,1.实例</param> /// <param name="id">实例或定义的Guid</param> /// <param name="formID"></param> /// <returns></returns> public ActionResult Index(int isCase, string id, string formID = null) { if (!string.IsNullOrEmpty(formID)) { if (isCase == 1) { RtForm form = AntApi.Former.GetForm <RtForm>(isCase, new Guid(id), new Guid(formID)); ViewBag.Form = form; } else if (isCase == 0) { WfForm form = AntApi.Former.GetForm <WfForm>(isCase, new Guid(id), new Guid(formID)); ViewBag.Form = form; } } else { ViewBag.Form = null; } ViewBag.IsCase = isCase; ViewBag.MasterGuid = id; return(View()); }
/// <summary> /// 获取流程实例中的表单 /// </summary> /// <param name="ID">InstanceGuid</param> /// <returns></returns> public object GetForm(Guid ID) { RtForm form = AntApi.DB.RtForms.First(o => o.FormGuid == ID); return(form); }