Beispiel #1
0
        /// <summary>
        /// Get logged user.
        /// </summary>
        /// <returns></returns>
        public UserModel GetLoggedUser()
        {
            var LoggedUser = new UserModel();

            var User = _loggedUserServices.GetLoggedUser();

            if (!User.Enabled)
            {
                return(null);
            }

            LoggedUser.ID          = User.ID;
            LoggedUser.Username    = User.Username;
            LoggedUser.FirstName   = User.FirstName;
            LoggedUser.LastName    = User.LastName;
            LoggedUser.CompanyName = User.CompanyName;
            LoggedUser.Email       = User.Email;
            LoggedUser.TimeZone    = User.TimeZone;
            LoggedUser.Role        = User.Roles_Users.Select(s => (enRole)s.Roles.IdRole).FirstOrDefault();
            LoggedUser.Language    = User.Languages != null ? new LanguagesModel {
                DotNetCulture    = User.Languages.DotNetCulture,
                ID               = User.Languages.ID,
                IdLanguage       = User.Languages.IdLanguage,
                InitialsLanguage = User.Languages.InitialsLanguage,
                Name             = User.Languages.Name
            } : null;
            LoggedUser.LastDateUpdatePassword = User.LastDateUpdatePassword;
            LoggedUser.TimeZone = User.TimeZone;
            return(LoggedUser);
        }
Beispiel #2
0
        public bool IsFirstLogin()
        {
            var user     = _loggedUserServices.GetLoggedUser();
            var realUser = _userService.GetUser(user.Username);

            return(realUser.LastDateUpdatePassword == null);
        }