From 37080f5d0add35dc528212ece83adff1db6c50ee Mon Sep 17 00:00:00 2001 From: wzp <2880584989@qq.com> Date: 星期四, 16 九月 2021 15:54:27 +0800 Subject: [PATCH] 更新 --- web/Model/PageContext.cs | 102 +++++++++++++++++++++++++------------------------- 1 files changed, 51 insertions(+), 51 deletions(-) diff --git a/web/Model/PageContext.cs b/web/Model/PageContext.cs index d1e63c1..e8e87a8 100644 --- a/web/Model/PageContext.cs +++ b/web/Model/PageContext.cs @@ -1,73 +1,73 @@ -锘� +锘� using Common; using System; using System.Web; public class PageContext<T> : HandlerContext where T : ISessionObject { - public bool IsValid - { - get + public bool IsValid { - return (object) this.SessionObject != null; + get + { + return (object)this.SessionObject != null; + } } - } - public T SessionObject - { - get + public T SessionObject { - return (T) this.Context.Session["SO"]; + get + { + return (T)this.Context.Session["SO"]; + } + set + { + this.Context.Session["SO"] = (object)value; + } } - set + + public string OperatorID { - this.Context.Session["SO"] = (object) value; + get + { + return this.SessionObject.Account; + } } - } - public string OperatorID - { - get + public PageContext(HttpContext context) + : base(context) { - return this.SessionObject.Account; } - } - public PageContext(HttpContext context) - : base(context) - { - } + public void Reset() + { + this.SessionObject = default(T); + this.Session.Abandon(); + } - public void Reset() - { - this.SessionObject = default (T); - this.Session.Abandon(); - } + public void CheckRight(string functionID, FailedOperation failedOperation) + { + if (!this.IsValid) + throw new InvalidOperationException("浼氳瘽瓒呮椂锛岃閲嶆柊鐧诲綍锛�"); + if (!this.HasRight(functionID)) + throw new InvalidOperationException("鎮ㄥ綋鍓嶆棤鏉冮檺璁块棶姝ゅ姛鑳斤紝璇蜂笌绠$悊鍛樼‘璁わ紒"); + } - public void CheckRight(string functionID, FailedOperation failedOperation) - { - if (!this.IsValid) - throw new InvalidOperationException("浼氳瘽瓒呮椂锛岃閲嶆柊鐧诲綍锛�"); - if (!this.HasRight(functionID)) - throw new InvalidOperationException("鎮ㄥ綋鍓嶆棤鏉冮檺璁块棶姝ゅ姛鑳斤紝璇蜂笌绠$悊鍛樼‘璁わ紒"); - } + public bool HasRight(string functionID) + { + if (!this.IsValid) + return false; + return this.SessionObject.HasRight(functionID); + } - public bool HasRight(string functionID) - { - if (!this.IsValid) - return false; - return this.SessionObject.HasRight(functionID); - } + public bool ContainsTargetID(string functionID, string targetID) + { + if (!this.IsValid) + return false; + return this.SessionObject.ContainsTargetID(functionID, targetID); + } - public bool ContainsTargetID(string functionID, string targetID) - { - if (!this.IsValid) - return false; - return this.SessionObject.ContainsTargetID(functionID, targetID); - } - - public string[] GetSubMenuArray(string functionID) - { - return this.SessionObject.GetSubMenuArray(functionID); - } + public string[] GetSubMenuArray(string functionID) + { + return this.SessionObject.GetSubMenuArray(functionID); + } } -- Gitblit v1.9.1