Exemplo n.º 1
0
 private async void FillSkills()
 {
     using (var _database = new ITManagerEntities())
     {
         Skills = new ObservableCollection <Models.UserPageModel.ProfessionalSkill>(Mapper.Map <IList <ProfessionalSkill>, IList <Models.UserPageModel.ProfessionalSkill> >(await _database.ProfessionalSkills.ToListAsync()));
     }
 }
Exemplo n.º 2
0
        private void AddSkillMethod(string skillName)
        {
            string errors = null;

            if (IsValid(ValidatesProperties, out errors))
            {
                Errors = errors;
                using (var _database = new ITManagerEntities())
                {
                    if (!_database.ProfessionalSkills.Any(s => s.Name == SkillName) && !Skills.Any(s => s.Name == SkillName))
                    {
                        Skills.Add(new Models.UserPageModel.ProfessionalSkill
                        {
                            Name = skillName
                        });
                    }
                    else
                    {
                        Errors = "This skill is already exists.";
                    }
                }
            }
            else
            {
                Errors = errors;
            }

            Errors = Errors?.Trim();
        }
Exemplo n.º 3
0
        private async void SaveQueryMethod()
        {
            if (SelectedProjects == null)
            {
                SelectedProjects = new ObservableCollection <Models.ProjectsManagementPageModels.Project>();
            }
            if (QueryDescription.Length > 1 && QueryDescription.Length < 100)
            {
                var skillsQuery    = string.Join(",", SkillsConditions?.Select(s => $"{s.Skill.Id}:{s.From.Id}-{s.To.Id}"));
                var languagesQuery = string.Join(",", LanguagesConditions?.Select(l => $"{l.Language.Id}:{l.From.Id}-{l.To.Id}"));
                var projectsQuery  = string.Join(",", SelectedProjects?.Select(p => p.Id));

                var query = $"{skillsQuery}&{languagesQuery}&{projectsQuery}";

                using (var _database = new ITManagerEntities())
                {
                    var user = await _database.Users.Where(u => u.Id == ShellViewModel.CurrentUserId)
                               .Include(u => u.Queries).FirstOrDefaultAsync();

                    user.Queries.Add(new Query()
                    {
                        Description = QueryDescription,
                        QueryString = query,
                        UserId      = ShellViewModel.CurrentUserId
                    });
                    await _database.SaveChangesAsync();
                }
                _eventAggregator.GetEvent <UpdateQueriesEvent>().Publish();
                QueryErrors = string.Empty;
            }
            else
            {
                QueryErrors = "Query description length must be from 1 to 100 sybmols.";
            }
        }
Exemplo n.º 4
0
 private async void FillProjects()
 {
     using (var _database = new ITManagerEntities())
     {
         Projects = new ObservableCollection <Models.ProjectsManagementPageModels.Project>(
             Mapper.Map <IList <Project>, IList <Models.ProjectsManagementPageModels.Project> >(await _database.Projects.ToListAsync()));
     }
 }
 private async void Init()
 {
     using (var _database = new ITManagerEntities())
     {
         Users = new ObservableCollection <User>(_database.Users.Where(u => u.UserRoles.FirstOrDefault().RoleId != Constants.AdministratorRole &&
                                                                       u.UserRoles.FirstOrDefault().RoleId != Constants.ManagerRole &&
                                                                       u.IsActive));
     }
 }
        private async void Init()
        {
            using (var _database = new ITManagerEntities())
            {
                var user = await _database.Users.Where(u => u.Id == ShellViewModel.CurrentUserId)
                           .Include(u => u.Queries).FirstOrDefaultAsync();

                Queries = new ObservableCollection <Query>(user.Queries);
            }
        }
Exemplo n.º 7
0
 private async void MapLanguages()
 {
     Languages = Mapper.Map <ICollection <Language>, ObservableCollection <Models.UserPageModel.Language> >(User.Languages);
     using (var _database = new ITManagerEntities())
     {
         foreach (var language in Languages)
         {
             language.RelatedLanguage = await _database.LanguagesLists.Where(l => l.Id == language.LanguageId).FirstOrDefaultAsync();
         }
     }
 }
Exemplo n.º 8
0
 private async void MapProjects()
 {
     Projects = Mapper.Map <ICollection <UserProject>, ObservableCollection <Models.UserPageModel.Project> >(User.UserProjects);
     using (var _database = new ITManagerEntities())
     {
         foreach (var project in Projects)
         {
             project.RelatedProject = await _database.Projects.Where(p => p.Id == project.ProjectId).FirstOrDefaultAsync();
         }
     }
 }
Exemplo n.º 9
0
        public async void OnNavigatedTo(NavigationContext navigationContext)
        {
            using (var _database = new ITManagerEntities())
            {
                LanguageLevels = await _database.LanguageLevels.ToListAsync();

                SkillLevels = await _database.SkillLevels.ToListAsync();

                Positions = await _database.Positions.ToListAsync();

                ProfessionalSkills = await _database.ProfessionalSkills.ToListAsync();

                LanguagesList = await _database.LanguagesLists.ToListAsync();

                ProjectsList = await _database.Projects.ToListAsync();

                var parameters = navigationContext.Parameters;
                if (parameters["UserId"] != null)
                {
                    var userId = int.Parse(parameters["UserId"].ToString());
                    var user   = await _database.Users.Where(u => u.Id == userId)
                                 .Include(u => u.Position)
                                 .Include(u => u.ProfessionalSummaries)
                                 .Include(u => u.UserSkills)
                                 .Include(u => u.UserProjects)
                                 .Include(u => u.Educations)
                                 .Include(u => u.Sertificates)
                                 .Include(u => u.Languages)
                                 .FirstOrDefaultAsync();

                    if (user != null)
                    {
                        User = user;
                        if (ShellViewModel.CurrentUser.UserRoles.FirstOrDefault().RoleId == Helpers.Constants.ManagerRole ||
                            User.Id == ShellViewModel.CurrentUserId)
                        {
                            CanUserChangeData = true;
                        }
                        else
                        {
                            CanUserChangeData = false;
                        }
                    }
                }
                else
                {
                    User = ShellViewModel.CurrentUser;
                    CanUserChangeData = true;
                }

                MapUser();
            }
        }
Exemplo n.º 10
0
        private async void Init()
        {
            using (var _database = new ITManagerEntities())
            {
                Languages   = Mapper.Map <IList <LanguagesList>, IList <Models.UserPageModel.LanguagesList> >(await _database.LanguagesLists.ToListAsync());
                Skills      = Mapper.Map <IList <ProfessionalSkill>, IList <Models.UserPageModel.ProfessionalSkill> >(await _database.ProfessionalSkills.ToListAsync());
                Projects    = Mapper.Map <IList <Project>, IList <Models.ProjectsManagementPageModels.Project> >(await _database.Projects.ToListAsync());
                SkillLevels = await _database.SkillLevels.ToListAsync();

                LanguageLevels = await _database.LanguageLevels.ToListAsync();
            }
        }
        private async void ChangePasswordMethod()
        {
            if (IsValid(ValidatesProperties, out var errors))
            {
                if (NewPassword == ConfirmNewPassword)
                {
                    Errors = string.Empty;
                    using (var _database = new ITManagerEntities())
                    {
                        var user = ShellViewModel.CurrentUser;
                        if (user != null)
                        {
                            var _user = _database.Users.Where(u => u.Id == user.Id).FirstOrDefault();
                            if (_user != null)
                            {
                                var salt = Convert.FromBase64String(user.Salt);
                                _user.Salt            = Convert.ToBase64String(salt);
                                _user.IsInitial       = false;
                                _user.Password        = Convert.ToBase64String(PasswordHasher.ComputeHash(NewPassword, salt));
                                _user.DefaultPassword = null;
                                await _database.SaveChangesAsync();

                                if (user.UserRoles.Any(r => r.RoleId == Constants.AdministratorRole))
                                {
                                    _navigationService.NavigateTo(Constants.RolesManagementView);
                                }
                                else if (user.UserRoles.Any(r => r.RoleId == Constants.ManagerRole))
                                {
                                    _navigationService.NavigateTo(Constants.SearchView);
                                }
                                else if (user.UserRoles.Any(r => r.RoleId == Constants.UserRole))
                                {
                                    _navigationService.NavigateTo(Constants.MyPersonalPageView);
                                }

                                _eventAggregator.GetEvent <CloseMenuEvent>().Publish(false);
                            }
                        }
                    }
                }
                else
                {
                    Errors = "Passwords must match.";
                }
            }
            else
            {
                Errors = errors;
            }

            Errors = Errors.Trim();
        }
Exemplo n.º 12
0
        private async void SaveEducationsMethod()
        {
            if (IsEducationValid())
            {
                using (var _database = new ITManagerEntities())
                {
                    var userEducations = (await _database.Users.Where(u => u.Id == User.Id)
                                          .Include(u => u.Educations)
                                          .FirstOrDefaultAsync()).Educations;

                    // Removing and changing educations
                    foreach (var userEducation in userEducations.ToList())
                    {
                        var _userEducation = Educations.FirstOrDefault(l => l.Id == userEducation.Id);
                        // If exists in local collection, change data
                        if (_userEducation != null)
                        {
                            userEducation.StartDate  = _userEducation.StartDate;
                            userEducation.EndDate    = _userEducation.EndDate;
                            userEducation.Faculty    = _userEducation.Faculty;
                            userEducation.Speciality = _userEducation.Speciality;
                            userEducation.University = _userEducation.University;
                        }
                        // If not exists in local collection - remove.
                        else
                        {
                            _database.Educations.Remove(userEducation);
                        }
                    }

                    // Adding new education
                    foreach (var newEducation in Educations.Where(l => l.Id == 0))
                    {
                        userEducations.Add(new Education
                        {
                            StartDate  = newEducation.StartDate,
                            EndDate    = newEducation.EndDate,
                            Faculty    = newEducation.Faculty,
                            Speciality = newEducation.Speciality,
                            University = newEducation.University,
                            UserId     = User.Id
                        });
                    }

                    IsEducationsChecked = false;
                    User.Educations     = (await _database.Users.Where(u => u.Id == User.Id).FirstOrDefaultAsync())?.Educations;

                    await _database.SaveChangesAsync();
                }
            }
        }
Exemplo n.º 13
0
 private async void InitUsers()
 {
     using (var _database = new ITManagerEntities())
     {
         Users = await _database.Users.Where(u => u.UserRoles.FirstOrDefault().RoleId != Constants.AdministratorRole &&
                                             u.UserRoles.FirstOrDefault().RoleId != Constants.ManagerRole &&
                                             u.IsActive)
                 .Include(u => u.UserSkills)
                 .Include(u => u.UserProjects)
                 .Include(u => u.UserSkills)
                 .Include(u => u.Languages)
                 .ToListAsync();
     }
 }
Exemplo n.º 14
0
        private async void UnblockUserMethod(UserAccountManagementModel user)
        {
            using (var _database = new ITManagerEntities())
            {
                var _user = await _database.Users.Where(u => u.Id == user.UserId).FirstOrDefaultAsync();

                if (_user == null)
                {
                    return;
                }
                user.IsActive  = true;
                _user.IsActive = true;
                await _database.SaveChangesAsync();
            }
        }
Exemplo n.º 15
0
        private async void RemoveQueryMethod(object query)
        {
            var _query = (Query)query;

            using (var _database = new ITManagerEntities())
            {
                _database.Queries.Remove(_database.Queries.FirstOrDefault(q => q.Id == _query.Id));
                await _database.SaveChangesAsync();

                var user = await _database.Users.Where(u => u.Id == ShellViewModel.CurrentUserId)
                           .Include(u => u.Queries).FirstOrDefaultAsync();

                Queries = new ObservableCollection <Query>(user.Queries);
            }
        }
Exemplo n.º 16
0
        private async void SaveSkillsMethod()
        {
            if (IsSkillsValid())
            {
                using (var _database = new ITManagerEntities())
                {
                    var userSkills = (await _database.Users.Where(u => u.Id == User.Id)
                                      .Include(u => u.UserSkills)
                                      .FirstOrDefaultAsync()).UserSkills;

                    // Removing and changing skills
                    foreach (var userSkill in userSkills.ToList())
                    {
                        var _userSkill = Skills.FirstOrDefault(l => l.Id == userSkill.Id);
                        // If exists in local collection, change data
                        if (_userSkill != null)
                        {
                            userSkill.SkillId      = _userSkill.SkillId;
                            userSkill.SkillLevelId = _userSkill.SkillLevelId;
                            userSkill.UserId       = User.Id;
                        }
                        // If not exists in local collection - remove.
                        else
                        {
                            _database.UserSkills.Remove(userSkill);
                        }
                    }

                    // Adding new skill
                    foreach (var newSkill in Skills.Where(l => l.Id == 0))
                    {
                        userSkills.Add(new UserSkill
                        {
                            SkillId      = newSkill.SkillId,
                            SkillLevelId = newSkill.SkillLevelId,
                            UserId       = User.Id
                        });
                    }

                    IsSkillsChecked = false;
                    User.UserSkills = (await _database.Users.Where(u => u.Id == User.Id).FirstOrDefaultAsync())?.UserSkills;

                    await _database.SaveChangesAsync();
                }
            }
        }
Exemplo n.º 17
0
        private async void SaveProjectsMethod()
        {
            if (IsProjectsValid())
            {
                using (var _database = new ITManagerEntities())
                {
                    var userProjects = (await _database.Users.Where(u => u.Id == User.Id)
                                        .Include(u => u.UserProjects)
                                        .FirstOrDefaultAsync()).UserProjects;

                    // Removing and changing projects
                    foreach (var userProject in userProjects.ToList())
                    {
                        var _userProject = Projects.FirstOrDefault(l => l.Id == userProject.Id);
                        // If exists in local collection, change data
                        if (_userProject != null)
                        {
                            userProject.ProjectId  = _userProject.ProjectId;
                            userProject.PositionId = _userProject.PositionId;
                        }
                        // If not exists in local collection - remove.
                        else
                        {
                            _database.UserProjects.Remove(userProject);
                        }
                    }

                    // Adding new project
                    foreach (var newProject in Projects.Where(l => l.Id == 0))
                    {
                        userProjects.Add(new UserProject
                        {
                            ProjectId  = newProject.ProjectId,
                            PositionId = newProject.PositionId,
                            UserId     = User.Id
                        });
                    }

                    IsProjectsChecked = false;
                    User.UserProjects = (await _database.Users.Where(u => u.Id == User.Id).FirstOrDefaultAsync())?.UserProjects;
                    MapProjects();

                    await _database.SaveChangesAsync();
                }
            }
        }
Exemplo n.º 18
0
        private async void SaveLanguagesMethod()
        {
            if (IsLanguagesValid())
            {
                using (var _database = new ITManagerEntities())
                {
                    var userLanguages = (await _database.Users.Where(u => u.Id == User.Id)
                                         .Include(u => u.Languages)
                                         .FirstOrDefaultAsync()).Languages;

                    // Removing and changing languages
                    foreach (var userLanguage in userLanguages.ToList())
                    {
                        var _userLanguage = Languages.FirstOrDefault(l => l.Id == userLanguage.Id);
                        // If exists in local collection, change data
                        if (_userLanguage != null)
                        {
                            userLanguage.LanguageId      = _userLanguage.LanguageId;
                            userLanguage.LanguageLevelId = _userLanguage.LanguageLevelId;
                        }
                        // If not exists in local collection - remove.
                        else
                        {
                            _database.Languages.Remove(userLanguage);
                        }
                    }

                    // Adding new languages
                    foreach (var newLanguage in Languages.Where(l => l.Id == 0))
                    {
                        _database.Languages.Add(new Language
                        {
                            LanguageId      = newLanguage.LanguageId,
                            LanguageLevelId = newLanguage.LanguageLevelId,
                            UserId          = User.Id
                        });
                    }

                    IsLanguagesChecked = false;
                    User.Languages     = (await _database.Users.Where(u => u.Id == User.Id).FirstOrDefaultAsync())?.Languages;
                    MapLanguages();

                    await _database.SaveChangesAsync();
                }
            }
        }
Exemplo n.º 19
0
        public async void OnNavigatedTo(NavigationContext navigationContext)
        {
            if (Skills?.Count == 0)
            {
                Init();
            }
            InitUsers();
            var parameters = navigationContext.Parameters;

            if (parameters["QueryId"] != null)
            {
                using (var _database = new ITManagerEntities())
                {
                    var queryId        = int.Parse((string)parameters["QueryId"]);
                    var queryString    = (await _database.Queries.Where(q => q.Id == queryId).FirstOrDefaultAsync()).QueryString;
                    var splittedQuery  = queryString.Split('&');
                    var skillsQuery    = splittedQuery[0];
                    var languagesQuery = splittedQuery[1];
                    var projectsQuery  = splittedQuery[2];

                    SkillsConditions = new ObservableCollection <SkillCondition>(skillsQuery.Split(',').Select(q => new SkillCondition
                    {
                        Skill = Skills.Where(s => s.Id == int.Parse(q.Split(':')[0])).FirstOrDefault(),
                        From  = SkillLevels.Where(s => s.Id == int.Parse(q.Split(':')[1].Split('-')[0])).FirstOrDefault(),
                        To    = SkillLevels.Where(s => s.Id == int.Parse(q.Split(':')[1].Split('-')[1])).FirstOrDefault()
                    }));

                    SelectedSkills = new ObservableCollection <Models.UserPageModel.ProfessionalSkill>(Skills.Where(s => SkillsConditions.Any(sc => sc.Skill.Id == s.Id)));

                    LanguagesConditions = new ObservableCollection <LanguageCondition>(languagesQuery.Split(',').Select(q => new LanguageCondition
                    {
                        Language = Languages.Where(l => l.Id == int.Parse(q.Split(':')[0])).FirstOrDefault(),
                        From     = LanguageLevels.Where(l => l.Id == int.Parse(q.Split(':')[1].Split('-')[0])).FirstOrDefault(),
                        To       = LanguageLevels.Where(l => l.Id == int.Parse(q.Split(':')[1].Split('-')[1])).FirstOrDefault()
                    }));

                    SelectedLanguages = new ObservableCollection <Models.UserPageModel.LanguagesList>(Languages.Where(l => LanguagesConditions.Any(lc => lc.Language.Id == l.Id)));

                    var projectsIds = projectsQuery.Split(',').Select(pId => int.Parse(pId));
                    SelectedProjects = new ObservableCollection <Models.ProjectsManagementPageModels.Project>(Projects.Where(p => projectsIds.Contains(p.Id)));
                }

                SearchMethod();
            }
        }
Exemplo n.º 20
0
        private async void SaveSertificatesMethod()
        {
            if (IsCertificatesValid())
            {
                using (var _database = new ITManagerEntities())
                {
                    var userSertificates = (await _database.Users.Where(u => u.Id == User.Id)
                                            .Include(u => u.Sertificates)
                                            .FirstOrDefaultAsync()).Sertificates;

                    // Removing and changing sertificates
                    foreach (var userSertificate in userSertificates.ToList())
                    {
                        var _userSertificate = Sertificates.FirstOrDefault(l => l.Id == userSertificate.Id);
                        // If exists in local collection, change data
                        if (_userSertificate != null)
                        {
                            userSertificate.Name = _userSertificate.Name;
                            userSertificate.Date = _userSertificate.Date;
                        }
                        // If not exists in local collection - remove.
                        else
                        {
                            _database.Sertificates.Remove(userSertificate);
                        }
                    }

                    // Adding new sertificates
                    foreach (var newSertificate in Sertificates.Where(l => l.Id == 0))
                    {
                        userSertificates.Add(new Sertificate
                        {
                            Name   = newSertificate.Name,
                            Date   = newSertificate.Date,
                            UserId = User.Id
                        });
                    }

                    IsSertificatesChecked = false;
                    User.Sertificates     = (await _database.Users.Where(u => u.Id == User.Id).FirstOrDefaultAsync())?.Sertificates;

                    await _database.SaveChangesAsync();
                }
            }
        }
Exemplo n.º 21
0
        private async void SaveUsersMethod()
        {
            using (var _database = new ITManagerEntities())
            {
                var users = await _database.Users.ToListAsync();

                foreach (var user in users)
                {
                    var _user = Users.Where(u => u.UserId == user.Id).FirstOrDefault();
                    if (_user == null)
                    {
                        continue;
                    }
                    user.UserRoles.FirstOrDefault().RoleId = _user.RoleId;
                }

                await _database.SaveChangesAsync();

                GetUsersMethod();
            }
        }
Exemplo n.º 22
0
        private async void SaveSkillsMethod()
        {
            if (!Skills.Any(s => string.IsNullOrWhiteSpace(s.Name) || s.Name.Length < 2 || s.Name.Length > 50))
            {
                using (var _database = new ITManagerEntities())
                {
                    var skills = await _database.ProfessionalSkills.ToListAsync();

                    foreach (var skill in skills)
                    {
                        var _skill = Skills.FirstOrDefault(s => s.Id == skill.Id);
                        if (_skill != null)
                        {
                            skill.Name = _skill.Name;
                        }
                        else
                        {
                            _database.ProfessionalSkills.Remove(skill);
                        }
                    }

                    foreach (var skill in Skills.Where(s => s.Id == 0))
                    {
                        _database.ProfessionalSkills.Add(new ProfessionalSkill
                        {
                            Name = skill.Name
                        });
                    }

                    await _database.SaveChangesAsync();

                    FillSkills();
                }
                Errors = string.Empty;
            }
            else
            {
                Errors = "All skills must contains from 2 to 50 symbols.";
            }
        }
Exemplo n.º 23
0
        private async void SaveProjectsMethod()
        {
            using (var _database = new ITManagerEntities())
            {
                var projects = await _database.Projects.ToListAsync();

                foreach (var project in projects)
                {
                    var _proejct = Projects.FirstOrDefault(p => p.Id == project.Id);
                    if (_proejct != null)
                    {
                        project.Name        = _proejct.Name;
                        project.Description = _proejct.Description;
                        project.StartDate   = _proejct.StartDate;
                        project.EndDate     = _proejct.EndDate;
                    }
                    else
                    {
                        _database.Projects.Remove(project);
                    }
                }

                foreach (var newProject in Projects.Where(p => p.Id == 0).ToList())
                {
                    _database.Projects.Add(new Project
                    {
                        Name        = newProject.Name,
                        StartDate   = newProject.StartDate,
                        EndDate     = newProject.EndDate,
                        Description = newProject.Description
                    });
                }

                await _database.SaveChangesAsync();

                FillProjects();
            }
        }
Exemplo n.º 24
0
        private async void SaveProfessionalSummaryMethod()
        {
            using (var _database = new ITManagerEntities())
            {
                var _professionalSummary = (await _database.ProfessionalSummaries.Where(p => p.Id == ProfessionalSummary.Id).FirstOrDefaultAsync());
                if (_professionalSummary != null)
                {
                    _professionalSummary.ProfessionalSummary1 = ProfessionalSummary.ProfessionalSummary1;
                    User.ProfessionalSummaries = await _database.ProfessionalSummaries.Where(u => u.UserId == User.Id).ToListAsync();
                }
                else
                {
                    _database.ProfessionalSummaries.Add(new ProfessionalSummary
                    {
                        UserId = User.Id,
                        ProfessionalSummary1 = ProfessionalSummary.ProfessionalSummary1
                    });
                }

                IsProfessionalSummaryChecked = false;

                await _database.SaveChangesAsync();
            }
        }
Exemplo n.º 25
0
        private async void LoginApplicationMethod()
        {
            string errors = null;

            if (IsValid(ValidatesProperties, out errors))
            {
                using (var _database = new ITManagerEntities())
                {
                    var user = await _database.Users.Where(u => u.Login == Login)
                               .Include(u => u.Position)
                               .Include(u => u.ProfessionalSummaries)
                               .Include(u => u.UserSkills)
                               .Include(u => u.UserProjects)
                               .Include(u => u.Educations)
                               .Include(u => u.Sertificates)
                               .Include(u => u.Languages)
                               .FirstOrDefaultAsync();

                    if (user == null)
                    {
                        Errors = "Invalid login.\r\n";
                        return;
                    }

                    var salt = user.Salt;
                    if (PasswordHasher.VerifyPassword(Password, Convert.FromBase64String(salt), Convert.FromBase64String(user.Password)))
                    {
                        ShellViewModel.CurrentUser = user;
                        _regionManager.RegisterViewWithRegion(Helpers.Constants.MenuRegion, typeof(MenuView));

                        if (!user.IsActive)
                        {
                            Errors = "Sorry, but your account has been deactivated.\r\n";
                            return;
                        }

                        if (user.IsInitial)
                        {
                            _navigationService.NavigateTo(Constants.ChangePasswordView);
                            return;
                        }

                        if (user.UserRoles.Any(r => r.RoleId == Constants.AdministratorRole))
                        {
                            _navigationService.NavigateTo(Constants.RolesManagementView);
                        }
                        else if (user.UserRoles.Any(r => r.RoleId == Constants.ManagerRole))
                        {
                            _navigationService.NavigateTo(Constants.SearchView);
                        }
                        else if (user.UserRoles.Any(r => r.RoleId == Constants.UserRole))
                        {
                            _navigationService.NavigateTo(Constants.MyPersonalPageView);
                        }

                        _eventAggregator.GetEvent <CloseMenuEvent>().Publish(false);
                    }
                    else
                    {
                        Errors = "Invalid password.\r\n";
                    }
                }
            }
            else
            {
                Errors = errors;
            }

            Errors = Errors?.Trim();
        }