Beispiel #1
0
        public IActionResult Index(int resumeId)
        {
            var currentStudent = _studentService.GetStudentByResumeId(resumeId);
            //Get all data for Resume from all tables
            ResumeReviewViewModel vm = new ResumeReviewViewModel
            {
                ResumeId         = resumeId,
                ResumeStatus     = _resumeService.GetResumeById(resumeId).Status,
                UserInfo         = _userInfoService.GetUserInfo(User.Identity.Name),
                Stream           = _streamService.GetStreamByStudentId(currentStudent.Id),
                Summary          = _summaryService.GetSummaryByResumeId(resumeId),
                Skills           = _skillService.GetAllSkillsForStudent(currentStudent.Id).ToArray(),
                ForeignLanguages = _languageService.GetAllForeignLanguagesForResume(resumeId).ToArray(),
                Educations       = _educationService.GetAllEducationsForResume(resumeId).ToArray(),
                Courses          = _courseService.GetAllCoursesForResume(resumeId).ToArray(),
                Certificates     = _certificateService.GetAllCertificatesForResume(resumeId).ToArray(),
                Exams            = _examService.GetAllExamsForResume(resumeId).ToArray(),
                WorkExperience   = _workExperienceService.GetWorkExperienceForResume(resumeId).ToArray(),
                Portfolio        = _portfolioService.GetPortfolioForResume(resumeId).ToArray(),
                MilitaryStatus   = _militaryStatusService.GetMilitaryStatusForResume(resumeId),
                AdditionalInfo   = _additionalInfoService.GetAdditionalInfo(resumeId),
                Recommendations  = _recommendationService.GetAllRecommendationsForResume(resumeId).ToArray()
            };

            return(View(vm));
        }
Beispiel #2
0
        public IActionResult Index()
        {
            var vm = new ResumeViewModel();

            #region Fill data to viewmodel (if it's exist)

            // Get info about current user
            vm.UserInfo = _userInfo;
            var currentStudent = _studentService.GetCurrentStudentByUserInfo(vm.UserInfo.Id);

            //Get current Resume Id
            Resume resume = _resumeService.GetResumeByStudentId(currentStudent.Id);

            //create new resume if it doesn't exist
            if (resume == null)
            {
                _resumeService.CreateResumeForStudent(currentStudent.Id);
            }

            //Fill data to viewmodel
            int resumeId = _resumeService.GetResumeByStudentId(currentStudent.Id).Id;
            vm.ResumeId          = resumeId;
            vm.CurrentResumeStep = _resumeService.GetResumeByStudentId(currentStudent.Id).CurrentStep;

            var stream = _streamService.GetStreamByStudentId(currentStudent.Id);
            if (stream != null)
            {
                vm.StreamFullName = stream.StreamFullName;
            }

            var summary = _summaryService.GetSummaryByResumeId(resumeId);
            if (summary != null)
            {
                vm.Summary = summary.Text;
            }

            string [] existingStudentsSkill = _skillService.GetAllSkillsForStudent(currentStudent.Id).ToArray();
            if (existingStudentsSkill.Length != 0)
            {
                vm.Skills = _skillService.GetAllSkillsForStudent(currentStudent.Id).ToArray();
            }
            else
            {
                //If Student hasn't skills in DB, get the default skills by stream
                vm.Skills = _skillService.GetDefaultSkillsByStream(stream.Id).ToArray();
            }

            vm.ForeignLanguages = _languageService.GetAllForeignLanguagesForResume(resumeId).ToDictionary(x => x.LanguageId, x => x.LanguageLevelId);
            vm.Educations       = _educationService.GetAllEducationsForResume(resumeId).ToArray();
            vm.Courses          = _courseService.GetAllCoursesForResume(resumeId).ToArray();
            vm.Certificates     = _certificateService.GetAllCertificatesForResume(resumeId).ToArray();
            vm.Exams            = _examService.GetAllExamsForResume(resumeId).ToArray();

            WorkExperience[] workExperiences = _workExperienceService.GetWorkExperienceForResume(resumeId).ToArray();
            vm.WorkExperiences = new WorkExperienceViewModel[workExperiences.Length];
            if (workExperiences.Count() != 0)
            {
                for (int i = 0; i < workExperiences.Count(); i++)
                {
                    vm.WorkExperiences[i] = new WorkExperienceViewModel(workExperiences[i]);
                }
            }

            vm.Portfolios      = _portfolioService.GetPortfolioForResume(resumeId).ToArray();
            vm.MilitaryStatus  = _militaryStatusService.GetMilitaryStatusForResume(resumeId);
            vm.Recommendations = _recommendationService.GetAllRecommendationsForResume(resumeId).ToArray();
            vm.AdditionalInfo  = _additionalInfoService.GetAdditionalInfo(resumeId);

            #endregion

            #region Fill data to dropdown lists

            //Get all languages from table Languages
            List <Language> languages = _languageService.GetAllLanguages().ToList();
            languages.Insert(0, languages.First(l => l.Name == "English"));
            var index = languages.FindLastIndex(l => l.Name == "English");
            languages.RemoveAt(index);
            //Fill data to dropdownlist Languages
            vm.Languages = languages;

            //Get all language levels from table LanguageLevels
            List <LanguageLevel> languageLevels = _languageService.GetAllLanguageLevels().ToList();
            languageLevels.Insert(0, new LanguageLevel {
                LevelName = "---", Id = 0
            });
            //Fill data to dropdownlist language levels
            vm.LanguageLevels = languageLevels;

            //Get all skills from table Skills
            vm.SkillList = _skillService.GetAllSkills().ToList();

            //Get all Months, Years from DateService
            vm.Months = _dateService.GetAllMonths();
            vm.Years  = _dateService.GetAllYears().ToList();

            //Fill data to dropdownlist Education Levels
            vm.EducationLevels = _educationService.GetEducationLevels().ToList();

            #endregion

            //TODO: add more other statuses, when they will be implemented
            if (resume != null && resume.Status == ResumeStatuses.Submitted)
            {
                return(RedirectToAction(nameof(ResumeReviewController.Index), "ResumeReview", new { resumeId = resume.Id }));
            }
            else
            {
                return(View("Index", vm));
            }
        }
Beispiel #3
0
        public HRStudentDataViewModel GetAllStudentViewData()
        {
            IList <Student> students = _studentService.GetAllStudents();

            if (students.Count == 0)
            {
                return(null);
            }

            HRStudentDataViewModel viewModel = new HRStudentDataViewModel
            {
                LanguageLevels = _languageService.GetAllLanguageLevels(),
                Streams        = _streamService.GetAllStreams(),
                TableData      = new List <HRStudentDataViewModel.TableRow>()
            };

            foreach (Student st in students)
            {
                UserInfo studentInfo = _studentService.GetUserInfo(st);
                Resume   resume      = _resumeService.GetResumeByStudentId(st.Id);
                HRStudentDataViewModel.TableRow row = new HRStudentDataViewModel.TableRow()
                {
                    StudentId                   = st.Id,
                    Choose                      = false,
                    Stream                      = _streamService.GetStreamByStudentId(st.Id),
                    RuName                      = studentInfo?.RuName,
                    RuSurname                   = studentInfo.RuSurname,
                    DateOfBirth                 = studentInfo.DateOfBirth,
                    Email                       = studentInfo.Email,
                    Phone                       = studentInfo.Phone,
                    TrainerEmail                = "*****@*****.**",
                    DateOfGraduation            = st.DateOfGraduation,
                    GraduationMark              = st.GraduationMark,
                    ParticipationOnPracticalLab = false,
                    Comments                    = null
                };

                if (resume == null)
                {
                    row.Languages       = null;
                    row.Status          = "new";
                    row.Specializations = null;
                }
                else
                {
                    row.Languages       = _languageService.GetAllForeignLanguagesForResume(resume.Id);
                    row.Status          = resume.Status;
                    row.Specializations = resume.Educations?.Select(s => s.Specialization);
                }

                var skills = _skillService.GetAllSkillsForStudent(st.Id);
                if (skills.Count() == 0)
                {
                    row.StudentSkills = _skillService.GetDefaultSkillsByStream(_streamService.GetStreamByStudentId(st.Id).Id);
                }
                else
                {
                    row.StudentSkills = skills;
                }
                viewModel.TableData.Add(row);
            }
            return(viewModel);
        }
Beispiel #4
0
        public async Task <IActionResult> EditResume(int resumeId)
        {
            var student = _studentService.GetStudentByResumeId(resumeId);

            ResumeViewModel vm = new ResumeViewModel
            {
                ResumeId         = resumeId,
                UserInfo         = _userInfo,
                StreamFullName   = _streamService.GetStreamByStudentId(student.Id).StreamFullName,
                Summary          = _summaryService.GetSummaryByResumeId(resumeId).Text,
                Skills           = _skillService.GetAllSkillsForStudent(student.Id).ToArray(),
                ForeignLanguages = _languageService.GetAllForeignLanguagesForResume(resumeId).ToDictionary(x => x.LanguageId, x => x.LanguageLevelId),
                Educations       = _educationService.GetAllEducationsForResume(resumeId).ToArray(),
                Courses          = _courseService.GetAllCoursesForResume(resumeId).ToArray(),
                Certificates     = _certificateService.GetAllCertificatesForResume(resumeId).ToArray(),
                Exams            = _examService.GetAllExamsForResume(resumeId).ToArray(),
                Portfolios       = _portfolioService.GetPortfolioForResume(resumeId).ToArray(),
                MilitaryStatus   = _militaryStatusService.GetMilitaryStatusForResume(resumeId),
                AdditionalInfo   = _additionalInfoService.GetAdditionalInfo(resumeId),
                Recommendations  = _recommendationService.GetAllRecommendationsForResume(resumeId).ToArray()
            };

            WorkExperience[] workExperiences = _workExperienceService.GetWorkExperienceForResume(resumeId).ToArray();
            vm.WorkExperiences = new WorkExperienceViewModel[workExperiences.Length];
            if (workExperiences.Count() != 0)
            {
                for (int i = 0; i < workExperiences.Count(); i++)
                {
                    vm.WorkExperiences[i] = new WorkExperienceViewModel(workExperiences[i]);
                }
            }
            #region Fill data to dropdown lists

            //Get all languages from table Languages
            List <Language> languages = _languageService.GetAllLanguages().ToList();
            languages.Insert(0, languages.First(l => l.Name == "English"));
            var index = languages.FindLastIndex(l => l.Name == "English");
            languages.RemoveAt(index);
            //Fill data to dropdownlist Languages
            vm.Languages = languages;

            //Get all language levels from table LanguageLevels
            List <LanguageLevel> languageLevels = _languageService.GetAllLanguageLevels().ToList();
            languageLevels.Insert(0, new LanguageLevel {
                LevelName = "---", Id = 0
            });
            //Fill data to dropdownlist language levels
            vm.LanguageLevels = languageLevels;

            //Get all skills from table Skills
            vm.SkillList = _skillService.GetAllSkills().ToList();

            //Get all Months, Years from DateService
            vm.Months = _dateService.GetAllMonths();
            vm.Years  = _dateService.GetAllYears().ToList();

            //Fill data to dropdownlist Education Levels
            vm.EducationLevels = _educationService.GetEducationLevels().ToList();

            #endregion


            return(View(vm));
        }