private ActionResult query(string title1)
        {
            string pager;
            string appid  = Request.QueryString["appid"];
            string tabid  = Request.QueryString["tabid"];
            string typeid = Request.QueryString["typeid"];

            BizProcess.Platform.Dictionary     bdict   = new BizProcess.Platform.Dictionary();
            BizProcess.Platform.ReportTemplate breport = new BizProcess.Platform.ReportTemplate();
            string typeidstring = typeid.IsGuid() ? breport.GetAllChildsIDString(typeid.ToGuid()) : "";
            string query        = string.Format("&appid={0}&tabid={1}&title1={2}&typeid={3}",
                                                Request.QueryString["appid"],
                                                Request.QueryString["tabid"],
                                                title1.UrlEncode(), typeid
                                                );
            string query1 = string.Format("{0}&pagesize={1}&pagenumber={2}", query, Request.QueryString["pagesize"], Request.QueryString["pagenumber"]);
            List <BizProcess.Data.Model.ReportTemplate> reportList = breport.GetPagerData(out pager, query, title1, typeidstring);

            ViewBag.Pager  = pager;
            ViewBag.AppID  = appid;
            ViewBag.TabID  = tabid;
            ViewBag.TypeID = typeid;
            ViewBag.Title1 = title1;
            ViewBag.Query1 = query1;
            return(View(reportList));
        }
        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 string GetAttribute()
        {
            string id = Request["id"];
            Guid   gid;

            if (!id.IsGuid(out gid))
            {
                return("");
            }

            var rt = new BizProcess.Platform.ReportTemplate().Get(gid);

            if (rt == null)
            {
                return("");
            }
            else
            {
                return(rt.Attribute);
            }
        }
        public RedirectToRouteResult Delete()
        {
            BizProcess.Platform.ReportTemplate bReportTemplate = new BizProcess.Platform.ReportTemplate();
            string deleteID = Request.Form["checkbox_report"];

            System.Text.StringBuilder delxml = new System.Text.StringBuilder();
            foreach (string id in deleteID.Split(','))
            {
                Guid gid;
                if (id.IsGuid(out gid))
                {
                    var report = bReportTemplate.Get(gid);
                    if (report != null)
                    {
                        delxml.Append(report.Serialize());
                        bReportTemplate.Delete(gid);
                    }
                }
            }
            BizProcess.Platform.Log.Add("删除了一批报表库", delxml.ToString(), BizProcess.Platform.Log.Types.角色应用);
            return(RedirectToAction("List", Common.Tools.GetRouteValueDictionary()));
        }
        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));
        }