Exemplo n.º 1
0
 /// <summary>
 /// 获取角色ID列表
 /// </summary>
 public static string GetRoleIDList(Yo_User user)
 {
     if (user == null)
     {
         return("");
     }
     else
     {
         return(user.RoleIDList.Trim(','));
     }
 }
Exemplo n.º 2
0
 protected override void OnInit(EventArgs e)
 {
     base.OnInit(e);
     if (!string.IsNullOrEmpty(Tool.CookieGet("YoUserID")))
     {
         MyUser = Yo_UserBLL.GetModel(Convert.ToInt32(Tool.CookieGet("YoUserID")));
         if (MyUser.IsLock)
         {
             Response.Redirect("~/LogOut.aspx");
         }
     }
     else
     {
         Response.Redirect("~/Login.aspx");
     }
 }
Exemplo n.º 3
0
    public void ProcessRequest(HttpContext context)
    {
        context.Response.ContentType = "text/plain";

        // 反射方法
        string cmd = context.Request["cmd"];

        if (!string.IsNullOrEmpty(cmd))
        {
            if (cmd != "LoginUser")
            {
                if (!string.IsNullOrEmpty(Tool.CookieGet("YoUserID")))
                {
                    MyUser = Yo_UserBLL.GetModel(Convert.ToInt32(Tool.CookieGet("YoUserID")));
                    if (MyUser.IsLock)
                    {
                        context.Response.Write("{\"flag\":\"false\",\"msg\":\"用户被锁定。\"}");
                        return;
                    }
                }
                else
                {
                    context.Response.Write("{\"flag\":\"false\",\"msg\":\"未登录\"}");
                    return;
                }
            }
            System.Reflection.MethodInfo Remethod = this.GetType().GetMethod(cmd);
            if (Remethod != null)
            {
                Remethod.Invoke(this, new object[] { context });
            }
        }
        else
        {
            context.Response.Write("{\"flag\":\"false\",\"msg\":\"非法操作\"}");
        }
    }
Exemplo n.º 4
0
        /// <summary>
        /// 获取权限ID列表
        /// </summary>
        public static string GetJurisdictionIDList(Yo_User user)
        {
            if (GetRoleIDList(user) == "")
            {
                return("");
            }

            List <Yo_Role> rList = Yo_RoleBLL.GetModelList("ID in (" + GetRoleIDList(user) + ")");

            string result = "";

            if (rList.Count <= 0)
            {
                return(result);
            }
            else
            {
                foreach (Yo_Role rItem in rList)
                {
                    result += "," + rItem.JurisdictionIDList.Trim(',');
                }
                return(result.Trim(','));
            }
        }