using System;
using System.Text;
using System.Web.UI.WebControls;
using System.Web.UI;
using WebBase;
namespace System.Web.UI
{
///
///[模块名称] the base of Page
///
///----------------------------------------------------------------------
///[作者] 黄文发
///[日期]
///[审 核 者]
///[审核日期]
///----------------------------------------------------------------------
///[修改历史]
///[BUG]
///黄文发 Initial creation
///----------------------------------------------------------------------
///
///
public class PageEx:Page
{
#region Action
///
/// 动作类型
///
public string Action
{
get
{
return Convert.ToString(ViewState["Action"]);
}
set
{
ViewState["Action"] = value;
}
}
#endregion
#region PK
///
/// 动作类型
///
public string PK
{
get
{
return Convert.ToString(ViewState["PK"]);
}
set
{
ViewState["PK"] = value;
}
}
#endregion
#region Privlege
///
/// 权限
///
public string Privlege
{
get
{
return Convert.ToString(ViewState["Privlege"]);
}
set
{
ViewState["Privlege"] = value;
}
}
///
/// 判断是否有权限执行
///
///
///
public bool GetPrivlege(PrivlegeEnums pb)
{
string privlege = Convert.ToString(ViewState["Privlege"]);
if (privlege.Length > (int)pb && privlege[(int)pb] == '0')
return false;
else
return true;
}
#endregion
#region 模式
///
/// 设置为编辑模式
///
protected virtual void SetEditModel()
{
}
///
/// 设置为查询模式
///
protected virtual void SetFindModel()
{
}
#endregion
#region UserId
public int UserId
{
get
{
int i = -1;
if (Session["UserId"] != null && int.TryParse(Convert.ToString(Session["UserId"]), out i) == true)
return i;
else
return -1;
}
set
{
Session["UserId"] = value;
}
}
#endregion
#region RoleId
public int RoleId
{
get
{
int i = -1;
if (Session["RoleId"] != null && int.TryParse(Convert.ToString(Session["RoleId"]), out i) == true)
return i;
else
return -1;
}
set
{
Session["RoleId"] = value;
}
}
#endregion
#region TopMenuId
public int TopMenuId
{
get
{
int i = 0;
if (Session["TopMenuId"] != null && int.TryParse(Convert.ToString(Session["TopMenuId"]), out i) == true)
return i;
else
return 0;
}
set
{
Session["TopMenuId"] = value;
}
}
#endregion
#region Nav
public string Nav
{
get
{
Literal ltNav = Page.Master.FindControl("ltNav") as Literal;
if (ltNav != null)
return ltNav.Text;
else
return "";
}
set
{
if (Page.Master != null)
{
Literal ltNav = Page.Master.FindControl("ltNav") as Literal;
if (ltNav != null)
ltNav.Text = " >> " + value;
}
else
{
Literal ltNav = Page.FindControl("ltNav") as Literal;
if (ltNav != null)
ltNav.Text = " >> " + value;
}
}
}
#endregion
#region MessageBox
public void MessageBox(string msg)
{
msg = msg.Replace("", "").Replace("", "").Replace("", "").Replace("", "");
ClientScript.RegisterStartupScript(this.GetType(), "alertScript", "alert('" + msg + "');", true);
}
public void MessageBox(string msg, string url)
{
msg = msg.Replace("", "").Replace("", "").Replace("", "").Replace("", "");
ClientScript.RegisterStartupScript(this.GetType(), "alertScript", "alert('" + msg + "');location.href='" + url + "'", true);
}
protected void MessageBoxException(Exception ex)
{
ClientScript.RegisterStartupScript(this.GetType(), "alertScript", "alert('" + ex.Message + "');", true);
}
#endregion
}
}