You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
64 lines
1.9 KiB
64 lines
1.9 KiB
using System;
|
|
using System.Data;
|
|
using System.Configuration;
|
|
using System.Collections;
|
|
using System.Web;
|
|
using System.Web.Security;
|
|
using System.Web.UI;
|
|
using System.Web.UI.WebControls;
|
|
using System.Web.UI.WebControls.WebParts;
|
|
using System.Web.UI.HtmlControls;
|
|
using System.Text;
|
|
using Dal;
|
|
public partial class UC_TopUc : System.Web.UI.UserControl
|
|
{
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
if (hfNonLogin.Value != "1" && Page is PageEx)
|
|
{
|
|
int roleId = (Page as PageEx).RoleId;
|
|
if (roleId > 0 && (Page as PageEx).UserId > 0)
|
|
{
|
|
StringBuilder sbTopMenus = new StringBuilder();
|
|
|
|
//从数据库中获取
|
|
DataSet dsTopMenu = MenusDal.Select("upmenuid=0");
|
|
if (SqlHelper.HasRow(dsTopMenu))
|
|
{
|
|
foreach (DataRow dr in dsTopMenu.Tables[0].Rows)
|
|
{
|
|
Model.Menus menus = new Model.Menus(dr);
|
|
|
|
string strMenu = string.Format("<a href='{0}' class='menu_off'>{1}</a>", menus.Url, menus.Text);
|
|
sbTopMenus.Append(strMenu);
|
|
}
|
|
}
|
|
|
|
litMenu.Text = sbTopMenus.ToString();
|
|
}
|
|
else
|
|
{
|
|
Response.Redirect("~/login.aspx");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
public void SetNoLoginLayout()
|
|
{
|
|
litMenu.Visible = false;
|
|
panNav.Visible = false;
|
|
hfNonLogin.Value = "1";
|
|
}
|
|
protected void lbtnExit_Click(object sender, EventArgs e)
|
|
{
|
|
if (Page is PageEx)
|
|
{
|
|
(Page as PageEx).UserId = 0;
|
|
(Page as PageEx).RoleId = 0;
|
|
}
|
|
Response.Redirect("~/Login.aspx");
|
|
}
|
|
}
|
|
|