Beispiel #1
0
 public MainAgentBll(System.Web.HttpContext context, LoginAgentUser loginAgentUser)
 {
     this.context        = context;
     this.loginAgentUser = loginAgentUser;
 }
Beispiel #2
0
        /// <summary>
        /// 实例化用户类并获取用户信息
        /// </summary>
        public LoginAgentUser(System.Web.HttpContext context, string moduleCode)
        {
            try
            {
                LoginAgentUser user = (LoginAgentUser)context.Session["clientUser"];
                this.userId  = user.userId;
                this.roleIds = user.roleIds;
                string roleTypeById = new  TSAgentRoleDAO().Get(user.roleIds).type;
                this.roleType = roleTypeById;
                if (roleTypeById == "0")//代理商
                {
                    this.userName  = new  TBAgentDAO().Get(user.userId).agentName;
                    this.agentId   = user.userId;
                    this.agentName = userName;
                    this.siteId    = "无";
                    this.siteName  = "无";
                }
                else //员工
                {
                    TBStaff tbStaff = new TBStaffDAO().Get(user.userId);
                    this.userName = tbStaff.staffName;
                    this.siteId   = tbStaff.siteId;
                    TBSite tbSite = new TBSiteDAO().Get(tbStaff.siteId);
                    this.siteName  = tbSite.siteName;
                    this.agentId   = tbSite.agentId;
                    this.agentName = new TBAgentDAO().Get(tbSite.agentId).agentName;
                }
                this.moduleRight = user.moduleRight;
            }
            catch
            {
                Message.right(context, "登录已过期,请重新登录");
                this.pass = false;
                return;
            }

            if (this.userId == null)
            {
                Message.right(context, "登录已过期,请重新登录");
                this.pass = false;
                return;
            }
            else if (moduleCode != null && !moduleCode.Equals(""))
            {
                if (this.moduleRight.ContainsKey(moduleCode))
                {
                    this.moduleName = (string)this.moduleRight[moduleCode];
                }
                else
                {
                    Message.right(context, "对不起,您无此模块使用权限");
                    this.pass = false;
                    return;
                }
            }
            else
            {
                this.moduleName = "系统主界面";
            }
            this.pass = true;
        }