public ActionResult Edit(FormCollection collection) { string str = 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 (str.IsGuid()) { appLibrary2 = appLibrary.Get(str.ToGuid()); } bool flag = !str.IsGuid(); 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 = appLibrary2.Serialize(); 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 text = collection["address"]; string str2 = collection["openModel"]; string str3 = collection["width"]; string str4 = collection["height"]; string @params = collection["Params"]; string note = collection["Note"]; string text2 = collection["Ico"]; string text3 = collection["IcoColor"]; value = collection["type"]; appLibrary2.Address = text.Trim(); appLibrary2.Height = str4.ToIntOrNull(); appLibrary2.Note = note; appLibrary2.OpenMode = str2.ToInt(); appLibrary2.Params = @params; appLibrary2.Title = title; appLibrary2.Type = value.ToGuid(); appLibrary2.Width = str3.ToIntOrNull(); if (!text2.IsNullOrEmpty()) { appLibrary2.Ico = text2; } else { appLibrary2.Ico = null; } if (!text3.IsNullOrEmpty()) { appLibrary2.Color = text3.Trim(); } else { appLibrary2.Color = null; } string text4 = base.Request.QueryString["pagesize"]; string text5 = base.Request.QueryString["pagenumber"]; using (TransactionScope transactionScope = new TransactionScope()) { if (flag) { appLibrary.Add(appLibrary2); RoadFlow.Platform.Log.Add("添加了应用程序库", appLibrary2.Serialize(), RoadFlow.Platform.Log.Types.菜单权限); base.ViewBag.Script = "alert('添加成功!');new RoadUI.Window().reloadOpener(undefined,undefined,\"query('" + text4 + "','" + text5 + "')\");new RoadUI.Window().close();"; } else { appLibrary.Update(appLibrary2); RoadFlow.Platform.Log.Add("修改了应用程序库", "", RoadFlow.Platform.Log.Types.菜单权限, oldXML, appLibrary2.Serialize()); base.ViewBag.Script = "alert('修改成功!');new RoadUI.Window().reloadOpener(undefined,undefined,\"query('" + text4 + "','" + text5 + "')\");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 str5 = base.Request.Form["button_" + index]; string str6 = base.Request.Form["buttonname_" + index]; string text6 = base.Request.Form["buttonevents_" + index]; string ico = base.Request.Form["buttonico_" + index]; string str7 = base.Request.Form["showtype_" + index]; string str8 = base.Request.Form["buttonsort_" + index]; if (!str6.IsNullOrEmpty() && !text6.IsNullOrEmpty()) { RoadFlow.Data.Model.AppLibraryButtons1 appLibraryButtons2 = allByAppID.Find((RoadFlow.Data.Model.AppLibraryButtons1 p) => p.ID == index.ToGuid()); 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 (str5.IsGuid()) { appLibraryButtons2.ButtonID = str5.ToGuid(); } appLibraryButtons2.Events = text6; appLibraryButtons2.Ico = ico; appLibraryButtons2.Name = str6.Trim1(); appLibraryButtons2.Sort = str8.ToInt(0); appLibraryButtons2.ShowType = str7.ToInt(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)); }