using System; using System.Collections.Generic; namespace Model { [Serializable] public class SysUser : ISessionObject { public int UserID { get; set; } public string Account { get; set; } public string Password { get; set; } public string Salt { get; set; } //加密盐 public string UserName { get; set; } public DateTime ExpireTime { get; set; } public DateTime CreateTime { get; set; } public string Remark { get; set; } public string Mobile { get; set; } public int MobileFlag { get; set; } public string Email { get; set; } public int EmailFlag { get; set; } public string WxData { get; set; } public int IsEncryption { get; set; } public int IsVerification { get; set; } public string ClientIp { get; set; } public int Status { get; set; } //public int UserType { get; set; } //用户类型:1-管理员;2-业务员--全员;3-业务主管;4-业务总监;5-客服人员;6-财务人员;99-其他 public string UserType { get; set; } //关联字典数据表的类型为:USER_ROLE。多个角色时以半角“,”分隔。 public Dictionary MenuIDList { get; set; } public bool HasRight(string code) { if (this.UserID == 1 && code.StartsWith("104")) return true; if (this.MenuIDList == null) return false; return this.MenuIDList.ContainsKey(code); } public bool ContainsTargetID(string menuID, string targetID) { SysUserMenu sysUserMenu; if (this.MenuIDList == null || !this.MenuIDList.TryGetValue(menuID, out sysUserMenu)) return false; return sysUserMenu.ContainsTargetID(targetID); } public string[] GetSubMenuArray(string menuID) { SysUserMenu sysUserMenu; if (this.MenuIDList == null || !this.MenuIDList.TryGetValue(menuID, out sysUserMenu)) return new string[0]; return sysUserMenu.SubMenuArray; } } }