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.
		
		
		
		
			
				
					208 lines
				
				5.7 KiB
			
		
		
			
		
	
	
					208 lines
				
				5.7 KiB
			| 
								 
											2 years ago
										 
									 | 
							
								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 
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								}
							 |