Exemplo n.º 1
0
        /// <summary>
        /// 登录时,获取指定人员信息
        /// </summary>
        /// <param name="base_UserInfo"></param>
        /// <returns></returns>
        public Base_UserInfo Login(Base_UserInfo base_UserInfo)
        {
            var temp = this.LoadEntities(u => u.UserName == base_UserInfo.UserName &&
                                         u.UserPwd == base_UserInfo.UserPwd && u.DelFlag == 0).FirstOrDefault();

            if (temp == null)
            {
                return(null);
            }
            Base_UserRoleInfoService base_UserRoleInfoService = new Base_UserRoleInfoService();
            Base_RolesInfoService    base_RolesInfoService    = new Base_RolesInfoService();
            var curPerRoles = from ur in base_UserRoleInfoService.LoadEntities(ur => true)
                              join r in base_RolesInfoService.LoadEntities(r => r.DelFlag == 0) on ur.RoleId equals r.Id
                              where ur.UserId == temp.Id
                              select r;

            if (curPerRoles != null)
            {
                temp.RoleList = curPerRoles.ToList();
            }
            else
            {
                temp.RoleList = new List <Base_RolesInfo>();
            }
            return(temp);
        }