Example #1
0
        protected void Button1_Click(object sender, EventArgs e)
        {
            string title     = Request.Form["title1"];
            string address   = Request.Form["address"];
            string openModel = Request.Form["openModel"];
            string width     = Request.Form["width"];
            string height    = Request.Form["height"];
            string params1   = Request.Form["Params"];
            string note      = Request.Form["note"];
            string useMember = Request.Form["UseMember"];
            string type      = Request.Form["type"];

            bool   isAdd  = false;
            string oldXML = string.Empty;

            if (appLibrary == null)
            {
                isAdd         = true;
                appLibrary    = new RoadFlow.Data.Model.AppLibrary();
                appLibrary.ID = Guid.NewGuid();
            }
            else
            {
                oldXML = appLibrary.Serialize();
            }
            appLibrary.Address  = address.Trim();
            appLibrary.Height   = height.ToIntOrNull();
            appLibrary.Note     = note;
            appLibrary.OpenMode = openModel.ToInt();
            appLibrary.Params   = params1;
            appLibrary.Title    = title;
            appLibrary.Type     = type.ToGuid();
            appLibrary.Width    = width.ToIntOrNull();

            if (!useMember.IsNullOrEmpty())
            {
                appLibrary.UseMember = useMember;
            }
            else
            {
                appLibrary.UseMember = null;
            }
            if (isAdd)
            {
                bappLibrary.Add(appLibrary);
                RoadFlow.Platform.Log.Add("添加了应用程序库", appLibrary.Serialize(), RoadFlow.Platform.Log.Types.角色应用);
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('添加成功!');new RoadUI.Window().reloadOpener();new RoadUI.Window().close();", true);
            }
            else
            {
                bappLibrary.Update(appLibrary);
                RoadFlow.Platform.Log.Add("修改了应用程序库", "", RoadFlow.Platform.Log.Types.角色应用, oldXML, appLibrary.Serialize());
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('修改成功!');new RoadUI.Window().reloadOpener();new RoadUI.Window().close();", true);
            }
            bappLibrary.UpdateUseMemberCache(appLibrary.ID);
            bappLibrary.ClearCache();
            new RoadFlow.Platform.RoleApp().ClearAllDataTableCache();
        }
Example #2
0
        public ActionResult Edit(FormCollection collection)
        {
            string editID = Request.QueryString["id"];
            string type   = Request.QueryString["typeid"];

            RoadFlow.Platform.AppLibrary   bappLibrary = new RoadFlow.Platform.AppLibrary();
            RoadFlow.Data.Model.AppLibrary appLibrary  = null;
            if (editID.IsGuid())
            {
                appLibrary = bappLibrary.Get(editID.ToGuid());
            }
            bool   isAdd  = !editID.IsGuid();
            string oldXML = string.Empty;

            if (appLibrary == null)
            {
                appLibrary          = new RoadFlow.Data.Model.AppLibrary();
                appLibrary.ID       = Guid.NewGuid();
                ViewBag.TypeOptions = new RoadFlow.Platform.AppLibrary().GetTypeOptions(type);
                ViewBag.OpenOptions = new RoadFlow.Platform.Dictionary().GetOptionsByCode("appopenmodel", value: "");
            }
            else
            {
                oldXML = appLibrary.Serialize();
                ViewBag.TypeOptions = new RoadFlow.Platform.AppLibrary().GetTypeOptions(appLibrary.Type.ToString());
                ViewBag.OpenOptions = new RoadFlow.Platform.Dictionary().GetOptionsByCode("appopenmodel", value: appLibrary.OpenMode.ToString());
            }

            if (collection != null)
            {
                string title     = collection["title"];
                string address   = collection["address"];
                string openModel = collection["openModel"];
                string width     = collection["width"];
                string height    = collection["height"];
                string params1   = collection["Params"];
                string note      = collection["note"];
                string useMember = collection["UseMember"];
                type = collection["type"];

                appLibrary.Address  = address.Trim();
                appLibrary.Height   = height.ToIntOrNull();
                appLibrary.Note     = note;
                appLibrary.OpenMode = openModel.ToInt();
                appLibrary.Params   = params1;
                appLibrary.Title    = title;
                appLibrary.Type     = type.ToGuid();
                appLibrary.Width    = width.ToIntOrNull();

                if (!useMember.IsNullOrEmpty())
                {
                    appLibrary.UseMember = useMember;
                }
                else
                {
                    appLibrary.UseMember = null;
                }

                if (isAdd)
                {
                    bappLibrary.Add(appLibrary);
                    RoadFlow.Platform.Log.Add("添加了应用程序库", appLibrary.Serialize(), RoadFlow.Platform.Log.Types.角色应用);
                    ViewBag.Script = "alert('添加成功!');new RoadUI.Window().reloadOpener();new RoadUI.Window().close();";
                }
                else
                {
                    bappLibrary.Update(appLibrary);
                    RoadFlow.Platform.Log.Add("修改了应用程序库", "", RoadFlow.Platform.Log.Types.角色应用, oldXML, appLibrary.Serialize());
                    ViewBag.Script = "alert('修改成功!');new RoadUI.Window().reloadOpener();new RoadUI.Window().close();";
                }
                bappLibrary.UpdateUseMemberCache(appLibrary.ID);
                bappLibrary.ClearCache();
                new RoadFlow.Platform.RoleApp().ClearAllDataTableCache();
            }
            return(View(appLibrary));
        }
        public string Publish()
        {
            string html = Request["html"];
            string name = Request["name"];
            string att  = Request["att"];
            string id   = Request["id"];

            Guid gid;

            if (!id.IsGuid(out gid) || name.IsNullOrEmpty() || att.IsNullOrEmpty() || html.IsNullOrEmpty())
            {
                return("参数错误!");
            }
            RoadFlow.Platform.WorkFlowForm WFF = new RoadFlow.Platform.WorkFlowForm();

            RoadFlow.Data.Model.WorkFlowForm wff = WFF.Get(gid);
            if (wff == null)
            {
                return("未找到表单!");
            }

            string fileName = id + ".cshtml";

            System.Text.StringBuilder serverScript = new System.Text.StringBuilder("@{\r\n");
            var attrJSON = LitJson.JsonMapper.ToObject(att);

            serverScript.Append("\tstring FlowID = Request.QueryString[\"flowid\"];\r\n");
            serverScript.Append("\tstring StepID = Request.QueryString[\"stepid\"];\r\n");
            serverScript.Append("\tstring GroupID = Request.QueryString[\"groupid\"];\r\n");
            serverScript.Append("\tstring TaskID = Request.QueryString[\"taskid\"];\r\n");
            serverScript.Append("\tstring InstanceID = Request.QueryString[\"instanceid\"];\r\n");
            serverScript.Append("\tstring DisplayModel = Request.QueryString[\"display\"] ?? \"0\";\r\n");
            serverScript.AppendFormat("\tstring DBConnID = \"{0}\";\r\n", attrJSON["dbconn"].ToString());
            serverScript.AppendFormat("\tstring DBTable = \"{0}\";\r\n", attrJSON["dbtable"].ToString());
            serverScript.AppendFormat("\tstring DBTablePK = \"{0}\";\r\n", attrJSON["dbtablepk"].ToString());
            serverScript.AppendFormat("\tstring DBTableTitle = \"{0}\";\r\n", attrJSON["dbtabletitle"].ToString());
            serverScript.Append("if(InstanceID.IsNullOrEmpty()){InstanceID = Request.QueryString[\"instanceid1\"];}");

            serverScript.Append("\tRoadFlow.Platform.Dictionary BDictionary = new RoadFlow.Platform.Dictionary();\r\n");
            serverScript.Append("\tRoadFlow.Platform.WorkFlow BWorkFlow = new RoadFlow.Platform.WorkFlow();\r\n");
            serverScript.Append("\tRoadFlow.Platform.WorkFlowTask BWorkFlowTask = new RoadFlow.Platform.WorkFlowTask();\r\n");
            serverScript.Append("\tstring fieldStatus = BWorkFlow.GetFieldStatus(FlowID, StepID);\r\n");
            serverScript.Append("\tLitJson.JsonData initData = BWorkFlow.GetFormData(DBConnID, DBTable, DBTablePK, InstanceID, fieldStatus);\r\n");
            serverScript.Append("\tstring TaskTitle = BWorkFlow.GetFromFieldData(initData, DBTable, DBTableTitle);\r\n");

            serverScript.Append("}\r\n");
            serverScript.Append("<link href=\"~/Scripts/FlowRun/Forms/flowform.css\" rel=\"stylesheet\" type=\"text/css\" />\r\n");
            serverScript.Append("<script src=\"~/Scripts/FlowRun/Forms/common.js\" type=\"text/javascript\" ></script>\r\n");

            if (attrJSON.ContainsKey("hasEditor") && "1" == attrJSON["hasEditor"].ToString())
            {
                serverScript.Append("<script src=\"~/Scripts/Ueditor/ueditor.config.js\" type=\"text/javascript\" ></script>\r\n");
                serverScript.Append("<script src=\"~/Scripts/Ueditor/ueditor.all.min.js\" type=\"text/javascript\" ></script>\r\n");
                serverScript.Append("<script src=\"~/Scripts/Ueditor/lang/zh-cn/zh-cn.js\" type=\"text/javascript\" ></script>\r\n");
                serverScript.Append("<input type=\"hidden\" id=\"Form_HasUEditor\" name=\"Form_HasUEditor\" value=\"1\" />\r\n");
            }
            string validatePropType = attrJSON.ContainsKey("validatealerttype") ? attrJSON["validatealerttype"].ToString() : "2";

            serverScript.Append("<input type=\"hidden\" id=\"Form_ValidateAlertType\" name=\"Form_ValidateAlertType\" value=\"" + validatePropType + "\" />\r\n");
            if (attrJSON.ContainsKey("autotitle") && attrJSON["autotitle"].ToString().ToLower() == "true")
            {
                serverScript.AppendFormat("<input type=\"hidden\" id=\"{0}\" name=\"{0}\" value=\"{1}\" />\r\n",
                                          string.Concat(attrJSON["dbtable"].ToString(), ".", attrJSON["dbtabletitle"].ToString()),
                                          "@(TaskTitle.IsNullOrEmpty() ? BWorkFlow.GetAutoTaskTitle(FlowID, StepID, Request.QueryString[\"groupid\"]) : TaskTitle)"
                                          );
            }
            serverScript.AppendFormat("<input type=\"hidden\" id=\"Form_TitleField\" name=\"Form_TitleField\" value=\"{0}\" />\r\n", string.Concat(attrJSON["dbtable"].ToString(), ".", attrJSON["dbtabletitle"].ToString()));
            //serverScript.AppendFormat("<input type=\"hidden\" id=\"Form_Name\" name=\"Form_Name\" value=\"{0}\" />\r\n", attrJSON["name"].ToString());
            serverScript.AppendFormat("<input type=\"hidden\" id=\"Form_DBConnID\" name=\"Form_DBConnID\" value=\"{0}\" />\r\n", attrJSON["dbconn"].ToString());
            serverScript.AppendFormat("<input type=\"hidden\" id=\"Form_DBTable\" name=\"Form_DBTable\" value=\"{0}\" />\r\n", attrJSON["dbtable"].ToString());
            serverScript.AppendFormat("<input type=\"hidden\" id=\"Form_DBTablePk\" name=\"Form_DBTablePk\" value=\"{0}\" />\r\n", attrJSON["dbtablepk"].ToString());
            serverScript.AppendFormat("<input type=\"hidden\" id=\"Form_DBTableTitle\" name=\"Form_DBTableTitle\" value=\"{0}\" />\r\n", attrJSON["dbtabletitle"].ToString());
            serverScript.AppendFormat("<input type=\"hidden\" id=\"Form_AutoSaveData\" name=\"Form_AutoSaveData\" value=\"{0}\" />\r\n", "1");
            serverScript.Append("<script type=\"text/javascript\">\r\n");
            serverScript.Append("\tvar initData = @Html.Raw(BWorkFlow.GetFormDataJsonString(initData));\r\n");
            serverScript.Append("\tvar fieldStatus = \"1\"==\"@Request.QueryString[\"isreadonly\"]\" ? {} : @Html.Raw(fieldStatus);\r\n");
            serverScript.Append("\tvar displayModel = '@DisplayModel';\r\n");
            serverScript.Append("\t$(window).load(function (){\r\n");
            serverScript.AppendFormat("\t\tformrun.initData(initData, \"{0}\", fieldStatus, displayModel);\r\n", attrJSON["dbtable"].ToString());
            serverScript.Append("\t});\r\n");
            serverScript.Append("</script>\r\n");


            string file = Server.MapPath("~/Views/WorkFlowFormDesigner/Forms/" + fileName);

            System.IO.Stream stream = System.IO.File.Open(file, FileMode.OpenOrCreate, FileAccess.Write, FileShare.None);
            stream.SetLength(0);

            StreamWriter sw = new StreamWriter(stream, System.Text.Encoding.UTF8);

            sw.Write(serverScript.ToString());
            sw.Write(Server.HtmlDecode(html));

            sw.Close();
            stream.Close();


            string attr    = wff.Attribute;
            string appType = LitJson.JsonMapper.ToObject(attr)["apptype"].ToString();

            RoadFlow.Platform.AppLibrary App = new RoadFlow.Platform.AppLibrary();
            var  app   = App.GetByCode(id);
            bool isAdd = false;

            if (app == null)
            {
                app      = new RoadFlow.Data.Model.AppLibrary();
                app.ID   = Guid.NewGuid();
                app.Code = id;
                isAdd    = true;
            }
            app.Address  = "/Views/WorkFlowFormDesigner/Forms/" + fileName;
            app.Note     = "流程表单";
            app.OpenMode = 0;
            app.Params   = "";
            app.Title    = name.Trim();
            app.Type     = appType.IsGuid() ? appType.ToGuid() : new RoadFlow.Platform.Dictionary().GetIDByCode("FormTypes");
            if (isAdd)
            {
                App.Add(app);
            }
            else
            {
                App.Update(app);
            }

            RoadFlow.Platform.Log.Add("发布了流程表单", app.Serialize() + "内容:" + html, RoadFlow.Platform.Log.Types.流程相关);
            wff.Status = 1;
            WFF.Update(wff);
            return("发布成功!");
        }
Example #4
0
        public ActionResult Edit(FormCollection collection)
        {
            string str1 = this.Request.QueryString["id"];
            string str2 = this.Request.QueryString["typeid"];

            RoadFlow.Platform.AppLibrary   appLibrary = new RoadFlow.Platform.AppLibrary();
            RoadFlow.Data.Model.AppLibrary model1     = (RoadFlow.Data.Model.AppLibrary)null;
            if (str1.IsGuid())
            {
                model1 = appLibrary.Get(str1.ToGuid(), false);
            }
            bool   flag1  = !str1.IsGuid();
            string oldXML = string.Empty;
            int    index1;

            if (model1 == null)
            {
                model1    = new RoadFlow.Data.Model.AppLibrary();
                model1.ID = Guid.NewGuid();
                // ISSUE: reference to a compiler-generated field
                if (AppLibraryController.\u003C\u003Eo__5.\u003C\u003Ep__0 == null)
                {
                    // ISSUE: reference to a compiler-generated field
                    AppLibraryController.\u003C\u003Eo__5.\u003C\u003Ep__0 = CallSite <Func <CallSite, object, string, object> > .Create(Binder.SetMember(CSharpBinderFlags.None, "TypeOptions", typeof(AppLibraryController), (IEnumerable <CSharpArgumentInfo>) new CSharpArgumentInfo[2]
                    {
                        CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, (string)null),
                        CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, (string)null)
                    }));
                }
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                object obj1 = AppLibraryController.\u003C\u003Eo__5.\u003C\u003Ep__0.Target((CallSite)AppLibraryController.\u003C\u003Eo__5.\u003C\u003Ep__0, this.ViewBag, new RoadFlow.Platform.AppLibrary().GetTypeOptions(str2));
                // ISSUE: reference to a compiler-generated field
                if (AppLibraryController.\u003C\u003Eo__5.\u003C\u003Ep__1 == null)
                {
                    // ISSUE: reference to a compiler-generated field
                    AppLibraryController.\u003C\u003Eo__5.\u003C\u003Ep__1 = CallSite <Func <CallSite, object, string, object> > .Create(Binder.SetMember(CSharpBinderFlags.None, "OpenOptions", typeof(AppLibraryController), (IEnumerable <CSharpArgumentInfo>) new CSharpArgumentInfo[2]
                    {
                        CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, (string)null),
                        CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, (string)null)
                    }));
                }
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                object obj2 = AppLibraryController.\u003C\u003Eo__5.\u003C\u003Ep__1.Target((CallSite)AppLibraryController.\u003C\u003Eo__5.\u003C\u003Ep__1, this.ViewBag, new RoadFlow.Platform.Dictionary().GetOptionsByCode("appopenmodel", RoadFlow.Platform.Dictionary.OptionValueField.Value, "", "", true));
            }
            else
            {
                oldXML = model1.Serialize();
                // ISSUE: reference to a compiler-generated field
                if (AppLibraryController.\u003C\u003Eo__5.\u003C\u003Ep__2 == null)
                {
                    // ISSUE: reference to a compiler-generated field
                    AppLibraryController.\u003C\u003Eo__5.\u003C\u003Ep__2 = CallSite <Func <CallSite, object, string, object> > .Create(Binder.SetMember(CSharpBinderFlags.None, "TypeOptions", typeof(AppLibraryController), (IEnumerable <CSharpArgumentInfo>) new CSharpArgumentInfo[2]
                    {
                        CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, (string)null),
                        CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, (string)null)
                    }));
                }
                // ISSUE: reference to a compiler-generated field
                // ISSUE: reference to a compiler-generated field
                object obj1 = AppLibraryController.\u003C\u003Eo__5.\u003C\u003Ep__2.Target((CallSite)AppLibraryController.\u003C\u003Eo__5.\u003C\u003Ep__2, this.ViewBag, new RoadFlow.Platform.AppLibrary().GetTypeOptions(model1.Type.ToString()));
                // ISSUE: reference to a compiler-generated field
                if (AppLibraryController.\u003C\u003Eo__5.\u003C\u003Ep__3 == null)
                {
                    // ISSUE: reference to a compiler-generated field
                    AppLibraryController.\u003C\u003Eo__5.\u003C\u003Ep__3 = CallSite <Func <CallSite, object, string, object> > .Create(Binder.SetMember(CSharpBinderFlags.None, "OpenOptions", typeof(AppLibraryController), (IEnumerable <CSharpArgumentInfo>) new CSharpArgumentInfo[2]
                    {
                        CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, (string)null),
                        CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, (string)null)
                    }));
                }
                // ISSUE: reference to a compiler-generated field
                Func <CallSite, object, string, object> target = AppLibraryController.\u003C\u003Eo__5.\u003C\u003Ep__3.Target;
                // ISSUE: reference to a compiler-generated field
                CallSite <Func <CallSite, object, string, object> > p3 = AppLibraryController.\u003C\u003Eo__5.\u003C\u003Ep__3;
                object viewBag = this.ViewBag;
                RoadFlow.Platform.Dictionary dictionary = new RoadFlow.Platform.Dictionary();
                string code = "appopenmodel";
                int    num1 = 3;
                index1 = model1.OpenMode;
                string str3          = index1.ToString();
                string attr          = "";
                int    num2          = 1;
                string optionsByCode = dictionary.GetOptionsByCode(code, (RoadFlow.Platform.Dictionary.OptionValueField)num1, str3, attr, num2 != 0);
                object obj2          = target((CallSite)p3, viewBag, optionsByCode);
            }
            if (collection != null)
            {
                string str3  = collection["title"];
                string str4  = collection["address"];
                string str5  = collection["openModel"];
                string str6  = collection["width"];
                string str7  = collection["height"];
                string str8  = collection["Params"];
                string str9  = collection["Note"];
                string str10 = collection["Ico"];
                string str11 = collection["IcoColor"];
                string str12 = collection["type"];
                model1.Address  = str4.Trim();
                model1.Height   = str7.ToIntOrNull();
                model1.Note     = str9;
                model1.OpenMode = str5.ToInt();
                model1.Params   = str8;
                model1.Title    = str3;
                model1.Type     = str12.ToGuid();
                model1.Width    = str6.ToIntOrNull();
                model1.Ico      = str10.IsNullOrEmpty() ? (string)null : str10;
                model1.Color    = str11.IsNullOrEmpty() ? (string)null : str11.Trim();
                string str13 = this.Request.QueryString["pagesize"];
                string str14 = this.Request.QueryString["pagenumber"];
                using (TransactionScope transactionScope = new TransactionScope())
                {
                    if (flag1)
                    {
                        appLibrary.Add(model1);
                        RoadFlow.Platform.Log.Add("添加了应用程序库", model1.Serialize(), RoadFlow.Platform.Log.Types.菜单权限, "", "", (RoadFlow.Data.Model.Users)null);
                        // ISSUE: reference to a compiler-generated field
                        if (AppLibraryController.\u003C\u003Eo__5.\u003C\u003Ep__4 == null)
                        {
                            // ISSUE: reference to a compiler-generated field
                            AppLibraryController.\u003C\u003Eo__5.\u003C\u003Ep__4 = CallSite <Func <CallSite, object, string, object> > .Create(Binder.SetMember(CSharpBinderFlags.None, "Script", typeof(AppLibraryController), (IEnumerable <CSharpArgumentInfo>) new CSharpArgumentInfo[2]
                            {
                                CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, (string)null),
                                CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, (string)null)
                            }));
                        }
                        // ISSUE: reference to a compiler-generated field
                        // ISSUE: reference to a compiler-generated field
                        object obj = AppLibraryController.\u003C\u003Eo__5.\u003C\u003Ep__4.Target((CallSite)AppLibraryController.\u003C\u003Eo__5.\u003C\u003Ep__4, this.ViewBag, "alert('添加成功!');new RoadUI.Window().reloadOpener(undefined,undefined,\"query('" + str13 + "','" + str14 + "')\");new RoadUI.Window().close();");
                    }
                    else
                    {
                        appLibrary.Update(model1);
                        RoadFlow.Platform.Log.Add("修改了应用程序库", "", RoadFlow.Platform.Log.Types.菜单权限, oldXML, model1.Serialize(), (RoadFlow.Data.Model.Users)null);
                        // ISSUE: reference to a compiler-generated field
                        if (AppLibraryController.\u003C\u003Eo__5.\u003C\u003Ep__5 == null)
                        {
                            // ISSUE: reference to a compiler-generated field
                            AppLibraryController.\u003C\u003Eo__5.\u003C\u003Ep__5 = CallSite <Func <CallSite, object, string, object> > .Create(Binder.SetMember(CSharpBinderFlags.None, "Script", typeof(AppLibraryController), (IEnumerable <CSharpArgumentInfo>) new CSharpArgumentInfo[2]
                            {
                                CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.None, (string)null),
                                CSharpArgumentInfo.Create(CSharpArgumentInfoFlags.UseCompileTimeType, (string)null)
                            }));
                        }
                        // ISSUE: reference to a compiler-generated field
                        // ISSUE: reference to a compiler-generated field
                        object obj = AppLibraryController.\u003C\u003Eo__5.\u003C\u003Ep__5.Target((CallSite)AppLibraryController.\u003C\u003Eo__5.\u003C\u003Ep__5, this.ViewBag, "alert('修改成功!');new RoadUI.Window().reloadOpener(undefined,undefined,\"query('" + str13 + "','" + str14 + "')\");new RoadUI.Window().close();");
                    }
                    RoadFlow.Platform.AppLibraryButtons1 appLibraryButtons1_1 = new RoadFlow.Platform.AppLibraryButtons1();
                    string str15 = this.Request.Form["buttonindex"] ?? "";
                    List <RoadFlow.Data.Model.AppLibraryButtons1> allByAppId             = appLibraryButtons1_1.GetAllByAppID(model1.ID);
                    List <RoadFlow.Data.Model.AppLibraryButtons1> appLibraryButtons1List = new List <RoadFlow.Data.Model.AppLibraryButtons1>();
                    char[] chArray = new char[1] {
                        ','
                    };
                    string[] strArray = str15.Split(chArray);
                    for (index1 = 0; index1 < strArray.Length; ++index1)
                    {
                        string index = strArray[index1];
                        string str16 = this.Request.Form["button_" + index];
                        string str17 = this.Request.Form["buttonname_" + index];
                        string str18 = this.Request.Form["buttonevents_" + index];
                        string str19 = this.Request.Form["buttonico_" + index];
                        string str20 = this.Request.Form["showtype_" + index];
                        string str21 = this.Request.Form["buttonsort_" + index];
                        if (!str17.IsNullOrEmpty() && !str18.IsNullOrEmpty())
                        {
                            RoadFlow.Data.Model.AppLibraryButtons1 model2 = allByAppId.Find((Predicate <RoadFlow.Data.Model.AppLibraryButtons1>)(p => p.ID == index.ToGuid()));
                            bool flag2 = false;
                            if (model2 == null)
                            {
                                flag2     = true;
                                model2    = new RoadFlow.Data.Model.AppLibraryButtons1();
                                model2.ID = Guid.NewGuid();
                            }
                            else
                            {
                                appLibraryButtons1List.Add(model2);
                            }
                            model2.AppLibraryID = model1.ID;
                            if (str16.IsGuid())
                            {
                                model2.ButtonID = new Guid?(str16.ToGuid());
                            }
                            model2.Events   = str18;
                            model2.Ico      = str19;
                            model2.Name     = str17.Trim1();
                            model2.Sort     = str21.ToInt(0);
                            model2.ShowType = str20.ToInt(0);
                            model2.Type     = 0;
                            if (flag2)
                            {
                                appLibraryButtons1_1.Add(model2);
                            }
                            else
                            {
                                appLibraryButtons1_1.Update(model2);
                            }
                        }
                    }
                    foreach (RoadFlow.Data.Model.AppLibraryButtons1 appLibraryButtons1_2 in allByAppId)
                    {
                        RoadFlow.Data.Model.AppLibraryButtons1 sub = appLibraryButtons1_2;
                        if (appLibraryButtons1List.Find((Predicate <RoadFlow.Data.Model.AppLibraryButtons1>)(p => p.ID == sub.ID)) == null)
                        {
                            appLibraryButtons1_1.Delete(sub.ID);
                        }
                    }
                    transactionScope.Complete();
                    appLibraryButtons1_1.ClearCache();
                }
                new RoadFlow.Platform.Menu().ClearAllDataTableCache();
                new RoadFlow.Platform.WorkFlow().ClearStartFlowsCache();
                appLibrary.ClearCache();
            }
            return((ActionResult)this.View((object)model1));
        }
        public ActionResult Edit(FormCollection collection)
        {
            string text  = base.Request.QueryString["id"];
            string value = base.Request.QueryString["typeid"];

            RoadFlow.Platform.AppLibrary   appLibrary  = new RoadFlow.Platform.AppLibrary();
            RoadFlow.Data.Model.AppLibrary appLibrary2 = null;
            if (MyExtensions.IsGuid(text))
            {
                appLibrary2 = appLibrary.Get(MyExtensions.ToGuid(text));
            }
            bool   flag   = !MyExtensions.IsGuid(text);
            string oldXML = string.Empty;

            if (appLibrary2 == null)
            {
                appLibrary2              = new RoadFlow.Data.Model.AppLibrary();
                appLibrary2.ID           = Guid.NewGuid();
                base.ViewBag.TypeOptions = new RoadFlow.Platform.AppLibrary().GetTypeOptions(value);
                base.ViewBag.OpenOptions = new RoadFlow.Platform.Dictionary().GetOptionsByCode("appopenmodel");
            }
            else
            {
                oldXML = MyExtensions.Serialize((object)appLibrary2);
                base.ViewBag.TypeOptions = new RoadFlow.Platform.AppLibrary().GetTypeOptions(appLibrary2.Type.ToString());
                base.ViewBag.OpenOptions = new RoadFlow.Platform.Dictionary().GetOptionsByCode("appopenmodel", RoadFlow.Platform.Dictionary.OptionValueField.Value, appLibrary2.OpenMode.ToString());
            }
            if (collection != null)
            {
                string title   = collection["title"];
                string text2   = collection["address"];
                string text3   = collection["openModel"];
                string text4   = collection["width"];
                string text5   = collection["height"];
                string @params = collection["Params"];
                string note    = collection["Note"];
                string text6   = collection["Ico"];
                string text7   = collection["IcoColor"];
                value = collection["type"];
                appLibrary2.Address  = text2.Trim();
                appLibrary2.Height   = MyExtensions.ToIntOrNull(text5);
                appLibrary2.Note     = note;
                appLibrary2.OpenMode = MyExtensions.ToInt(text3);
                appLibrary2.Params   = @params;
                appLibrary2.Title    = title;
                appLibrary2.Type     = MyExtensions.ToGuid(value);
                appLibrary2.Width    = MyExtensions.ToIntOrNull(text4);
                if (!MyExtensions.IsNullOrEmpty(text6))
                {
                    appLibrary2.Ico = text6;
                }
                else
                {
                    appLibrary2.Ico = null;
                }
                if (!MyExtensions.IsNullOrEmpty(text7))
                {
                    appLibrary2.Color = text7.Trim();
                }
                else
                {
                    appLibrary2.Color = null;
                }
                string text8 = base.Request.QueryString["pagesize"];
                string text9 = base.Request.QueryString["pagenumber"];
                using (TransactionScope transactionScope = new TransactionScope())
                {
                    if (flag)
                    {
                        appLibrary.Add(appLibrary2);
                        RoadFlow.Platform.Log.Add("添加了应用程序库", MyExtensions.Serialize((object)appLibrary2), RoadFlow.Platform.Log.Types.菜单权限);
                        base.ViewBag.Script = "alert('添加成功!');new RoadUI.Window().reloadOpener(undefined,undefined,\"query('" + text8 + "','" + text9 + "')\");new RoadUI.Window().close();";
                    }
                    else
                    {
                        appLibrary.Update(appLibrary2);
                        RoadFlow.Platform.Log.Add("修改了应用程序库", "", RoadFlow.Platform.Log.Types.菜单权限, oldXML, MyExtensions.Serialize((object)appLibrary2));
                        base.ViewBag.Script = "alert('修改成功!');new RoadUI.Window().reloadOpener(undefined,undefined,\"query('" + text8 + "','" + text9 + "')\");new RoadUI.Window().close();";
                    }
                    RoadFlow.Platform.AppLibraryButtons1 appLibraryButtons = new RoadFlow.Platform.AppLibraryButtons1();
                    string obj = base.Request.Form["buttonindex"] ?? "";
                    List <RoadFlow.Data.Model.AppLibraryButtons1> allByAppID = appLibraryButtons.GetAllByAppID(appLibrary2.ID);
                    List <RoadFlow.Data.Model.AppLibraryButtons1> list       = new List <RoadFlow.Data.Model.AppLibraryButtons1>();
                    string[] array = obj.Split(',');
                    foreach (string index in array)
                    {
                        string text10 = base.Request.Form["button_" + index];
                        string text11 = base.Request.Form["buttonname_" + index];
                        string text12 = base.Request.Form["buttonevents_" + index];
                        string ico    = base.Request.Form["buttonico_" + index];
                        string text13 = base.Request.Form["showtype_" + index];
                        string text14 = base.Request.Form["buttonsort_" + index];
                        if (!MyExtensions.IsNullOrEmpty(text11) && !MyExtensions.IsNullOrEmpty(text12))
                        {
                            RoadFlow.Data.Model.AppLibraryButtons1 appLibraryButtons2 = allByAppID.Find((RoadFlow.Data.Model.AppLibraryButtons1 p) => p.ID == MyExtensions.ToGuid(index));
                            bool flag2 = false;
                            if (appLibraryButtons2 == null)
                            {
                                flag2 = true;
                                appLibraryButtons2    = new RoadFlow.Data.Model.AppLibraryButtons1();
                                appLibraryButtons2.ID = Guid.NewGuid();
                            }
                            else
                            {
                                list.Add(appLibraryButtons2);
                            }
                            appLibraryButtons2.AppLibraryID = appLibrary2.ID;
                            if (MyExtensions.IsGuid(text10))
                            {
                                appLibraryButtons2.ButtonID = MyExtensions.ToGuid(text10);
                            }
                            appLibraryButtons2.Events   = text12;
                            appLibraryButtons2.Ico      = ico;
                            appLibraryButtons2.Name     = MyExtensions.Trim1(text11);
                            appLibraryButtons2.Sort     = MyExtensions.ToInt(text14, 0);
                            appLibraryButtons2.ShowType = MyExtensions.ToInt(text13, 0);
                            appLibraryButtons2.Type     = 0;
                            if (flag2)
                            {
                                appLibraryButtons.Add(appLibraryButtons2);
                            }
                            else
                            {
                                appLibraryButtons.Update(appLibraryButtons2);
                            }
                        }
                    }
                    foreach (RoadFlow.Data.Model.AppLibraryButtons1 item in allByAppID)
                    {
                        if (list.Find((RoadFlow.Data.Model.AppLibraryButtons1 p) => p.ID == item.ID) == null)
                        {
                            appLibraryButtons.Delete(item.ID);
                        }
                    }
                    transactionScope.Complete();
                    appLibraryButtons.ClearCache();
                }
                new RoadFlow.Platform.Menu().ClearAllDataTableCache();
                new RoadFlow.Platform.WorkFlow().ClearStartFlowsCache();
                appLibrary.ClearCache();
            }
            return(View(appLibrary2));
        }
        public string Publish()
        {
            string s    = this.Request["html"];
            string str1 = this.Request["name"];
            string str2 = this.Request["att"];
            string str3 = this.Request["id"];
            string str4 = this.Request["formats"];
            Guid   test;

            if (!str3.IsGuid(out test) || str1.IsNullOrEmpty() || str2.IsNullOrEmpty())
            {
                return("参数错误!");
            }
            RoadFlow.Platform.WorkFlowForm   workFlowForm = new RoadFlow.Platform.WorkFlowForm();
            RoadFlow.Data.Model.WorkFlowForm model1       = workFlowForm.Get(test);
            if (model1 == null)
            {
                return("请先保存表单再发布!");
            }
            string        str5          = str3 + ".cshtml";
            StringBuilder stringBuilder = new StringBuilder("@{\r\n");
            JsonData      jsonData      = JsonMapper.ToObject(str2);

            stringBuilder.Append("\tstring FlowID = Request.QueryString[\"flowid\"];\r\n");
            stringBuilder.Append("\tstring StepID = Request.QueryString[\"stepid\"];\r\n");
            stringBuilder.Append("\tstring GroupID = Request.QueryString[\"groupid\"];\r\n");
            stringBuilder.Append("\tstring TaskID = Request.QueryString[\"taskid\"];\r\n");
            stringBuilder.Append("\tstring InstanceID = Request.QueryString[\"instanceid\"];\r\n");
            stringBuilder.Append("\tstring DisplayModel = Request.QueryString[\"display\"] ?? \"0\";\r\n");
            stringBuilder.AppendFormat("\tstring DBConnID = \"{0}\";\r\n", (object)jsonData["dbconn"].ToString());
            stringBuilder.AppendFormat("\tstring DBTable = \"{0}\";\r\n", (object)jsonData["dbtable"].ToString());
            stringBuilder.AppendFormat("\tstring DBTablePK = \"{0}\";\r\n", (object)jsonData["dbtablepk"].ToString());
            stringBuilder.AppendFormat("\tstring DBTableTitle = \"{0}\";\r\n", (object)jsonData["dbtabletitle"].ToString());
            stringBuilder.Append("\tif(InstanceID.IsNullOrEmpty()){InstanceID = Request.QueryString[\"instanceid1\"];}\r\n");
            stringBuilder.Append("\tRoadFlow.Platform.Dictionary BDictionary = new RoadFlow.Platform.Dictionary();\r\n");
            stringBuilder.Append("\tRoadFlow.Platform.WorkFlow BWorkFlow = new RoadFlow.Platform.WorkFlow();\r\n");
            stringBuilder.Append("\tRoadFlow.Platform.WorkFlowTask BWorkFlowTask = new RoadFlow.Platform.WorkFlowTask();\r\n");
            stringBuilder.Append("\tstring fieldStatus = BWorkFlow.GetFieldStatus(FlowID, StepID);\r\n");
            stringBuilder.Append("\tLitJson.JsonData initData = BWorkFlow.GetFormData(DBConnID, DBTable, DBTablePK, InstanceID, fieldStatus, \"" + str4 + "\");\r\n");
            stringBuilder.Append("\tstring TaskTitle = BWorkFlow.GetFromFieldData(initData, DBTable, DBTableTitle);\r\n");
            stringBuilder.Append("}\r\n");
            stringBuilder.Append("<link href=\"~/Scripts/FlowRun/Forms/flowform.css\" rel=\"stylesheet\" type=\"text/css\" />\r\n");
            stringBuilder.Append("<script src=\"~/Scripts/FlowRun/Forms/common.js\" type=\"text/javascript\" ></script>\r\n");
            if (jsonData.ContainsKey("hasEditor") && "1" == jsonData["hasEditor"].ToString())
            {
                stringBuilder.Append("<script src=\"~/Scripts/Ueditor/ueditor.config.js\" type=\"text/javascript\" ></script>\r\n");
                stringBuilder.Append("<script src=\"~/Scripts/Ueditor/ueditor.all.min.js\" type=\"text/javascript\" ></script>\r\n");
                stringBuilder.Append("<script src=\"~/Scripts/Ueditor/lang/zh-cn/zh-cn.js\" type=\"text/javascript\" ></script>\r\n");
                stringBuilder.Append("<input type=\"hidden\" id=\"Form_HasUEditor\" name=\"Form_HasUEditor\" value=\"1\" />\r\n");
            }
            string str6 = jsonData.ContainsKey("validatealerttype") ? jsonData["validatealerttype"].ToString() : "2";

            stringBuilder.Append("<input type=\"hidden\" id=\"Form_ValidateAlertType\" name=\"Form_ValidateAlertType\" value=\"" + str6 + "\" />\r\n");
            if (jsonData.ContainsKey("autotitle") && jsonData["autotitle"].ToString().ToLower() == "true")
            {
                stringBuilder.AppendFormat("<input type=\"hidden\" id=\"{0}\" name=\"{0}\" value=\"{1}\" />\r\n", (object)(jsonData["dbtable"].ToString() + "." + jsonData["dbtabletitle"].ToString()), (object)"@(TaskTitle.IsNullOrEmpty() ? BWorkFlow.GetAutoTaskTitle(FlowID, StepID, Request.QueryString[\"groupid\"]) : TaskTitle)");
            }
            stringBuilder.AppendFormat("<input type=\"hidden\" id=\"Form_TitleField\" name=\"Form_TitleField\" value=\"{0}\" />\r\n", (object)(jsonData["dbtable"].ToString() + "." + jsonData["dbtabletitle"].ToString()));
            stringBuilder.AppendFormat("<input type=\"hidden\" id=\"Form_DBConnID\" name=\"Form_DBConnID\" value=\"{0}\" />\r\n", (object)jsonData["dbconn"].ToString());
            stringBuilder.AppendFormat("<input type=\"hidden\" id=\"Form_DBTable\" name=\"Form_DBTable\" value=\"{0}\" />\r\n", (object)jsonData["dbtable"].ToString());
            stringBuilder.AppendFormat("<input type=\"hidden\" id=\"Form_DBTablePk\" name=\"Form_DBTablePk\" value=\"{0}\" />\r\n", (object)jsonData["dbtablepk"].ToString());
            stringBuilder.AppendFormat("<input type=\"hidden\" id=\"Form_DBTableTitle\" name=\"Form_DBTableTitle\" value=\"{0}\" />\r\n", (object)jsonData["dbtabletitle"].ToString());
            stringBuilder.AppendFormat("<input type=\"hidden\" id=\"Form_AutoSaveData\" name=\"Form_AutoSaveData\" value=\"{0}\" />\r\n", (object)"1");
            stringBuilder.AppendFormat("<textarea id=\"Form_DBTableTitleExpression\" name=\"Form_DBTableTitleExpression\" style=\"display:none;width:0;height:0;\">{0}</textarea>\r\n", jsonData.ContainsKey("dbtabletitle1") ? (object)jsonData["dbtabletitle1"].ToString() : (object)"");
            stringBuilder.Append("<script type=\"text/javascript\">\r\n");
            stringBuilder.Append("\tvar initData = @Html.Raw(BWorkFlow.GetFormDataJsonString(initData));\r\n");
            stringBuilder.Append("\tvar fieldStatus = \"1\"==\"@Request.QueryString[\"isreadonly\"]\" ? {} : @Html.Raw(fieldStatus);\r\n");
            stringBuilder.Append("\tvar displayModel = '@DisplayModel';\r\n");
            stringBuilder.Append("\t$(window).load(function (){\r\n");
            stringBuilder.AppendFormat("\t\tformrun.initData(initData, \"{0}\", fieldStatus, displayModel);\r\n", (object)jsonData["dbtable"].ToString());
            stringBuilder.Append("\t});\r\n");
            stringBuilder.Append("</script>\r\n");
            FileStream fileStream = File.Open(this.Server.MapPath("~/Views/WorkFlowFormDesigner/Forms/" + str5), FileMode.OpenOrCreate, FileAccess.Write, FileShare.None);

            fileStream.SetLength(0L);
            StreamWriter streamWriter = new StreamWriter((Stream)fileStream, Encoding.UTF8);

            streamWriter.Write(stringBuilder.ToString());
            streamWriter.Write(this.Server.HtmlDecode(s));
            streamWriter.Close();
            fileStream.Close();
            string str7 = JsonMapper.ToObject(model1.Attribute)["apptype"].ToString();

            RoadFlow.Platform.AppLibrary   appLibrary = new RoadFlow.Platform.AppLibrary();
            RoadFlow.Data.Model.AppLibrary model2     = appLibrary.GetByCode(str3, true);
            bool flag = false;

            if (model2 == null)
            {
                model2      = new RoadFlow.Data.Model.AppLibrary();
                model2.ID   = Guid.NewGuid();
                model2.Code = str3;
                flag        = true;
            }
            model2.Address  = "/Views/WorkFlowFormDesigner/Forms/" + str5;
            model2.Note     = "流程表单";
            model2.OpenMode = 0;
            model2.Params   = "";
            model2.Title    = str1.Trim();
            model2.Type     = str7.IsGuid() ? str7.ToGuid() : new RoadFlow.Platform.Dictionary().GetIDByCode("FormTypes");
            if (flag)
            {
                appLibrary.Add(model2);
            }
            else
            {
                appLibrary.Update(model2);
            }
            RoadFlow.Platform.Log.Add("发布了流程表单", model2.Serialize() + "内容:" + s, RoadFlow.Platform.Log.Types.流程相关, "", "", (RoadFlow.Data.Model.Users)null);
            model1.Status = 1;
            workFlowForm.Update(model1);
            return("发布成功!");
        }