private void Bind() { Mod_AdminRole dto = new Mod_AdminRole(); if (id != 0) { dto = BAdmin_Role.GetModel(id); if (dto != null) { txtRoleName.Text = dto.RoleName; rblState.SelectedValue = dto.State.ToString(); BindColumn(dto.RoleKey, dto.WebSiteIDStr); } else { MessageBox.ShowRedirect(this, "信息已删除或不存在!", "Column/Admin_Role/List.aspx?" + StringHelper.DelUrlParameter("ID")); } } else { BindColumn("", ""); } }
private void MenuBind() { if (AdminManage.RoleID == 10001) { MAdmin_MenuList = BAdmin_Menu.GetModelList(" State=1 and WebSiteID=" + AdminManage.WebSiteID + " Order By OrderBy asc,ID asc "); rptMenuRootTopList.DataSource = MAdmin_MenuList.Where(m => m.ParentID == 0); rptMenuRootTopList.DataBind(); } else { Mod_AdminRole MAdmin_Role = BAdmin_Role.GetModel(AdminManage.RoleID); if (MAdmin_Role != null && !string.IsNullOrEmpty(MAdmin_Role.RoleKey)) { MAdmin_MenuList = BAdmin_Menu.GetModelList(" State=1 and WebSiteID=" + AdminManage.WebSiteID + " and ID in(" + MAdmin_Role.RoleKey + ") Order By OrderBy asc,ID asc "); rptMenuRootTopList.DataSource = MAdmin_MenuList.Where(m => m.ParentID == 0); rptMenuRootTopList.DataBind(); } } }
//获取站点 private void GetWebSite() { if (AdminManage.RoleID == 10001) { Bll_AdminWebSite BWebSite = new Bll_AdminWebSite(); rptWebSiteList.DataSource = BWebSite.GetList(0, " State=1 ", " OrderBy desc "); rptWebSiteList.DataBind(); } else { Bll_AdminRole BAdmin_Role = new Bll_AdminRole(); Mod_AdminRole MAdmin_Role = BAdmin_Role.GetModel(AdminManage.RoleID); if (MAdmin_Role != null && MAdmin_Role.WebSiteIDStr != "") { Bll_AdminWebSite BWebSite = new Bll_AdminWebSite(); rptWebSiteList.DataSource = BWebSite.GetList(0, " ID in(" + MAdmin_Role.WebSiteIDStr + ") and State=1 ", " OrderBy desc "); rptWebSiteList.DataBind(); } } }
/// <summary> /// 获取类别名称 /// </summary> /// <param name="TypeID">类别id</param> /// <returns>类别名称</returns> public static string GetRoleName(object RoleID) { if (StringHelper.IsNumberId(RoleID.ToString())) { Bll_AdminRole BAdmin_Role = new Bll_AdminRole(); Mod_AdminRole MAdmin_Role = new Mod_AdminRole(); MAdmin_Role = BAdmin_Role.GetModel(int.Parse(RoleID.ToString())); if (MAdmin_Role != null) { return(MAdmin_Role.RoleName); } else { return(""); } } else { return(""); } }