Beispiel #1
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());
        }
Beispiel #2
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));
        }