Esempio n. 1
0
        public async Task <ActionResult> Default(EducationHistory educationHistory)
        {
            Application application = await _applicationService.GetCurrentApplication(_ctx);

            if (ModelState.IsValid)
            {
                educationHistory.Application = application;

                EducationHistory currentEducation = await _applicationService.GetEducationHistory(_ctx);

                if (currentEducation != null)
                {
                    educationHistory.Id = currentEducation.Id;
                }

                _ctx.Education.AddOrUpdate(a => a.Id, educationHistory);
                await _ctx.SaveChangesAsync();

                return(RedirectToAction("Manage", "Applications"));
            }

            ViewBag.Schools = await _ctx.Schools.ToListAsync();

            return(View(educationHistory));
        }
Esempio n. 2
0
        public bool UpdateEducationHistory(EducationHistory educationHistory, int profileID)
        {
            if (!String.IsNullOrEmpty(educationHistory.Subject) &&
                !String.IsNullOrEmpty(educationHistory.School))
            {
                if (educationHistory.EducationHistoryID == -2)
                {
                    return(false);
                }
                else if (educationHistory.EducationHistoryID == -1)
                {
                    // Add new
                    educationHistory.ProfileID = profileID;
                    educationHistory.IsDeleted = false;
                    this.EducationHistoryRepository.Insert(educationHistory);
                    this.Save();
                }
                else
                {
                    // Update
                    educationHistory.ProfileID = profileID;
                    educationHistory.IsDeleted = false;
                    this.EducationHistoryRepository.Update(educationHistory);
                    this.Save();
                }

                return(true);
            }

            return(false);
        }
Esempio n. 3
0
        public async Task <ActionResult> Default(int?id)
        {
            EducationHistory educationHistory = await _applicationService.GetEducationHistory(_ctx)
                                                ?? new EducationHistory();

            ViewBag.Schools = await _ctx.Schools.ToListAsync();

            return(View(educationHistory));
        }
        public async Task AddEducationToResume(string personEmail, EducationHistory education)
        {
            Resume toUpdate = await this.GetCompleteResumeByPersonEmail(personEmail, false);

            toUpdate.EducationHistory = education;
            await this.AddGetSchool(education.School);

            this.Schools.Attach(education.School);
            await this.SaveChangesAsync();
        }
Esempio n. 5
0
        public ActionResult FormAddEducation(EducationHistory educationHistory)
        {
            if (educationHistory == null)
            {
                educationHistory = new EducationHistory();
            }

            MasterModel.Education = educationHistory;

            return(PartialView("Partials/_AddEducation", educationHistory));
        }
        private static EducationHistory GetEducationHistory()
        {
            List <ContentSubItem> contentSubItems = new List <ContentSubItem>();
            List <ContentItem>    contentItems    = new List <ContentItem>();

            ContentSubItem contentSubItem1 = new ContentSubItem()
            {
                SubItemContent = "Bachelor of Science in Computer Engineering"
            };

            ContentSubItem contentSubItem2 = new ContentSubItem()
            {
                SubItemContent = "GPA: 3.1"
            };

            contentSubItems.Add(contentSubItem1);
            contentSubItems.Add(contentSubItem2);

            ContentItem contentItem = new ContentItem()
            {
                ExperienceItemContent = "Cal Poly San Luis Obispo",
                ExperienceSubItems    = contentSubItems
            };

            contentItems.Add(contentItem);

            School calPoly = new School()
            {
                SchoolName     = "Cal Poly",
                SchoolLocation = "San Luis Obispo"
            };

            EducationHistory eh = new EducationHistory()
            {
                School          = calPoly,
                ExperienceItems = contentItems
            };

            return(eh);
        }
Esempio n. 7
0
        /// <summary>
        /// Saves the education history information.
        /// </summary>
        /// <param name="educationHistoryInfo">The education history information.</param>
        /// <returns></returns>
        /// <exception cref="ArgumentNullException">educationHistoryInfo</exception>
        /// <exception cref="System.ArgumentNullException">educationHistoryInfo</exception>
        public string SaveEducationHistoryInfo(IEducationHistoryView educationHistoryInfo)
        {
            if (educationHistoryInfo == null)
            {
                throw new ArgumentNullException(nameof(educationHistoryInfo));
            }

            var result = string.Empty;

            var newRecord = new EducationHistory
            {
                //note dont include primary key here

                EmployeeId     = educationHistoryInfo.EmployeeId,
                SchoolName     = educationHistoryInfo.SchoolName,
                Degree         = educationHistoryInfo.Degree,
                GraduationYear = educationHistoryInfo.GraduationYear,
                Note           = educationHistoryInfo.Note,
                IsActive       = true,
                DateCreated    = DateTime.UtcNow,
            };

            try
            {
                using (
                    var dbContext = (HRMSEntities)this.dbContextFactory.GetDbContext(ObjectContextType.HRMS))
                {
                    dbContext.EducationHistories.Add(newRecord);
                    dbContext.SaveChanges();
                }
            }
            catch (Exception e)
            {
                result = string.Format("SaveRegistrationInfo - {0} , {1}", e.Message,
                                       e.InnerException != null ? e.InnerException.Message : "");
            }

            return(result);
        }
        public ActionResult Update([Bind(Include = "FullName, Gender, MaritalStatus, Nationality, Address, DateofBirth, PhoneNumber, CityID, District, IsVisible")]
                                   Contact contact,
                                   string skillList,
                                   [Bind(Include = "ProfileID, Name, YearOfExperience, HighestSchoolLevel_ID, LanguageID, Level_ID, MostRecentCompany, MostRecentPosition, CurrentJobLevel_ID, ExpectedPosition, ExpectedJobLevel_ID, ExpectedSalary, Objectives")]
                                   Profile profile, string expectedCity, string categoryID,
                                   [Bind(Include = "EmploymentHistoryID, Position, Company, WorkingTime, Description")] EmploymentHistory employmentHistory,
                                   [Bind(Include = "EducationHistoryID, Subject, School, SchoolLevel_ID, Achievement")] EducationHistory educationHistory,
                                   [Bind(Include = "ReferencePersonID, ReferencePersonName, ReferencePersonPosition, ReferencePersonCompany, EmailAddress, ReferencePersonPhoneNumber")] ReferencePerson referencePerson,
                                   string ButtonName)
        {
            AspNetUser jobseeker = profileUnitOfWork.AspNetUserRepository.Get(s => s.UserName == User.Identity.Name && s.IsActive == true).LastOrDefault();

            bool updateSkillResult = profileUnitOfWork.UpdateSkill(skillList, jobseeker.Id);

            bool contactResult = UpdateContact(contact);

            if ("Tạo mới".Equals(ButtonName))
            {
                if (jobseeker != null)
                {
                    Profile oldProfile = profileUnitOfWork.ProfileRepository.Get(s => s.Name == profile.Name && s.JobSeekerID == jobseeker.Id && s.IsDeleted == false).LastOrDefault();

                    if (oldProfile != null)
                    {
                        TempData["warningmessage"] = "Tên hồ sơ đã tồn tại, xin hãy tạo lại hồ sơ bằng tên khác!";
                        return(RedirectToAction("Update"));
                    }
                }
            }
            bool commonInfoResult        = UpdateCommonInfo(profile, expectedCity, categoryID);
            bool employmentHistoryResult = false;
            bool educationHistoryResult  = false;
            bool referencePersonResult   = false;

            if (commonInfoResult)
            {
                Profile updatedProfile = profileUnitOfWork.ProfileRepository.Get(s => s.Name == profile.Name).LastOrDefault();
                if (updatedProfile != null)
                {
                    int percentStatus = 25;

                    int profileID = updatedProfile.ProfileID;

                    employmentHistoryResult = profileUnitOfWork.UpdateEmploymentHistory(employmentHistory, profileID);
                    if (employmentHistoryResult)
                    {
                        percentStatus += 25;
                    }
                    educationHistoryResult = profileUnitOfWork.UpdateEducationHistory(educationHistory, profileID);
                    if (educationHistoryResult)
                    {
                        percentStatus += 25;
                    }
                    referencePersonResult = profileUnitOfWork.UpdateReferencePerson(referencePerson, profileID);
                    if (referencePersonResult)
                    {
                        percentStatus += 25;
                    }

                    updatedProfile.PercentStatus = percentStatus;
                    profileUnitOfWork.ProfileRepository.Update(updatedProfile);
                    profileUnitOfWork.Save();

                    if ("Tạo mới".Equals(ButtonName))
                    {
                        TempData["successmessage"] = "Tạo hồ sơ thành công.";
                    }
                    else
                    {
                        TempData["successmessage"] = "Cập nhật hồ sơ thành công.";
                    }

                    return(RedirectToAction("List"));
                }

                if ("Tạo mới".Equals(ButtonName))
                {
                    TempData["errormessage"] = "Tạo hồ sơ thất bại!";
                }
                else
                {
                    TempData["errormessage"] = "Cập nhật hồ sơ thất bại!";
                }

                return(RedirectToAction("Update"));
            }

            if ("Tạo mới".Equals(ButtonName))
            {
                TempData["errormessage"] = "Tạo hồ sơ thất bại!";
            }
            else
            {
                TempData["errormessage"] = "Cập nhật hồ sơ thất bại!";
            }

            return(RedirectToAction("Update", new { profileID = profile.ProfileID }));
        }
        public ActionResult Update(string profileID, string mode)
        {
            AspNetUser user = profileUnitOfWork.AspNetUserRepository.Get(s => s.UserName == User.Identity.Name).FirstOrDefault();

            if ("create".Equals(mode))
            {
                IEnumerable <Profile> profiles = profileUnitOfWork.ProfileRepository.Get(s => s.JobSeekerID == user.Id && s.IsDeleted == false).AsEnumerable();

                if (profiles.Count() >= 5)
                {
                    TempData["warningmessage"] = "Bạn chỉ được tạo tối đa 5 hồ sơ!";
                    return(RedirectToAction("List"));
                }
            }

            ProUpdateViewModel proUpdateViewModel = new ProUpdateViewModel();

            proUpdateViewModel.cities       = profileUnitOfWork.CityRepository.Get(filter: d => d.IsDeleted == false).OrderBy(d => d.Name).AsEnumerable();
            proUpdateViewModel.schoolLevels = profileUnitOfWork.SchoolLevelRepository.Get(filter: d => d.IsDeleted == false).OrderByDescending(d => d.LevelNum).AsEnumerable();
            proUpdateViewModel.languages    = profileUnitOfWork.LanguageRepository.Get(filter: d => d.IsDeleted == false).OrderBy(d => d.Name).AsEnumerable();
            proUpdateViewModel.levels       = profileUnitOfWork.LevelRepository.Get(filter: d => d.IsDeleted == false).OrderByDescending(d => d.LevelNum).AsEnumerable();
            proUpdateViewModel.jobLevels    = profileUnitOfWork.JobLevelRepository.Get(filter: d => d.IsDeleted == false).OrderByDescending(d => d.LevelNum).AsEnumerable();
            proUpdateViewModel.categories   = profileUnitOfWork.CategoryRepository.Get(filter: d => d.IsDeleted == false).OrderBy(d => d.Name).AsEnumerable();

            proUpdateViewModel.contact = profileUnitOfWork.ContactRepository.GetByID(profileUnitOfWork.AspNetUserRepository.Get(s => s.UserName == User.Identity.Name).FirstOrDefault().Id);
            if (proUpdateViewModel.contact == null)
            {
                proUpdateViewModel.contact             = new Contact();
                proUpdateViewModel.contact.DateofBirth = DateTime.Now;
            }

            IEnumerable <OwnSkill> ownSkillList = profileUnitOfWork.OwnSkillRepository.Get(s => s.JobSeekerID == user.Id).AsEnumerable();

            proUpdateViewModel.ownSkills = "";
            for (int i = 0; i < ownSkillList.Count(); i++)
            {
                if (i == 0)
                {
                    proUpdateViewModel.ownSkills = profileUnitOfWork.SkillRepository.GetByID(ownSkillList.ElementAt(i).Skill_ID).SkillTag;
                }
                else
                {
                    proUpdateViewModel.ownSkills += "," + profileUnitOfWork.SkillRepository.GetByID(ownSkillList.ElementAt(i).Skill_ID).SkillTag;
                }
            }

            proUpdateViewModel.commonInfoItem = new ProCommonInfoItem();
            if (!String.IsNullOrEmpty(profileID))
            {
                ViewBag.ButtonName = "Cập nhật";

                int profileIDNum = 0;
                try
                {
                    profileIDNum = Int32.Parse(profileID);
                }
                catch (Exception)
                {
                    TempData["warningmessage"] = "Lỗi dữ liệu!";
                    return(RedirectToAction("List"));
                }

                Profile profile = profileUnitOfWork.ProfileRepository.GetByID(profileIDNum);
                if (profile != null)
                {
                    if (profile.JobSeekerID != user.Id)
                    {
                        TempData["warningmessage"] = "Bạn không có quyền sửa hồ sơ này!";
                        return(RedirectToAction("List"));
                    }

                    ViewBag.ButtonName = "Cập nhật";

                    proUpdateViewModel.commonInfoItem.profile = profile;

                    ExpectedCity expectedCity = profileUnitOfWork.ExpectedCityRepository.Get(filter: d => d.ProfileID == profileIDNum && d.IsDeleted == false).FirstOrDefault();
                    if (expectedCity != null)
                    {
                        proUpdateViewModel.commonInfoItem.expectedCity = expectedCity.CityID;
                    }

                    ExpectedCategory expectedCategory = profileUnitOfWork.ExpectedCategoryRepository.Get(filter: d => d.ProfileID == profileIDNum && d.IsDeleted == false).FirstOrDefault();
                    if (expectedCategory != null)
                    {
                        proUpdateViewModel.commonInfoItem.categoryID = expectedCategory.CategoryID;
                    }

                    EmploymentHistory employmentHistory = profileUnitOfWork.EmploymentHistoryRepository.Get(s => s.ProfileID == profileIDNum && s.IsDeleted == false).FirstOrDefault();
                    if (employmentHistory != null)
                    {
                        proUpdateViewModel.employmentHistory = employmentHistory;
                    }
                    else
                    {
                        proUpdateViewModel.employmentHistory = new EmploymentHistory();
                        proUpdateViewModel.employmentHistory.EmploymentHistoryID = -1;
                    }

                    EducationHistory educationHistory = profileUnitOfWork.EducationHistoryRepository.Get(s => s.ProfileID == profileIDNum && s.IsDeleted == false).FirstOrDefault();
                    if (educationHistory != null)
                    {
                        proUpdateViewModel.educationHistory = educationHistory;
                    }
                    else
                    {
                        proUpdateViewModel.educationHistory = new EducationHistory();
                        proUpdateViewModel.educationHistory.EducationHistoryID = -1;
                    }

                    ReferencePerson referencePerson = profileUnitOfWork.ReferencePersonRepository.Get(s => s.ProfileID == profileIDNum && s.IsDeleted == false).FirstOrDefault();
                    if (referencePerson != null)
                    {
                        proUpdateViewModel.referencePerson = referencePerson;
                    }
                    else
                    {
                        proUpdateViewModel.referencePerson = new ReferencePerson();
                        proUpdateViewModel.referencePerson.ReferencePersonID = -1;
                    }
                }
                else
                {
                    ViewBag.ButtonName = "Tạo mới";

                    proUpdateViewModel.employmentHistory = new EmploymentHistory();
                    proUpdateViewModel.employmentHistory.EmploymentHistoryID = -1;
                    proUpdateViewModel.educationHistory = new EducationHistory();
                    proUpdateViewModel.educationHistory.EducationHistoryID = -1;
                    proUpdateViewModel.referencePerson = new ReferencePerson();
                    proUpdateViewModel.referencePerson.ReferencePersonID = -1;
                }
            }
            else
            {
                ViewBag.ButtonName = "Tạo mới";

                proUpdateViewModel.employmentHistory = new EmploymentHistory();
                proUpdateViewModel.employmentHistory.EmploymentHistoryID = -1;
                proUpdateViewModel.educationHistory = new EducationHistory();
                proUpdateViewModel.educationHistory.EducationHistoryID = -1;
                proUpdateViewModel.referencePerson = new ReferencePerson();
                proUpdateViewModel.referencePerson.ReferencePersonID = -1;
            }

            return(View(proUpdateViewModel));
        }
Esempio n. 10
0
        public bool UpdateEducationHistory(EducationHistory educationHistory, int profileID)
        {
            if (!String.IsNullOrEmpty(educationHistory.Subject)
                && !String.IsNullOrEmpty(educationHistory.School))
            {
                if (educationHistory.EducationHistoryID == -2)
                {
                    return false;
                }
                else if (educationHistory.EducationHistoryID == -1)
                {
                    // Add new
                    educationHistory.ProfileID = profileID;
                    educationHistory.IsDeleted = false;
                    this.EducationHistoryRepository.Insert(educationHistory);
                    this.Save();
                }
                else
                {
                    // Update
                    educationHistory.ProfileID = profileID;
                    educationHistory.IsDeleted = false;
                    this.EducationHistoryRepository.Update(educationHistory);
                    this.Save();
                }

                return true;
            }

            return false;
        }