public ActionResult Body() { RoadFlow.Platform.AppLibraryBLL bappLibrary = new RoadFlow.Platform.AppLibraryBLL(); RoadFlow.Platform.RoleApp broleApp = new RoadFlow.Platform.RoleApp(); RoadFlow.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 RoadFlow.Data.Model.RoleApp(); } ViewBag.AppID = appid; ViewBag.AppTypesOptions = bappLibrary.GetTypeOptions(type); return(View(roleApp)); }
protected void Page_Load(object sender, EventArgs e) { RoadFlow.Platform.RoleApp broleApp = new RoadFlow.Platform.RoleApp(); string id = Request.QueryString["id"]; var roleApp = broleApp.Get(id.ToGuid()); //RoleAppList = broleApp.GetChild(roleApp.ParentID); if (IsPostBack) { string srots = Request.Form["sortapp"]; if (srots.IsNullOrEmpty()) { return; } string[] sortArray = srots.Split(new char[] { ',' }); for (int i = 0; i < sortArray.Length; i++) { Guid guid; if (!sortArray[i].IsGuid(out guid)) { continue; } broleApp.UpdateSort(guid, i + 1); } broleApp.ClearAllDataTableCache(); string rid = roleApp.ParentID.ToString(); Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "parent.frames[0].reLoad('" + rid + "');", true); } RoleAppList = broleApp.GetChild(roleApp.ParentID); }
public ActionResult Sort(FormCollection collection) { RoadFlow.Platform.RoleApp broleApp = new RoadFlow.Platform.RoleApp(); List <RoadFlow.Data.Model.RoleApp> roleAppList = new List <RoadFlow.Data.Model.RoleApp>(); string id = Request.QueryString["id"]; var roleApp = broleApp.Get(id.Convert <Guid>()); roleAppList = broleApp.GetChild(roleApp.ParentID); if (collection != null) { string srots = Request.Form["sortapp"]; if (srots.IsNullOrEmpty()) { return(View(roleAppList)); } string[] sortArray = srots.Split(new char[] { ',' }); for (int i = 0; i < sortArray.Length; i++) { Guid guid; if (!sortArray[i].IsGuid(out guid)) { continue; } broleApp.UpdateSort(guid, i + 1); } broleApp.ClearAllDataTableCache(); string rid = roleApp.ParentID.ToString(); ViewBag.Script = "parent.frames[0].reLoad('" + rid + "');"; roleAppList = broleApp.GetChild(roleApp.ParentID); } return(View(roleAppList)); }
public ActionResult AddApp(FormCollection collection) { RoadFlow.Platform.AppLibraryBLL bappLibrary = new RoadFlow.Platform.AppLibraryBLL(); RoadFlow.Platform.UsersApp busersApp = new RoadFlow.Platform.UsersApp(); RoadFlow.Platform.RoleApp broleApp = new RoadFlow.Platform.RoleApp(); RoadFlow.Data.Model.UsersApp usersApp = null; string id = Request.QueryString["id"]; string userID = Request.QueryString["userid"]; string roleID = Request.QueryString["roleid"]; if (collection != null && id.IsGuid() && userID.IsGuid()) { usersApp = busersApp.Get(id.Convert <Guid>()); if (!Request.Form["Save"].IsNullOrEmpty()) { string name = Request.Form["Name"]; string type = Request.Form["Type"]; string appid = Request.Form["AppID"]; string params1 = Request.Form["Params"]; string ico = Request.Form["Ico"]; RoadFlow.Data.Model.UsersApp usersApp1 = new RoadFlow.Data.Model.UsersApp(); usersApp1.ID = Guid.NewGuid(); usersApp1.ParentID = id.Convert <Guid>(); usersApp1.Title = name.Trim(); usersApp1.Sort = broleApp.GetMaxSort(id.Convert <Guid>()); usersApp1.UserID = userID.Convert <Guid>(); usersApp1.RoleID = roleID.IsGuid() ? roleID.Convert <Guid>() : Guid.Empty; if (appid.IsGuid()) { usersApp1.AppID = appid.Convert <Guid>(); } else { usersApp1.AppID = null; } usersApp1.Params = params1.IsNullOrEmpty() ? null : params1.Trim(); if (!ico.IsNullOrEmpty()) { usersApp1.Ico = ico; } busersApp.Add(usersApp1); busersApp.ClearCache(); RoadFlow.Platform.Log.Add("添加了个人应用", busersApp.Serialize(), RoadFlow.Platform.Log.Types.角色应用); string refreshID = id; ViewBag.Script = "alert('添加成功!'); parent.frames[0].reLoad('" + refreshID + "')"; } } ViewBag.AppTypesOptions = bappLibrary.GetTypeOptions(); return(View()); }
protected void Page_Load(object sender, EventArgs e) { RoadFlow.Platform.AppLibrary bappLibrary = new RoadFlow.Platform.AppLibrary(); RoadFlow.Platform.UsersApp busersApp = new RoadFlow.Platform.UsersApp(); RoadFlow.Platform.RoleApp broleApp = new RoadFlow.Platform.RoleApp(); RoadFlow.Data.Model.UsersApp usersApp = null; string id = Request.QueryString["id"]; string userID = Request.QueryString["userid"]; string roleID = Request.QueryString["roleid"]; if (IsPostBack && id.IsGuid() && userID.IsGuid()) { usersApp = busersApp.Get(id.ToGuid()); if (!Request.Form["Save"].IsNullOrEmpty()) { string name = Request.Form["Name"]; string type = Request.Form["Type"]; string appid = Request.Form["AppID"]; string params1 = Request.Form["Params"]; string ico = Request.Form["Ico"]; RoadFlow.Data.Model.UsersApp usersApp1 = new RoadFlow.Data.Model.UsersApp(); usersApp1.ID = Guid.NewGuid(); usersApp1.ParentID = id.ToGuid(); usersApp1.Title = name.Trim(); usersApp1.Sort = broleApp.GetMaxSort(id.ToGuid()); usersApp1.UserID = userID.ToGuid(); usersApp1.RoleID = roleID.IsGuid() ? roleID.ToGuid() : Guid.Empty; if (appid.IsGuid()) { usersApp1.AppID = appid.ToGuid(); } else { usersApp1.AppID = null; } usersApp1.Params = params1.IsNullOrEmpty() ? null : params1.Trim(); if (!ico.IsNullOrEmpty()) { usersApp1.Ico = ico; } busersApp.Add(usersApp1); busersApp.ClearCache(); RoadFlow.Platform.Log.Add("添加了个人应用", busersApp.Serialize(), RoadFlow.Platform.Log.Types.角色应用); string refreshID = id; Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('添加成功!'); parent.frames[0].reLoad('" + refreshID + "')", true); } } AppTypesOptions = bappLibrary.GetTypeOptions(); }
public ActionResult AddApp(FormCollection collection) { RoadFlow.Platform.AppLibraryBLL bappLibrary = new RoadFlow.Platform.AppLibraryBLL(); RoadFlow.Platform.RoleApp broleApp = new RoadFlow.Platform.RoleApp(); RoadFlow.Data.Model.RoleApp roleApp = null; string id = Request.QueryString["id"]; if (collection != null) { roleApp = broleApp.Get(id.Convert <Guid>()); if (!Request.Form["Save"].IsNullOrEmpty()) { string name = Request.Form["Name"]; string type = Request.Form["Type"]; string appid = Request.Form["AppID"]; string params1 = Request.Form["Params"]; string ico = Request.Form["Ico"]; RoadFlow.Data.Model.RoleApp roleApp1 = new RoadFlow.Data.Model.RoleApp(); roleApp1.ID = Guid.NewGuid(); roleApp1.ParentID = id.Convert <Guid>(); roleApp1.RoleID = roleApp.RoleID; roleApp1.Title = name.Trim(); roleApp1.ParentID = roleApp.ID; roleApp1.Sort = broleApp.GetMaxSort(roleApp.ID); roleApp1.Type = 0; if (appid.IsGuid()) { roleApp1.AppID = appid.Convert <Guid>(); } else { roleApp1.AppID = null; } roleApp1.Params = params1.IsNullOrEmpty() ? null : params1.Trim(); if (!ico.IsNullOrEmpty()) { roleApp1.Ico = ico; } broleApp.Add(roleApp1); broleApp.ClearAllDataTableCache(); RoadFlow.Platform.Log.Add("添加了应用模板", roleApp1.Serialize(), RoadFlow.Platform.Log.Types.角色应用); string refreshID = id; ViewBag.Script = "alert('添加成功');parent.frames[0].reLoad('" + refreshID + "');"; } } ViewBag.AppTypesOptions = bappLibrary.GetTypeOptions(); return(View()); }
/// <summary> /// 得到角色应用刷新JSON /// </summary> /// <returns></returns> public string GetRoleAppRefreshJsonString(Guid roleID, Guid userID, Guid refreshID, string rootDir = "") { RoleApp roleApp = new RoadFlow.Platform.RoleApp(); UsersApp UsersApp = new Platform.UsersApp(); AppLibrary Applibary = new AppLibrary(); DataTable roleAppDt = roleApp.GetAllDataTableFromCache(); DataTable appDt1 = CloneDataTable(roleAppDt); UsersApp.AppendUserApps(userID, appDt1); var dv = appDt1.DefaultView; dv.RowFilter = string.Format("ParentID='{0}'", refreshID); dv.Sort = "Sort"; var appDt = dv.ToTable(); if (appDt.Rows.Count == 0) { return("[]"); } int count = appDt.Rows.Count; System.Text.StringBuilder json = new System.Text.StringBuilder("[", count * 100); foreach (DataRow dr in appDt.Rows) { if (!dr["UseMember"].ToString().IsNullOrEmpty() && dr["AppID"].ToString().IsGuid() && !Applibary.GetUseMemberCache(dr["AppID"].ToString().ToGuid()).Contains(userID)) { continue; } json.Append("{"); json.AppendFormat("\"id\":\"{0}\",", dr["ID"].ToString()); json.AppendFormat("\"title\":\"{0}\",", dr["Title"].ToString().Trim()); json.AppendFormat("\"ico\":\"{0}\",", dr["Ico"].ToString().IsNullOrEmpty() ? "" : rootDir + dr["Ico"].ToString()); json.AppendFormat("\"link\":\"{0}\",", getAddress(dr)); json.AppendFormat("\"model\":\"{0}\",", dr["OpenMode"].ToString()); json.AppendFormat("\"width\":\"{0}\",", dr["Width"].ToString()); json.AppendFormat("\"height\":\"{0}\",", dr["Height"].ToString()); json.AppendFormat("\"hasChilds\":\"{0}\",", appDt1.Select(string.Format("ParentID='{0}'", dr["id"].ToString())).Length > 0 ? "1" : "0"); json.AppendFormat("\"childs\":["); json.Append("]"); json.Append("}"); if (dr["ID"].ToString() != appDt.Rows[appDt.Rows.Count - 1]["ID"].ToString()) { json.Append(","); } } json.Append("]"); return(json.ToString()); }
protected void Page_Load(object sender, EventArgs e) { RoadFlow.Platform.AppLibrary bappLibrary = new RoadFlow.Platform.AppLibrary(); RoadFlow.Platform.RoleApp broleApp = new RoadFlow.Platform.RoleApp(); RoadFlow.Data.Model.RoleApp roleApp = null; string id = Request.QueryString["id"]; if (IsPostBack) { roleApp = broleApp.Get(id.ToGuid()); if (!Request.Form["Save"].IsNullOrEmpty()) { string name = Request.Form["Name"]; string type = Request.Form["Type"]; string appid = Request.Form["AppID"]; string params1 = Request.Form["Params"]; string ico = Request.Form["Ico"]; RoadFlow.Data.Model.RoleApp roleApp1 = new RoadFlow.Data.Model.RoleApp(); roleApp1.ID = Guid.NewGuid(); roleApp1.ParentID = id.ToGuid(); roleApp1.RoleID = roleApp.RoleID; roleApp1.Title = name.Trim(); roleApp1.ParentID = roleApp.ID; roleApp1.Sort = broleApp.GetMaxSort(roleApp.ID); roleApp1.Type = 0; if (appid.IsGuid()) { roleApp1.AppID = appid.ToGuid(); } else { roleApp1.AppID = null; } roleApp1.Params = params1.IsNullOrEmpty() ? null : params1.Trim(); if (!ico.IsNullOrEmpty()) { roleApp1.Ico = ico; } broleApp.Add(roleApp1); broleApp.ClearAllDataTableCache(); RoadFlow.Platform.Log.Add("添加了应用模板", roleApp1.Serialize(), RoadFlow.Platform.Log.Types.角色应用); string refreshID = id; Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('添加成功');parent.frames[0].reLoad('" + refreshID + "');", true); } } this.AppTypesOptions.Text = bappLibrary.GetTypeOptions(); }
protected void Page_Load(object sender, EventArgs e) { string id = Request["refreshid"]; string userID = Request.QueryString["userid"]; Guid rid; if (!id.IsGuid(out rid)) { Response.Write("[]"); Response.End(); } RoadFlow.Platform.RoleApp BRoleApp = new RoadFlow.Platform.RoleApp(); RoadFlow.Platform.UsersApp BUsersApp = new RoadFlow.Platform.UsersApp(); var childs = BRoleApp.GetChild(rid); //加载个人应用 if (userID.IsGuid()) { BUsersApp.AppendUserApps(userID.ToGuid(), rid, childs); } System.Text.StringBuilder json = new System.Text.StringBuilder("[", childs.Count * 50); int count = childs.Count; int i = 0; foreach (var child in childs.OrderBy(p => p.Sort)) { json.Append("{"); json.AppendFormat("\"id\":\"{0}\",", child.ID.ToString()); json.AppendFormat("\"title\":\"{0}\",", child.Title); json.AppendFormat("\"ico\":\"{0}\",", child.Ico); json.AppendFormat("\"link\":\"{0}\",", ""); json.AppendFormat("\"type\":\"{0}\",", child.Type); json.AppendFormat("\"model\":\"{0}\",", ""); json.AppendFormat("\"width\":\"{0}\",", ""); json.AppendFormat("\"height\":\"{0}\",", ""); json.AppendFormat("\"hasChilds\":\"{0}\",", BRoleApp.HasChild(child.ID) || BUsersApp.HasChild(child.ID) ? "1" : "0"); json.AppendFormat("\"childs\":["); json.Append("]"); json.Append("}"); if (i++ < count - 1) { json.Append(","); } } json.Append("]"); Response.Write(json.ToString()); }
/// <summary> /// 检查应用程序权限 /// </summary> /// <param name="appid"></param> /// <returns></returns> public static bool CheckApp(out string msg, string appid = "") { msg = ""; appid = appid.IsNullOrEmpty() ? System.Web.HttpContext.Current.Request.QueryString["appid"] : appid; Guid appGuid; if (!appid.IsGuid(out appGuid)) { return(false); } var app = new RoadFlow.Platform.RoleApp().GetFromCache(appid); if (app != null) { var roles = RoadFlow.Platform.Users.CurrentUserRoles; if (roles.Contains(app["RoleID"].ToString().ToGuid())) { return(true); } else { msg = "<script>top.login();</script>"; } } else { var userID = RoadFlow.Platform.Users.CurrentUserID; if (userID.IsEmptyGuid()) { msg = "<script>top.login();</script>"; return(false); } var userApp = new RoadFlow.Platform.UsersApp().GetUserDataRows(userID); foreach (System.Data.DataRow dr in userApp) { if (dr["ID"].ToString().ToGuid() == appGuid) { return(true); } } } return(false); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string id = context.Request["refreshid"]; if (!id.IsGuid()) { context.Response.Write("[]"); return; } RoadFlow.Platform.RoleApp BRoleApp = new RoadFlow.Platform.RoleApp(); var childs = BRoleApp.GetChild(id.ToGuid()); System.Text.StringBuilder json = new System.Text.StringBuilder("[", childs.Count * 50); int count = childs.Count; int i = 0; foreach (var child in childs) { json.Append("{"); json.AppendFormat("\"id\":\"{0}\",", child.ID); json.AppendFormat("\"title\":\"{0}\",", child.Title); json.AppendFormat("\"ico\":\"{0}\",", child.Ico.IsNullOrEmpty() ? "" : Common.Tools.BaseUrl + child.Ico); json.AppendFormat("\"link\":\"{0}\",", ""); json.AppendFormat("\"type\":\"{0}\",", "0"); json.AppendFormat("\"model\":\"{0}\",", ""); json.AppendFormat("\"width\":\"{0}\",", ""); json.AppendFormat("\"height\":\"{0}\",", ""); json.AppendFormat("\"hasChilds\":\"{0}\",", BRoleApp.HasChild(child.ID) ? "1" : "0"); json.AppendFormat("\"childs\":["); json.Append("]"); json.Append("}"); if (i++ < count - 1) { json.Append(","); } } json.Append("]"); context.Response.Write(json.ToString()); }
public string TreeRefresh() { string id = Request["refreshid"]; if (!id.IsGuid()) { return("[]"); } RoadFlow.Platform.RoleApp BRoleApp = new RoadFlow.Platform.RoleApp(); var childs = BRoleApp.GetChild(id.Convert <Guid>()); System.Text.StringBuilder json = new System.Text.StringBuilder("[", childs.Count * 50); int count = childs.Count; int i = 0; foreach (var child in childs) { json.Append("{"); json.AppendFormat("\"id\":\"{0}\",", child.ID); json.AppendFormat("\"title\":\"{0}\",", child.Title); //json.AppendFormat("\"ico\":\"{0}\",", child.Ico.IsNullOrEmpty() ? "" : Url.Content("~/" + child.Ico)); json.AppendFormat("\"ico\":\"{0}\",", ""); //不加载设置的图标,图标主要是主页面使用。 json.AppendFormat("\"link\":\"{0}\",", ""); json.AppendFormat("\"type\":\"{0}\",", "0"); json.AppendFormat("\"model\":\"{0}\",", ""); json.AppendFormat("\"width\":\"{0}\",", ""); json.AppendFormat("\"height\":\"{0}\",", ""); json.AppendFormat("\"hasChilds\":\"{0}\",", BRoleApp.HasChild(child.ID) ? "1" : "0"); json.AppendFormat("\"childs\":["); json.Append("]"); json.Append("}"); if (i++ < count - 1) { json.Append(","); } } json.Append("]"); return(json.ToString()); }
protected void Page_Load(object sender, EventArgs e) { string roleID = Request.QueryString["roleid"]; Guid roleGuid; if (!roleID.IsGuid(out roleGuid)) { Response.Write("[]"); Response.End(); } RoadFlow.Platform.RoleApp BRoleApp = new RoadFlow.Platform.RoleApp(); var appDt = BRoleApp.GetAllDataTableByRoleID(roleGuid); if (appDt.Rows.Count == 0) { Response.Write("[]"); Response.End(); } var root = appDt.Select("ParentID='" + Guid.Empty.ToString() + "'"); if (root.Length == 0) { Response.Write("[]"); Response.End(); } var apps = appDt.Select("ParentID='" + root[0]["ID"].ToString() + "'"); System.Text.StringBuilder json = new System.Text.StringBuilder("[", 1000); System.Data.DataRow rootDr = root[0]; json.Append("{"); json.AppendFormat("\"id\":\"{0}\",", rootDr["ID"]); json.AppendFormat("\"title\":\"{0}\",", rootDr["Title"]); json.AppendFormat("\"ico\":\"{0}\",", rootDr["Ico"]); json.AppendFormat("\"link\":\"{0}\",", rootDr["Address"]); json.AppendFormat("\"type\":\"{0}\",", "0"); json.AppendFormat("\"model\":\"{0}\",", rootDr["OpenMode"]); json.AppendFormat("\"width\":\"{0}\",", rootDr["Width"]); json.AppendFormat("\"height\":\"{0}\",", rootDr["Height"]); json.AppendFormat("\"hasChilds\":\"{0}\",", apps.Length > 0 ? "1" : "0"); json.AppendFormat("\"childs\":["); for (int i = 0; i < apps.Length; i++) { System.Data.DataRow dr = apps[i]; var childs = appDt.Select("ParentID='" + dr["ID"].ToString() + "'"); json.Append("{"); json.AppendFormat("\"id\":\"{0}\",", dr["ID"]); json.AppendFormat("\"title\":\"{0}\",", dr["Title"]); json.AppendFormat("\"ico\":\"{0}\",", dr["Ico"]); json.AppendFormat("\"link\":\"{0}\",", dr["Address"]); json.AppendFormat("\"type\":\"{0}\",", "0"); json.AppendFormat("\"model\":\"{0}\",", dr["OpenMode"]); json.AppendFormat("\"width\":\"{0}\",", dr["Width"]); json.AppendFormat("\"height\":\"{0}\",", dr["Height"]); json.AppendFormat("\"hasChilds\":\"{0}\",", childs.Length > 0 ? "1" : "0"); json.AppendFormat("\"childs\":["); json.Append("]"); json.Append("}"); if (i < apps.Length - 1) { json.Append(","); } } json.Append("]"); json.Append("}"); json.Append("]"); Response.Write(json.ToString()); }
public string Tree1() { string roleID = Request.QueryString["roleid"]; Guid roleGuid; if (!roleID.IsGuid(out roleGuid)) { return("[]"); } RoadFlow.Platform.RoleApp BRoleApp = new RoadFlow.Platform.RoleApp(); var appDt = BRoleApp.GetAllDataTableByRoleID(roleGuid); if (appDt.Rows.Count == 0) { return("[]"); } var root = appDt.Select("ParentID='" + Guid.Empty.ToString() + "'"); if (root.Length == 0) { return("[]"); } var apps = appDt.Select("ParentID='" + root[0]["ID"].ToString() + "'"); StringBuilder json = new StringBuilder("[", 1000); System.Data.DataRow rootDr = root[0]; json.Append("{"); json.AppendFormat("\"id\":\"{0}\",", rootDr["ID"]); json.AppendFormat("\"title\":\"{0}\",", rootDr["Title"]); //json.AppendFormat("\"ico\":\"{0}\",", rootDr["Ico"].ToString().IsNullOrEmpty() ? "" : Url.Content("~/" + rootDr["Ico"])); json.AppendFormat("\"ico\":\"{0}\",", "");//不加载设置的图标,图标主要是主页面使用。 json.AppendFormat("\"link\":\"{0}\",", rootDr["Address"]); json.AppendFormat("\"type\":\"{0}\",", "0"); json.AppendFormat("\"model\":\"{0}\",", rootDr["OpenMode"]); json.AppendFormat("\"width\":\"{0}\",", rootDr["Width"]); json.AppendFormat("\"height\":\"{0}\",", rootDr["Height"]); json.AppendFormat("\"hasChilds\":\"{0}\",", apps.Length > 0 ? "1" : "0"); json.AppendFormat("\"childs\":["); for (int i = 0; i < apps.Length; i++) { System.Data.DataRow dr = apps[i]; var childs = appDt.Select("ParentID='" + dr["ID"].ToString() + "'"); json.Append("{"); json.AppendFormat("\"id\":\"{0}\",", dr["ID"]); json.AppendFormat("\"title\":\"{0}\",", dr["Title"]); //json.AppendFormat("\"ico\":\"{0}\",", dr["Ico"].ToString().IsNullOrEmpty() ? "" : Url.Content("~/" + dr["Ico"])); json.AppendFormat("\"ico\":\"{0}\",", ""); //不加载设置的图标,图标主要是主页面使用。 json.AppendFormat("\"link\":\"{0}\",", dr["Address"]); json.AppendFormat("\"type\":\"{0}\",", "0"); json.AppendFormat("\"model\":\"{0}\",", dr["OpenMode"]); json.AppendFormat("\"width\":\"{0}\",", dr["Width"]); json.AppendFormat("\"height\":\"{0}\",", dr["Height"]); json.AppendFormat("\"hasChilds\":\"{0}\",", childs.Length > 0 ? "1" : "0"); json.AppendFormat("\"childs\":["); json.Append("]"); json.Append("}"); if (i < apps.Length - 1) { json.Append(","); } } json.Append("]"); json.Append("}"); json.Append("]"); return(json.ToString()); }
public ActionResult Body(FormCollection collection) { RoadFlow.Platform.AppLibraryBLL bappLibrary = new RoadFlow.Platform.AppLibraryBLL(); RoadFlow.Platform.RoleApp broleApp = new RoadFlow.Platform.RoleApp(); RoadFlow.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 (!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 = roleApp.Serialize(); roleApp.Title = name.Trim(); if (appid.IsGuid()) { roleApp.AppID = appid.Convert <Guid>(); } else { roleApp.AppID = null; } roleApp.Params = params1.IsNullOrEmpty() ? null : params1.Trim(); if (!ico.IsNullOrEmpty()) { roleApp.Ico = ico; } else { roleApp.Ico = null; } broleApp.Update(roleApp); broleApp.ClearAllDataTableCache(); RoadFlow.Platform.Log.Add("修改了应用模板", "", RoadFlow.Platform.Log.Types.角色应用, oldXML, roleApp.Serialize()); string refreshID = roleApp.ParentID == Guid.Empty ? roleApp.ID.ToString() : roleApp.ParentID.ToString(); ViewBag.Script = "parent.frames[0].reLoad('" + refreshID + "');alert('保存成功!');"; } if (!Request.Form["Delete"].IsNullOrEmpty()) { int i = broleApp.DeleteAndAllChilds(roleApp.ID); broleApp.ClearAllDataTableCache(); RoadFlow.Platform.Log.Add("删除了模板及其所有下级共" + i.ToString() + "项", roleApp.Serialize(), RoadFlow.Platform.Log.Types.角色应用); string refreshID = roleApp.ParentID == Guid.Empty ? roleApp.ID.ToString() : roleApp.ParentID.ToString(); ViewBag.Script = "parent.frames[0].reLoad('" + refreshID + "');window.location='Body?id=" + refreshID + "&appid=" + Request.QueryString["appid"] + "&tabid=" + Request.QueryString["tabid"] + "';"; } if (roleApp != null && roleApp.AppID.HasValue) { var app = new RoadFlow.Platform.AppLibraryBLL().Get(roleApp.AppID.Value); if (app != null) { type = app.Type.ToString(); } } ViewBag.AppTypesOptions = bappLibrary.GetTypeOptions(type); ViewBag.AppID = roleApp.AppID.ToString(); return(View(roleApp)); }
protected void Page_Load(object sender, EventArgs e) { RoadFlow.Platform.AppLibrary bappLibrary = new RoadFlow.Platform.AppLibrary(); RoadFlow.Platform.RoleApp broleApp = new RoadFlow.Platform.RoleApp(); 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 (IsPostBack) { 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 = roleApp.Serialize(); roleApp.Title = name.Trim(); if (appid.IsGuid()) { roleApp.AppID = appid.ToGuid(); } else { roleApp.AppID = null; } roleApp.Params = params1.IsNullOrEmpty() ? null : params1.Trim(); if (!ico.IsNullOrEmpty()) { roleApp.Ico = ico; } else { roleApp.Ico = null; } broleApp.Update(roleApp); broleApp.ClearAllDataTableCache(); RoadFlow.Platform.Log.Add("修改了应用模板", "", RoadFlow.Platform.Log.Types.角色应用, oldXML, roleApp.Serialize()); string refreshID = roleApp.ParentID == Guid.Empty ? roleApp.ID.ToString() : roleApp.ParentID.ToString(); Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "parent.frames[0].reLoad('" + refreshID + "');alert('保存成功!');", true); } if (!Request.Form["Delete"].IsNullOrEmpty()) { int i = broleApp.DeleteAndAllChilds(roleApp.ID); broleApp.ClearAllDataTableCache(); RoadFlow.Platform.Log.Add("删除了模板及其所有下级共" + i.ToString() + "项", roleApp.Serialize(), RoadFlow.Platform.Log.Types.角色应用); string refreshID = roleApp.ParentID == Guid.Empty ? roleApp.ID.ToString() : roleApp.ParentID.ToString(); Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "parent.frames[0].reLoad('" + refreshID + "');window.location='Body.aspx?id=" + refreshID + "&appid=" + Request.QueryString["appid"] + "&tabid=" + Request.QueryString["tabid"] + "';", true); } } if (roleApp != null && roleApp.AppID.HasValue) { var app = new RoadFlow.Platform.AppLibrary().Get(roleApp.AppID.Value); if (app != null) { type = app.Type.ToString(); } } if (roleApp != null) { this.Name.Value = roleApp.Title; this.Params.Value = roleApp.Params; this.Ico.Value = roleApp.Ico; } this.AppTypesOptions.Text = bappLibrary.GetTypeOptions(type); AppID = roleApp.AppID.ToString(); }
protected void Page_Load(object sender, EventArgs e) { query = "&id=" + Request.QueryString["id"] + "&appid=" + Request.QueryString["appid"] + "&roleid=" + Request.QueryString["roleid"] + "&userid=" + Request.QueryString["userid"]; RoadFlow.Platform.AppLibrary bappLibrary = new RoadFlow.Platform.AppLibrary(); RoadFlow.Platform.RoleApp broleApp = new RoadFlow.Platform.RoleApp(); RoadFlow.Platform.UsersApp buserApp = new RoadFlow.Platform.UsersApp(); RoadFlow.Data.Model.UsersApp usersApp = null; string id = Request.QueryString["id"]; 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; ParentID = usersApp.ParentID; } } if (IsPostBack && 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(); RoadFlow.Platform.Log.Add("修改了个人应用", "", RoadFlow.Platform.Log.Types.角色应用, oldXML, usersApp.Serialize()); string refreshID = usersApp.ParentID.ToString(); Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "alert('保存成功!'); parent.frames[0].reLoad('" + refreshID + "')", true); } if (!Request.Form["Delete"].IsNullOrEmpty()) { int i = buserApp.DeleteAndAllChilds(usersApp.ID); buserApp.ClearCache(); RoadFlow.Platform.Log.Add("删除了个人应用", usersApp.Serialize(), RoadFlow.Platform.Log.Types.角色应用); string refreshID = usersApp.ParentID.ToString(); var parent = buserApp.Get(usersApp.ParentID); string page = parent == null ? "Body.aspx" : "Body1.aspx"; Page.ClientScript.RegisterStartupScript(Page.GetType(), "ok", "parent.frames[0].reLoad('" + refreshID + "');window.location='" + page + "?id=" + refreshID + "&appid=" + Request.QueryString["appid"] + "&tabid=" + Request.QueryString["tabid"] + "&userid=" + Request.QueryString["userid"] + "';", true); } } AppID = appid; AppTypesOptions = bappLibrary.GetTypeOptions(type); }
/// <summary> /// 得到角色应用JSON /// </summary> /// <param name="roleID"></param> /// <returns></returns> public string GetRoleAppJsonString(Guid roleID, Guid userID, string rootDir = "") { RoleApp RoleApp = new RoadFlow.Platform.RoleApp(); UsersApp UsersApp = new Platform.UsersApp(); AppLibrary Applibary = new AppLibrary(); System.Data.DataTable roleAppDt = RoleApp.GetAllDataTableFromCache(); System.Data.DataTable appDt = CloneDataTable(roleAppDt); UsersApp.AppendUserApps(userID, appDt); if (appDt.Rows.Count == 0) { return("[]"); } var root = appDt.Select(string.Format("ParentID='{0}' AND RoleID='{1}'", Guid.Empty.ToString(), roleID)); if (root.Length == 0) { return("[]"); } var apps = appDt.Select(string.Format("ParentID='{0}'", root[0]["ID"].ToString())); System.Text.StringBuilder json = new System.Text.StringBuilder("[", 1000); System.Data.DataRow rootDr = root[0]; json.Append("{"); json.AppendFormat("\"id\":\"{0}\",", rootDr["ID"].ToString()); json.AppendFormat("\"title\":\"{0}\",", rootDr["Title"].ToString().Trim()); json.AppendFormat("\"ico\":\"{0}\",", rootDr["Ico"].ToString().IsNullOrEmpty() ? "" : rootDir + rootDr["Ico"].ToString()); json.AppendFormat("\"link\":\"{0}\",", getAddress(rootDr).ToString()); json.AppendFormat("\"model\":\"{0}\",", rootDr["OpenMode"].ToString()); json.AppendFormat("\"width\":\"{0}\",", rootDr["Width"].ToString()); json.AppendFormat("\"height\":\"{0}\",", rootDr["Height"].ToString()); json.AppendFormat("\"hasChilds\":\"{0}\",", apps.Length > 0 ? "1" : "0"); json.AppendFormat("\"childs\":["); for (int i = 0; i < apps.Length; i++) { DataRow dr = apps[i]; if (!dr["UseMember"].ToString().IsNullOrEmpty() && dr["AppID"].ToString().IsGuid() && !Applibary.GetUseMemberCache(dr["AppID"].ToString().ToGuid()).Contains(userID)) { continue; } var childs = appDt.Select("ParentID='" + dr["ID"].ToString() + "'"); json.Append("{"); json.AppendFormat("\"id\":\"{0}\",", dr["ID"].ToString()); json.AppendFormat("\"title\":\"{0}\",", dr["Title"].ToString()); json.AppendFormat("\"ico\":\"{0}\",", dr["Ico"].ToString().IsNullOrEmpty() ? "" : rootDir + dr["Ico"].ToString()); json.AppendFormat("\"link\":\"{0}\",", getAddress(dr)); json.AppendFormat("\"model\":\"{0}\",", dr["OpenMode"].ToString()); json.AppendFormat("\"width\":\"{0}\",", dr["Width"].ToString()); json.AppendFormat("\"height\":\"{0}\",", dr["Height"].ToString()); json.AppendFormat("\"hasChilds\":\"{0}\",", childs.Length > 0 ? "1" : "0"); json.AppendFormat("\"childs\":["); /* DataRow[] apps1 = appDt.Select(string.Format("ParentID='{0}'", dr["ID"].ToString())); * for (int j = 0; j < apps1.Length; j++) * { * DataRow dr1 = apps1[j]; * var childs1 = appDt.Select("ParentID='" + dr1["ID"].ToString() + "'"); * json.Append("{"); * json.AppendFormat("\"id\":\"{0}\",", dr1["ID"]); * json.AppendFormat("\"title\":\"{0}\",", dr1["Title"]); * json.AppendFormat("\"ico\":\"{0}\",", dr1["Ico"].ToString().IsNullOrEmpty() ? "" : rootDir + dr1["Ico"]); * json.AppendFormat("\"link\":\"{0}\",", getAddress(dr1)); * json.AppendFormat("\"model\":\"{0}\",", dr1["OpenMode"]); * json.AppendFormat("\"width\":\"{0}\",", dr1["Width"]); * json.AppendFormat("\"height\":\"{0}\",", dr1["Height"]); * json.AppendFormat("\"hasChilds\":\"{0}\",", childs1.Length > 0 ? "1" : "0"); * json.AppendFormat("\"childs\":["); * json.Append("]"); * json.Append("}"); * if (j < apps1.Length - 1) * { * json.Append(","); * } * }*/ json.Append("]"); json.Append("}"); if (dr["ID"].ToString() != apps[apps.Length - 1]["ID"].ToString()) { json.Append(","); } } json.Append("]"); json.Append("}"); json.Append("]"); return(json.ToString()); }
public void ProcessRequest(HttpContext context) { context.Response.ContentType = "text/plain"; string roleID = context.Request.QueryString["roleid"]; Guid roleGuid; if (!roleID.IsGuid(out roleGuid)) { context.Response.Write("[]"); return; } RoadFlow.Platform.RoleApp BRoleApp = new RoadFlow.Platform.RoleApp(); var appDt = BRoleApp.GetAllDataTableByRoleID(roleGuid); if (appDt.Rows.Count == 0) { context.Response.Write("[]"); return; } var root = appDt.Select("ParentID='" + Guid.Empty.ToString() + "'"); if (root.Length == 0) { context.Response.Write("[]"); return; } var apps = appDt.Select("ParentID='" + root[0]["ID"].ToString() + "'"); StringBuilder json = new StringBuilder("[", 1000); System.Data.DataRow rootDr = root[0]; json.Append("{"); json.AppendFormat("\"id\":\"{0}\",", rootDr["ID"]); json.AppendFormat("\"title\":\"{0}\",", rootDr["Title"]); json.AppendFormat("\"ico\":\"{0}\",", rootDr["Ico"].ToString().IsNullOrEmpty() ? "" : Common.Tools.BaseUrl + rootDr["Ico"].ToString()); json.AppendFormat("\"link\":\"{0}\",", rootDr["Address"]); json.AppendFormat("\"type\":\"{0}\",", "0"); json.AppendFormat("\"model\":\"{0}\",", rootDr["OpenMode"]); json.AppendFormat("\"width\":\"{0}\",", rootDr["Width"]); json.AppendFormat("\"height\":\"{0}\",", rootDr["Height"]); json.AppendFormat("\"hasChilds\":\"{0}\",", apps.Length > 0 ? "1" : "0"); json.AppendFormat("\"childs\":["); for (int i = 0; i < apps.Length; i++) { System.Data.DataRow dr = apps[i]; var childs = appDt.Select("ParentID='" + dr["ID"].ToString() + "'"); json.Append("{"); json.AppendFormat("\"id\":\"{0}\",", dr["ID"]); json.AppendFormat("\"title\":\"{0}\",", dr["Title"]); json.AppendFormat("\"ico\":\"{0}\",", dr["Ico"].ToString().IsNullOrEmpty() ? "" : Common.Tools.BaseUrl + dr["Ico"].ToString()); json.AppendFormat("\"link\":\"{0}\",", dr["Address"]); json.AppendFormat("\"type\":\"{0}\",", "0"); json.AppendFormat("\"model\":\"{0}\",", dr["OpenMode"]); json.AppendFormat("\"width\":\"{0}\",", dr["Width"]); json.AppendFormat("\"height\":\"{0}\",", dr["Height"]); json.AppendFormat("\"hasChilds\":\"{0}\",", childs.Length > 0 ? "1" : "0"); json.AppendFormat("\"childs\":["); json.Append("]"); json.Append("}"); if (i < apps.Length - 1) { json.Append(","); } } json.Append("]"); json.Append("}"); json.Append("]"); context.Response.Write(json.ToString()); }
public ActionResult Body1(FormCollection collection) { RoadFlow.Platform.AppLibraryBLL bappLibrary = new RoadFlow.Platform.AppLibraryBLL(); RoadFlow.Platform.RoleApp broleApp = new RoadFlow.Platform.RoleApp(); RoadFlow.Platform.UsersApp buserApp = new RoadFlow.Platform.UsersApp(); RoadFlow.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.Convert <Guid>(); } 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(); RoadFlow.Platform.Log.Add("修改了个人应用", "", RoadFlow.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(); RoadFlow.Platform.Log.Add("删除了个人应用", usersApp.Serialize(), RoadFlow.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 RoadFlow.Data.Model.UsersApp() : usersApp)); }