Ejemplo n.º 1
0
        public ActionResult Sort(FormCollection collection)
        {
            RoadFlow.Platform.Menu          menu = new RoadFlow.Platform.Menu();
            List <RoadFlow.Data.Model.Menu> list = new List <RoadFlow.Data.Model.Menu>();
            string str = base.Request.QueryString["id"];

            RoadFlow.Data.Model.Menu menu2 = menu.Get(str.ToGuid());
            list = menu.GetChild(menu2.ParentID);
            if (collection != null)
            {
                string text = base.Request.Form["sortapp"];
                if (text.IsNullOrEmpty())
                {
                    return(View(list));
                }
                string[] array = text.Split(',');
                for (int i = 0; i < array.Length; i++)
                {
                    Guid test;
                    if (array[i].IsGuid(out test))
                    {
                        menu.UpdateSort(test, i + 1);
                    }
                }
                string str2 = menu2.ParentID.ToString();
                base.ViewBag.Script = "parent.frames[0].reLoad('" + str2 + "');";
                list = menu.GetChild(menu2.ParentID);
                menu.ClearAllDataTableCache();
            }
            return(View(list));
        }
Ejemplo n.º 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["appid"] : appid);
            Guid appGuid;

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

            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> list = new RoadFlow.Platform.AppLibrarySubPages().GetAll().FindAll((RoadFlow.Data.Model.AppLibrarySubPages p) => p.Address.Contains(url, StringComparison.CurrentCultureIgnoreCase));
                    if (list.Count > 0)
                    {
                        foreach (RoadFlow.Data.Model.AppLibrarySubPages item in list)
                        {
                            if (all.Find(delegate(RoadFlow.Data.Model.MenuUser p)
                            {
                                if (p.MenuID == appGuid && p.SubPageID == item.ID)
                                {
                                    return(p.Users.Contains(userID.ToString(), StringComparison.CurrentCultureIgnoreCase));
                                }
                                return(false);
                            }) != null)
                            {
                                return(true);
                            }
                        }
                        return(false);
                    }
                }
            }
            return(flag);
        }
Ejemplo n.º 3
0
        public ActionResult AddApp(FormCollection collection)
        {
            RoadFlow.Platform.AppLibrary appLibrary = new RoadFlow.Platform.AppLibrary();
            RoadFlow.Platform.Menu       menu       = new RoadFlow.Platform.Menu();
            string text = base.Request.QueryString["id"];

            if (collection != null)
            {
                menu.Get(text.ToGuid());
                if (!base.Request.Form["Save"].IsNullOrEmpty())
                {
                    string text2 = base.Request.Form["Name"];
                    string text6 = base.Request.Form["Type"];
                    string str   = base.Request.Form["AppID"];
                    string text3 = base.Request.Form["Params"];
                    string text4 = base.Request.Form["Ico"];
                    string text5 = base.Request.Form["IcoColor"];
                    RoadFlow.Data.Model.Menu menu2 = new RoadFlow.Data.Model.Menu();
                    menu2.ID       = Guid.NewGuid();
                    menu2.ParentID = text.ToGuid();
                    menu2.Title    = text2.Trim();
                    menu2.Sort     = menu.GetMaxSort(menu2.ParentID);
                    if (str.IsGuid())
                    {
                        menu2.AppLibraryID = str.ToGuid();
                    }
                    else
                    {
                        menu2.AppLibraryID = null;
                    }
                    menu2.Params = (text3.IsNullOrEmpty() ? null : text3.Trim());
                    if (!text4.IsNullOrEmpty())
                    {
                        menu2.Ico = text4;
                    }
                    if (!text5.IsNullOrEmpty())
                    {
                        menu2.IcoColor = text5;
                    }
                    menu.Add(menu2);
                    RoadFlow.Platform.Log.Add("添加了菜单", menu2.Serialize(), RoadFlow.Platform.Log.Types.菜单权限);
                    string str2 = text;
                    base.ViewBag.Script = "alert('添加成功');parent.frames[0].reLoad('" + str2 + "');";
                    menu.ClearAllDataTableCache();
                }
            }
            base.ViewBag.AppTypesOptions = appLibrary.GetTypeOptions();
            return(View());
        }
Ejemplo n.º 4
0
        public string TreeRefresh()
        {
            string text = base.Request["refreshid"];

            if (!text.IsGuid())
            {
                return("[]");
            }
            RoadFlow.Platform.Menu menu = new RoadFlow.Platform.Menu();
            DataRow[]     array         = menu.GetAllDataTable().Select("ParentID='" + text + "'");
            StringBuilder stringBuilder = new StringBuilder("[", array.Length * 50);
            int           num           = array.Length;
            int           num2          = 0;

            DataRow[] array2 = array;
            foreach (DataRow dataRow in array2)
            {
                string text2 = dataRow["AppIco"].ToString();
                if (text2.IsNullOrEmpty())
                {
                    text2 = dataRow["Ico"].ToString();
                }
                stringBuilder.Append("{");
                stringBuilder.AppendFormat("\"id\":\"{0}\",", dataRow["ID"]);
                stringBuilder.AppendFormat("\"title\":\"{0}\",", dataRow["Title"]);
                stringBuilder.AppendFormat("\"ico\":\"{0}\",", text2);
                stringBuilder.AppendFormat("\"link\":\"{0}\",", "");
                stringBuilder.AppendFormat("\"type\":\"{0}\",", "0");
                stringBuilder.AppendFormat("\"model\":\"{0}\",", "");
                stringBuilder.AppendFormat("\"width\":\"{0}\",", "");
                stringBuilder.AppendFormat("\"height\":\"{0}\",", "");
                stringBuilder.AppendFormat("\"hasChilds\":\"{0}\",", menu.HasChild(dataRow["ID"].ToString().ToGuid()) ? "1" : "0");
                stringBuilder.AppendFormat("\"childs\":[");
                stringBuilder.Append("]");
                stringBuilder.Append("}");
                if (num2++ < num - 1)
                {
                    stringBuilder.Append(",");
                }
            }
            stringBuilder.Append("]");
            return(stringBuilder.ToString());
        }
Ejemplo n.º 5
0
        public string Tree1()
        {
            DataTable allDataTable = new RoadFlow.Platform.Menu().GetAllDataTable();

            if (allDataTable.Rows.Count == 0)
            {
                return("[]");
            }
            DataRow[] array = allDataTable.Select("ParentID='" + Guid.Empty.ToString() + "'");
            if (array.Length == 0)
            {
                return("[]");
            }
            DataRow[]     array2        = allDataTable.Select("ParentID='" + array[0]["ID"].ToString() + "'");
            StringBuilder stringBuilder = new StringBuilder("[", 1000);
            DataRow       dataRow       = array[0];
            string        text          = dataRow["AppIco"].ToString();

            if (text.IsNullOrEmpty())
            {
                text = dataRow["Ico"].ToString();
            }
            stringBuilder.Append("{");
            stringBuilder.AppendFormat("\"id\":\"{0}\",", dataRow["ID"]);
            stringBuilder.AppendFormat("\"title\":\"{0}\",", dataRow["Title"]);
            stringBuilder.AppendFormat("\"ico\":\"{0}\",", text);
            stringBuilder.AppendFormat("\"link\":\"{0}\",", dataRow["Address"]);
            stringBuilder.AppendFormat("\"type\":\"{0}\",", "0");
            stringBuilder.AppendFormat("\"model\":\"{0}\",", dataRow["OpenMode"]);
            stringBuilder.AppendFormat("\"width\":\"{0}\",", dataRow["Width"]);
            stringBuilder.AppendFormat("\"height\":\"{0}\",", dataRow["Height"]);
            stringBuilder.AppendFormat("\"hasChilds\":\"{0}\",", (array2.Length != 0) ? "1" : "0");
            stringBuilder.AppendFormat("\"childs\":[");
            for (int i = 0; i < array2.Length; i++)
            {
                DataRow dataRow2 = array2[i];
                string  text2    = dataRow2["AppIco"].ToString();
                if (text2.IsNullOrEmpty())
                {
                    text2 = dataRow2["Ico"].ToString();
                }
                DataRow[] array3 = allDataTable.Select("ParentID='" + dataRow2["ID"].ToString() + "'");
                stringBuilder.Append("{");
                stringBuilder.AppendFormat("\"id\":\"{0}\",", dataRow2["ID"]);
                stringBuilder.AppendFormat("\"title\":\"{0}\",", dataRow2["Title"]);
                stringBuilder.AppendFormat("\"ico\":\"{0}\",", text2);
                stringBuilder.AppendFormat("\"link\":\"{0}\",", dataRow2["Address"]);
                stringBuilder.AppendFormat("\"type\":\"{0}\",", "0");
                stringBuilder.AppendFormat("\"model\":\"{0}\",", dataRow2["OpenMode"]);
                stringBuilder.AppendFormat("\"width\":\"{0}\",", dataRow2["Width"]);
                stringBuilder.AppendFormat("\"height\":\"{0}\",", dataRow2["Height"]);
                stringBuilder.AppendFormat("\"hasChilds\":\"{0}\",", (array3.Length != 0) ? "1" : "0");
                stringBuilder.AppendFormat("\"childs\":[");
                stringBuilder.Append("]");
                stringBuilder.Append("}");
                if (i < array2.Length - 1)
                {
                    stringBuilder.Append(",");
                }
            }
            stringBuilder.Append("]");
            stringBuilder.Append("}");
            stringBuilder.Append("]");
            return(stringBuilder.ToString());
        }
Ejemplo n.º 6
0
        public ActionResult Body(FormCollection collection)
        {
            RoadFlow.Platform.AppLibrary appLibrary = new RoadFlow.Platform.AppLibrary();
            RoadFlow.Platform.Menu       menu       = new RoadFlow.Platform.Menu();
            RoadFlow.Data.Model.Menu     menu2      = null;
            string str    = base.Request.QueryString["id"];
            string empty  = string.Empty;
            string value  = string.Empty;
            string empty2 = string.Empty;
            string empty3 = string.Empty;
            string empty4 = string.Empty;
            string empty5 = string.Empty;
            Guid   test;

            if (str.IsGuid(out test))
            {
                menu2 = menu.Get(test);
            }
            if (!base.Request.Form["Save"].IsNullOrEmpty())
            {
                empty  = base.Request.Form["Name"];
                value  = base.Request.Form["Type"];
                empty2 = base.Request.Form["AppID"];
                empty3 = base.Request.Form["Params"];
                empty4 = base.Request.Form["Ico"];
                empty5 = base.Request.Form["IcoColor"];
                string oldXML = menu2.Serialize();
                menu2.Title = empty.Trim();
                if (empty2.IsGuid())
                {
                    menu2.AppLibraryID = empty2.ToGuid();
                }
                else
                {
                    menu2.AppLibraryID = null;
                }
                menu2.Params = (empty3.IsNullOrEmpty() ? null : empty3.Trim());
                if (!empty4.IsNullOrEmpty())
                {
                    menu2.Ico = empty4;
                }
                else
                {
                    menu2.Ico = null;
                }
                if (!empty5.IsNullOrEmpty())
                {
                    menu2.IcoColor = empty5;
                }
                else
                {
                    menu2.IcoColor = null;
                }
                menu.Update(menu2);
                RoadFlow.Platform.Log.Add("修改了菜单", "", RoadFlow.Platform.Log.Types.菜单权限, oldXML, menu2.Serialize());
                string str2 = (menu2.ParentID == Guid.Empty) ? menu2.ID.ToString() : menu2.ParentID.ToString();
                base.ViewBag.Script = "parent.frames[0].reLoad('" + str2 + "');alert('保存成功!');";
                menu.ClearAllDataTableCache();
            }
            if (!base.Request.Form["Delete"].IsNullOrEmpty())
            {
                RoadFlow.Platform.Log.Add("删除了菜单及其所有下级共" + menu.DeleteAndAllChilds(menu2.ID).ToString() + "项", menu2.Serialize(), RoadFlow.Platform.Log.Types.菜单权限);
                string text = (menu2.ParentID == Guid.Empty) ? menu2.ID.ToString() : menu2.ParentID.ToString();
                base.ViewBag.Script = "parent.frames[0].reLoad('" + text + "');window.location='Body?id=" + text + "&appid=" + base.Request.QueryString["appid"] + "&tabid=" + base.Request.QueryString["tabid"] + "';";
                menu.ClearAllDataTableCache();
            }
            if (menu2 != null && menu2.AppLibraryID.HasValue)
            {
                RoadFlow.Data.Model.AppLibrary appLibrary2 = new RoadFlow.Platform.AppLibrary().Get(menu2.AppLibraryID.Value);
                if (appLibrary2 != null)
                {
                    value = appLibrary2.Type.ToString();
                }
            }
            base.ViewBag.AppTypesOptions = appLibrary.GetTypeOptions(value);
            base.ViewBag.AppID           = menu2.AppLibraryID.ToString();
            return(View(menu2));
        }