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.
207 lines
5.7 KiB
207 lines
5.7 KiB
using System;
|
|
using System.Text;
|
|
using System.Web.UI.WebControls;
|
|
using System.Web.UI;
|
|
using WebBase;
|
|
namespace System.Web.UI
|
|
{
|
|
///<summary>
|
|
///<b><font color="#316563">[模块名称]</font></b> the base of Page<br>
|
|
///<remarks>
|
|
///----------------------------------------------------------------------<br>
|
|
///<b><font color="#316563">[作者]</font></b> 黄文发 <br>
|
|
///<b><font color="#316563">[日期]</font></b> <br>
|
|
///<b><font color="#316563">[审 核 者]</font></b> <br>
|
|
///<b><font color="#316563">[审核日期]</font></b> <br>
|
|
///----------------------------------------------------------------------<br>
|
|
///<b><font color="#316563">[修改历史]</font></b> <br>
|
|
///<b><font color="#FF0000">[BUG]</font></b> <br>
|
|
///黄文发 Initial creation <br>
|
|
///----------------------------------------------------------------------<br>
|
|
///</remarks>
|
|
///</summary>
|
|
public class PageEx:Page
|
|
{
|
|
#region Action
|
|
/// <summary>
|
|
/// 动作类型
|
|
/// </summary>
|
|
public string Action
|
|
{
|
|
get
|
|
{
|
|
return Convert.ToString(ViewState["Action"]);
|
|
}
|
|
set
|
|
{
|
|
ViewState["Action"] = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region PK
|
|
/// <summary>
|
|
/// 动作类型
|
|
/// </summary>
|
|
public string PK
|
|
{
|
|
get
|
|
{
|
|
return Convert.ToString(ViewState["PK"]);
|
|
}
|
|
set
|
|
{
|
|
ViewState["PK"] = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
#region Privlege
|
|
/// <summary>
|
|
/// 权限
|
|
/// </summary>
|
|
public string Privlege
|
|
{
|
|
get
|
|
{
|
|
return Convert.ToString(ViewState["Privlege"]);
|
|
}
|
|
set
|
|
{
|
|
ViewState["Privlege"] = value;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 判断是否有权限执行
|
|
/// </summary>
|
|
/// <param name="pb"></param>
|
|
/// <returns></returns>
|
|
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 模式
|
|
/// <summary>
|
|
/// 设置为编辑模式
|
|
/// </summary>
|
|
protected virtual void SetEditModel()
|
|
{
|
|
}
|
|
/// <summary>
|
|
/// 设置为查询模式
|
|
/// </summary>
|
|
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("<font color='red'>", "").Replace("</font>", "").Replace("<b>", "").Replace("</b>", "");
|
|
|
|
ClientScript.RegisterStartupScript(this.GetType(), "alertScript", "alert('" + msg + "');", true);
|
|
}
|
|
public void MessageBox(string msg, string url)
|
|
{
|
|
msg = msg.Replace("<font color='red'>", "").Replace("</font>", "").Replace("<b>", "").Replace("</b>", "");
|
|
|
|
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
|
|
}
|
|
|
|
|
|
}
|
|
|