public string Save() { string html = Request["html"]; string name = Request["name"]; string att = Request["att"]; string id = Request["id"]; string type = Request["type"]; if (name.IsNullOrEmpty()) { return("表单名称不能为空!"); } Guid reportID; if (!id.IsGuid(out reportID)) { return("表单ID无效!"); } BizProcess.Platform.ReportTemplate RT = new BizProcess.Platform.ReportTemplate(); BizProcess.Data.Model.ReportTemplate rt = RT.Get(reportID); bool isAdd = false; string oldXML = string.Empty; if (rt == null) { rt = new BizProcess.Data.Model.ReportTemplate(); rt.ID = reportID; rt.Type = type.ToGuid(); isAdd = true; } else { oldXML = rt.Serialize(); } rt.DesignJSON = att; rt.Html = html; rt.Title = name; if (isAdd) { RT.Add(rt); BizProcess.Platform.Log.Add("添加了流程表单", rt.Serialize(), BizProcess.Platform.Log.Types.流程相关); } else { RT.Update(rt); BizProcess.Platform.Log.Add("修改了流程表单", "", BizProcess.Platform.Log.Types.流程相关, oldXML, rt.Serialize()); } return("保存成功!"); }
public ActionResult Edit(FormCollection collection) { string editID = Request.QueryString["id"]; string type = Request.QueryString["typeid"]; BizProcess.Platform.ReportTemplate bReportTemplate = new BizProcess.Platform.ReportTemplate(); BizProcess.Data.Model.ReportTemplate reportTemplate = null; if (editID.IsGuid()) { reportTemplate = bReportTemplate.Get(editID.ToGuid()); } bool isAdd = !editID.IsGuid(); string oldXML = string.Empty; if (reportTemplate == null) { reportTemplate = new BizProcess.Data.Model.ReportTemplate(); reportTemplate.ID = Guid.NewGuid(); ViewBag.TypeOptions = new BizProcess.Platform.ReportTemplate().GetTypeOptions(type); } else { oldXML = reportTemplate.Serialize(); ViewBag.TypeOptions = new BizProcess.Platform.ReportTemplate().GetTypeOptions(reportTemplate.Type.ToString()); } if (collection != null) { string title = collection["title"]; string html = collection["Html"]; string designjson = collection["DesignJSON"]; string useMember = collection["UseMember"]; type = collection["type"]; reportTemplate.Html = html.Trim(); reportTemplate.DesignJSON = designjson.Trim(); reportTemplate.Title = title; reportTemplate.Type = type.ToGuid(); if (!useMember.IsNullOrEmpty()) { reportTemplate.UseMember = useMember; } else { reportTemplate.UseMember = null; } if (isAdd) { bReportTemplate.Add(reportTemplate); BizProcess.Platform.Log.Add("添加了报表库", reportTemplate.Serialize(), BizProcess.Platform.Log.Types.角色应用); ViewBag.Script = "alert('添加成功!');new BPUI.Window().reloadOpener();new BPUI.Window().close();"; } else { bReportTemplate.Update(reportTemplate); BizProcess.Platform.Log.Add("修改了报表库", "", BizProcess.Platform.Log.Types.角色应用, oldXML, reportTemplate.Serialize()); ViewBag.Script = "alert('修改成功!');new BPUI.Window().reloadOpener();new BPUI.Window().close();"; } bReportTemplate.UpdateUseMemberCache(reportTemplate.ID); bReportTemplate.ClearCache(); new BizProcess.Platform.RoleApp().ClearAllDataTableCache(); } return(View(reportTemplate)); }