示例#1
0
        public RedirectResult SubPageDelete()
        {
            string contents = this.Request.Form["subpagesbox"] ?? "";

            RoadFlow.Platform.AppLibrarySubPages appLibrarySubPages = new RoadFlow.Platform.AppLibrarySubPages();
            RoadFlow.Platform.AppLibraryButtons1 appLibraryButtons1 = new RoadFlow.Platform.AppLibraryButtons1();
            using (TransactionScope transactionScope = new TransactionScope())
            {
                string str1    = contents;
                char[] chArray = new char[1] {
                    ','
                };
                foreach (string str2 in str1.Split(chArray))
                {
                    if (str2.IsGuid())
                    {
                        appLibrarySubPages.Delete(str2.ToGuid());
                        appLibraryButtons1.DeleteByAppID(str2.ToGuid());
                    }
                }
                RoadFlow.Platform.Log.Add("删除了子页面", contents, RoadFlow.Platform.Log.Types.菜单权限, "", "", (RoadFlow.Data.Model.Users)null);
                transactionScope.Complete();
            }
            appLibrarySubPages.ClearCache();
            appLibraryButtons1.ClearCache();
            return(this.Redirect("SubPages" + this.Request.Url.Query));
        }
示例#2
0
        public static bool CheckApp(out string msg, string appid = "")
        {
            msg = "";
            Guid userID = RoadFlow.Platform.Users.CurrentUserID;

            if (userID.IsEmptyGuid())
            {
                msg = "<script>top.login();</script>";
                return(false);
            }
            appid = appid.IsNullOrEmpty() ? HttpContext.Current.Request[nameof(appid)] : appid;
            Guid appGuid;

            if (!appid.IsGuid(out appGuid))
            {
                return(false);
            }
            List <RoadFlow.Data.Model.MenuUser> all1 = new RoadFlow.Platform.MenuUser().GetAll(true);
            string source;
            string params1;
            bool   flag = new RoadFlow.Platform.Menu().HasUse(appGuid, userID, all1, out source, out params1, false);

            if (!flag)
            {
                return(false);
            }
            string url = HttpContext.Current.Request.ServerVariables["SCRIPT_NAME"].ToString();

            if (!url.IsNullOrEmpty())
            {
                url = url.TrimStart('/');
                if (!url.IsNullOrEmpty())
                {
                    List <RoadFlow.Data.Model.AppLibrarySubPages> all2 = new RoadFlow.Platform.AppLibrarySubPages().GetAll(true).FindAll((Predicate <RoadFlow.Data.Model.AppLibrarySubPages>)(p => p.Address.Contains(url, StringComparison.CurrentCultureIgnoreCase)));
                    if (all2.Count > 0)
                    {
                        foreach (RoadFlow.Data.Model.AppLibrarySubPages appLibrarySubPages in all2)
                        {
                            RoadFlow.Data.Model.AppLibrarySubPages sub = appLibrarySubPages;
                            if (all1.Find((Predicate <RoadFlow.Data.Model.MenuUser>)(p =>
                            {
                                if (p.MenuID == appGuid && p.SubPageID == sub.ID)
                                {
                                    return(p.Users.Contains(userID.ToString(), StringComparison.CurrentCultureIgnoreCase));
                                }
                                return(false);
                            })) != null)
                            {
                                return(true);
                            }
                        }
                        return(false);
                    }
                }
            }
            return(flag);
        }
        public RedirectResult SubPageDelete()
        {
            string text = base.Request.Form["subpagesbox"] ?? "";

            RoadFlow.Platform.AppLibrarySubPages appLibrarySubPages = new RoadFlow.Platform.AppLibrarySubPages();
            RoadFlow.Platform.AppLibraryButtons1 appLibraryButtons  = new RoadFlow.Platform.AppLibraryButtons1();
            using (TransactionScope transactionScope = new TransactionScope())
            {
                string[] array = text.Split(',');
                foreach (string text2 in array)
                {
                    if (MyExtensions.IsGuid(text2))
                    {
                        appLibrarySubPages.Delete(MyExtensions.ToGuid(text2));
                        appLibraryButtons.DeleteByAppID(MyExtensions.ToGuid(text2));
                    }
                }
                RoadFlow.Platform.Log.Add("删除了子页面", text, RoadFlow.Platform.Log.Types.菜单权限);
                transactionScope.Complete();
            }
            appLibrarySubPages.ClearCache();
            appLibraryButtons.ClearCache();
            return(Redirect("SubPages" + base.Request.Url.Query));
        }
示例#4
0
        public ActionResult SubPageEdit(FormCollection collection)
        {
            RoadFlow.Platform.AppLibrarySubPages   appLibrarySubPages = new RoadFlow.Platform.AppLibrarySubPages();
            RoadFlow.Data.Model.AppLibrarySubPages model1             = (RoadFlow.Data.Model.AppLibrarySubPages)null;
            string str1 = this.Request.QueryString["subid"];

            if (str1.IsGuid())
            {
                model1 = appLibrarySubPages.Get(str1.ToGuid());
            }
            if (collection != null)
            {
                string str2  = this.Request.Form["Title"];
                string str3  = this.Request.Form["Address"];
                bool   flag1 = false;
                if (model1 == null)
                {
                    model1              = new RoadFlow.Data.Model.AppLibrarySubPages();
                    flag1               = true;
                    model1.ID           = Guid.NewGuid();
                    model1.AppLibraryID = this.Request.QueryString["id"].ToGuid();
                }
                model1.Name    = str2.Trim1();
                model1.Address = str3.Trim1();
                using (TransactionScope transactionScope = new TransactionScope())
                {
                    if (flag1)
                    {
                        appLibrarySubPages.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__8.\u003C\u003Ep__0 == null)
                        {
                            // ISSUE: reference to a compiler-generated field
                            AppLibraryController.\u003C\u003Eo__8.\u003C\u003Ep__0 = 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__8.\u003C\u003Ep__0.Target((CallSite)AppLibraryController.\u003C\u003Eo__8.\u003C\u003Ep__0, this.ViewBag, "alert('添加成功!');window.location='SubPages" + this.Request.Url.Query + "';");
                    }
                    else
                    {
                        appLibrarySubPages.Update(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__8.\u003C\u003Ep__1 == null)
                        {
                            // ISSUE: reference to a compiler-generated field
                            AppLibraryController.\u003C\u003Eo__8.\u003C\u003Ep__1 = 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__8.\u003C\u003Ep__1.Target((CallSite)AppLibraryController.\u003C\u003Eo__8.\u003C\u003Ep__1, this.ViewBag, "alert('保存成功!');window.location='SubPages" + this.Request.Url.Query + "';");
                    }
                    RoadFlow.Platform.AppLibraryButtons1 appLibraryButtons1_1 = new RoadFlow.Platform.AppLibraryButtons1();
                    string str4 = 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] {
                        ','
                    };
                    foreach (string str5 in str4.Split(chArray))
                    {
                        string index = str5;
                        string str6  = this.Request.Form["button_" + index];
                        string str7  = this.Request.Form["buttonname_" + index];
                        string str8  = this.Request.Form["buttonevents_" + index];
                        string str9  = this.Request.Form["buttonico_" + index];
                        string str10 = this.Request.Form["showtype_" + index];
                        string str11 = this.Request.Form["buttonsort_" + index];
                        if (!str7.IsNullOrEmpty() && !str8.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 (str6.IsGuid())
                            {
                                model2.ButtonID = new Guid?(str6.ToGuid());
                            }
                            model2.Events   = str8;
                            model2.Ico      = str9;
                            model2.Name     = str7.Trim1();
                            model2.Sort     = str11.ToInt(0);
                            model2.ShowType = str10.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 sub1 = appLibraryButtons1_2;
                        if (appLibraryButtons1List.Find((Predicate <RoadFlow.Data.Model.AppLibraryButtons1>)(p => p.ID == sub1.ID)) == null)
                        {
                            appLibraryButtons1_1.Delete(sub1.ID);
                        }
                    }
                    transactionScope.Complete();
                    appLibraryButtons1_1.ClearCache();
                    appLibrarySubPages.ClearCache();
                }
            }
            if (model1 == null)
            {
                model1              = new RoadFlow.Data.Model.AppLibrarySubPages();
                model1.ID           = Guid.Empty;
                model1.AppLibraryID = this.Request.QueryString["id"].ToGuid();
            }
            return((ActionResult)this.View((object)model1));
        }
        public ActionResult SubPageEdit(FormCollection collection)
        {
            RoadFlow.Platform.AppLibrarySubPages   appLibrarySubPages  = new RoadFlow.Platform.AppLibrarySubPages();
            RoadFlow.Data.Model.AppLibrarySubPages appLibrarySubPages2 = null;
            string text = base.Request.QueryString["subid"];

            if (MyExtensions.IsGuid(text))
            {
                appLibrarySubPages2 = appLibrarySubPages.Get(MyExtensions.ToGuid(text));
            }
            if (collection != null)
            {
                string text2 = base.Request.Form["Title"];
                string text3 = base.Request.Form["Address"];
                bool   flag  = false;
                if (appLibrarySubPages2 == null)
                {
                    appLibrarySubPages2 = new RoadFlow.Data.Model.AppLibrarySubPages();
                    flag = true;
                    appLibrarySubPages2.ID           = Guid.NewGuid();
                    appLibrarySubPages2.AppLibraryID = MyExtensions.ToGuid(base.Request.QueryString["id"]);
                }
                appLibrarySubPages2.Name    = MyExtensions.Trim1(text2);
                appLibrarySubPages2.Address = MyExtensions.Trim1(text3);
                using (TransactionScope transactionScope = new TransactionScope())
                {
                    if (flag)
                    {
                        appLibrarySubPages.Add(appLibrarySubPages2);
                        RoadFlow.Platform.Log.Add("添加了子页面", MyExtensions.Serialize((object)appLibrarySubPages2), RoadFlow.Platform.Log.Types.菜单权限);
                        base.ViewBag.Script = "alert('添加成功!');window.location='SubPages" + base.Request.Url.Query + "';";
                    }
                    else
                    {
                        appLibrarySubPages.Update(appLibrarySubPages2);
                        RoadFlow.Platform.Log.Add("修改了子页面", MyExtensions.Serialize((object)appLibrarySubPages2), RoadFlow.Platform.Log.Types.菜单权限);
                        base.ViewBag.Script = "alert('保存成功!');window.location='SubPages" + base.Request.Url.Query + "';";
                    }
                    RoadFlow.Platform.AppLibraryButtons1 appLibraryButtons = new RoadFlow.Platform.AppLibraryButtons1();
                    string obj = base.Request.Form["buttonindex"] ?? "";
                    List <RoadFlow.Data.Model.AppLibraryButtons1> allByAppID = appLibraryButtons.GetAllByAppID(appLibrarySubPages2.ID);
                    List <RoadFlow.Data.Model.AppLibraryButtons1> list       = new List <RoadFlow.Data.Model.AppLibraryButtons1>();
                    string[] array = obj.Split(',');
                    foreach (string index in array)
                    {
                        string text4 = base.Request.Form["button_" + index];
                        string text5 = base.Request.Form["buttonname_" + index];
                        string text6 = base.Request.Form["buttonevents_" + index];
                        string ico   = base.Request.Form["buttonico_" + index];
                        string text7 = base.Request.Form["showtype_" + index];
                        string text8 = base.Request.Form["buttonsort_" + index];
                        if (!MyExtensions.IsNullOrEmpty(text5) && !MyExtensions.IsNullOrEmpty(text6))
                        {
                            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 = appLibrarySubPages2.ID;
                            if (MyExtensions.IsGuid(text4))
                            {
                                appLibraryButtons2.ButtonID = MyExtensions.ToGuid(text4);
                            }
                            appLibraryButtons2.Events   = text6;
                            appLibraryButtons2.Ico      = ico;
                            appLibraryButtons2.Name     = MyExtensions.Trim1(text5);
                            appLibraryButtons2.Sort     = MyExtensions.ToInt(text8, 0);
                            appLibraryButtons2.ShowType = MyExtensions.ToInt(text7, 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();
                    appLibrarySubPages.ClearCache();
                }
            }
            if (appLibrarySubPages2 == null)
            {
                appLibrarySubPages2              = new RoadFlow.Data.Model.AppLibrarySubPages();
                appLibrarySubPages2.ID           = Guid.Empty;
                appLibrarySubPages2.AppLibraryID = MyExtensions.ToGuid(base.Request.QueryString["id"]);
            }
            return(View(appLibrarySubPages2));
        }