Ejemplo n.º 1
0
        public ActionResult Body()
        {
            Business.Platform.AppLibrary bappLibrary = new Business.Platform.AppLibrary();
            Business.Platform.RoleApp    broleApp    = new Business.Platform.RoleApp();
            Data.Model.RoleApp           roleApp     = null;
            string id = Request.QueryString["id"];

            string name    = string.Empty;
            string type    = string.Empty;
            string appid   = string.Empty;
            string params1 = string.Empty;
            string ico     = string.Empty;

            Guid appID;

            if (id.IsGuid(out appID))
            {
                roleApp = broleApp.Get(appID);
                if (roleApp != null)
                {
                    name    = roleApp.Title;
                    type    = roleApp.AppID.HasValue ? bappLibrary.GetTypeByID(roleApp.AppID.Value) : "";
                    appid   = roleApp.AppID.ToString();
                    params1 = roleApp.Params;
                    ico     = roleApp.Ico;
                }
            }
            if (roleApp == null)
            {
                roleApp = new Data.Model.RoleApp();
            }
            ViewBag.AppID           = appid;
            ViewBag.AppTypesOptions = bappLibrary.GetTypeOptions(type);
            return(View(roleApp));
        }
Ejemplo n.º 2
0
        public ActionResult Body1(FormCollection collection)
        {
            Business.Platform.AppLibrary bappLibrary = new Business.Platform.AppLibrary();
            Business.Platform.RoleApp    broleApp    = new Business.Platform.RoleApp();
            Business.Platform.UsersApp   buserApp    = new Business.Platform.UsersApp();
            Data.Model.UsersApp          usersApp    = null;

            string id = Request.QueryString["id"];

            string name    = string.Empty;
            string type    = string.Empty;
            string appid   = string.Empty;
            string params1 = string.Empty;
            string ico     = string.Empty;

            Guid appID;

            if (id.IsGuid(out appID))
            {
                usersApp = buserApp.Get(appID);
                if (usersApp != null)
                {
                    name    = usersApp.Title;
                    type    = usersApp.AppID.HasValue ? bappLibrary.GetTypeByID(usersApp.AppID.Value) : "";
                    appid   = usersApp.AppID.ToString();
                    params1 = usersApp.Params;
                    ico     = usersApp.Ico;
                }
            }


            if (collection != null && usersApp != null)
            {
                if (!Request.Form["Save"].IsNullOrEmpty())
                {
                    name    = Request.Form["Name"];
                    type    = Request.Form["Type"];
                    appid   = Request.Form["AppID"];
                    params1 = Request.Form["Params"];
                    ico     = Request.Form["Ico"];

                    string oldXML = usersApp.Serialize();
                    usersApp.Title = name.Trim();
                    if (appid.IsGuid())
                    {
                        usersApp.AppID = appid.ToGuid();
                    }
                    else
                    {
                        usersApp.AppID = null;
                    }
                    usersApp.Params = params1.IsNullOrEmpty() ? null : params1.Trim();
                    if (!ico.IsNullOrEmpty())
                    {
                        usersApp.Ico = ico;
                    }
                    else
                    {
                        usersApp.Ico = null;
                    }

                    buserApp.Update(usersApp);
                    buserApp.ClearCache();
                    Business.Platform.Log.Add("修改了个人应用", "", Business.Platform.Log.Types.角色应用, oldXML, usersApp.Serialize());
                    string refreshID = usersApp.ParentID.ToString();
                    ViewBag.Script = "alert('保存成功!'); parent.frames[0].reLoad('" + refreshID + "')";
                }

                if (!Request.Form["Delete"].IsNullOrEmpty())
                {
                    int i = buserApp.DeleteAndAllChilds(usersApp.ID);
                    buserApp.ClearCache();
                    Business.Platform.Log.Add("删除了个人应用", usersApp.Serialize(), Business.Platform.Log.Types.角色应用);
                    string refreshID = usersApp.ParentID.ToString();
                    var    parent    = buserApp.Get(usersApp.ParentID);
                    string page      = parent == null ? "Body" : "Body1";
                    ViewBag.Script = "parent.frames[0].reLoad('" + refreshID + "');window.location='" + page + "?id=" + refreshID + "&appid=" + Request.QueryString["appid"] + "&tabid=" + Request.QueryString["tabid"] + "&userid=" + Request.QueryString["userid"] + "';";
                }
            }
            ViewBag.AppID           = appid;
            ViewBag.AppTypesOptions = bappLibrary.GetTypeOptions(type);
            return(View(usersApp == null ? new Data.Model.UsersApp() : usersApp));
        }