Beispiel #1
0
        public ActionResult Details(int applicationId)
        {
            // get application
            Application application = _applicationsRepository.GetApplicationById(applicationId);

            // get current user logged in
            int userIdCurrentlyLoggedIn = Int32.Parse(User.Claims.FirstOrDefault(uc => uc.Type == ClaimTypes.NameIdentifier).Value);

            // check if application does not exists
            if (application == null)
            {
                return(NotFound());
            }

            // check if application is not made by the applicant
            if (User.IsInRole("candidate"))
            {
                ViewBag.SelectedNav = "Profile";
                if (application.JobFinderUser.UserId != userIdCurrentlyLoggedIn)
                {
                    return(NotFound());
                }
            }

            // check if company user is not assigned to see the job listing
            if (User.IsInRole("hr"))
            {
                ViewBag.SelectedNav = "Dashboard";
                int companyId = application.JobListing.Company.CompanyId;
                if (!_companyUsersRepository.CompanyUserExists(userIdCurrentlyLoggedIn, companyId))
                {
                    return(NotFound());
                }
            }

            // retrieve data for application
            ApplicationEducation      applicationEducation      = _applicationEducationsRepository.GetApplicationEducationForApplication(applicationId);
            ApplicationWorkExperience applicationWorkExperience = _applicationWorkExperience.GetApplicationWorkExperienceForApplication(applicationId);
            ApplicationSkill          applicationSkill          = _applicationSkillsRepository.GetApplicationSkillForApplication(applicationId);

            // build a list for potential application statuses
            List <string> ApplicationStatuses = new List <string> {
                "Pending", "Contacted", "Accepted", "Rejected"
            };

            // build up a view model with all the data required to see an application
            ViewApplicationViewModel viewApplicationViewModel = new ViewApplicationViewModel
            {
                Application               = application,
                ApplicationEducation      = applicationEducation,
                ApplicationSkill          = applicationSkill,
                ApplicationWorkExperience = applicationWorkExperience,
                OtherNotes           = application.OtherNotes,
                Status               = application.Status,
                ApplicationWrittenAt = application.ApplicationWrittenAt
            };

            ViewBag.ApplicationStatuses = new SelectList(ApplicationStatuses, ApplicationStatuses);
            return(View(viewApplicationViewModel));
        }
        public void LoadApplicant(int appid)
        {
            try
            {
                using (var db = new LetranIntegratedSystemEntities())
                {
                    var findapp = db.HRISOnlineJobApplications.Find(appid);

                    if (findapp != null)
                    {
                        //Personal Information
                        txtFirstName.Text  = findapp.FirstName;
                        txtMiddleName.Text = findapp.MiddleName;
                        txtLastName.Text   = findapp.LastName;
                        txtAddress.Text    = findapp.CityAddress;
                        txtTelNo.Text      = findapp.TelephoneNo;
                        txtMobileNo.Text   = findapp.MobileNo;
                        txtAge.Text        = findapp.Age;
                        if (findapp.Gender == "Male")
                        {
                            rbMale.IsChecked = true;
                        }
                        else
                        {
                            rbFemale.IsChecked = false;
                        }
                        dpBirthday.SelectedDate = findapp.Birthday;
                        txtPlaceBirth.Text      = findapp.Birthplace;
                        cbCivilStatus.Text      = findapp.CivilStatus;
                        txtCitizenship.Text     = findapp.Citizenship;
                        txtReligion.Text        = findapp.Religion;
                        txtTIN.Text             = findapp.TIN;
                        txtSSS.Text             = findapp.SSS;
                        txtPagibig.Text         = findapp.PAGIBIG;
                        txtPhilhealth.Text      = findapp.PHILHEALTH;

                        //Educational Information
                        AEList                   = new List <ApplicationEducation>();
                        cbEduc.ItemsSource       = db.EducationalLevels.ToList();
                        cbEduc.DisplayMemberPath = "EducLevelName";
                        cbEduc.SelectedValuePath = "EducLevelID";

                        var appeduc = db.HRISOnlineJobApplicationEducations.Where(m => m.ApplicationID == findapp.ApplicationID).ToList();
                        foreach (var x in appeduc)
                        {
                            ApplicationEducation ae = new ApplicationEducation();
                            ae.EducLevelID   = x.EducationType.Value;
                            ae.Course        = x.Course;
                            ae.Honor         = x.Honors;
                            ae.InclusiveDate = x.InclusiveDates;
                            ae.SchoolName    = x.SchoolAddress;
                            AEList.Add(ae);
                        }
                        dgEduc.ItemsSource = AEList;

                        //Professional Licenses
                        APList = new List <ApplicationProfessionalLicense>();
                        var applicense = db.HRISOnlineJobApplicationLicenses.Where(m => m.ApplicationID == findapp.ApplicationID).ToList();
                        foreach (var x in applicense)
                        {
                            ApplicationProfessionalLicense apl = new ApplicationProfessionalLicense();
                            apl.ExamDate   = x.ExamDate.Value;
                            apl.ExamPassed = x.ExamPassed;
                            apl.ExamPlace  = x.ExamPlace;
                            apl.Rating     = x.Rating;
                            APList.Add(apl);
                        }
                        dgProf.ItemsSource = APList;

                        //Work Experience
                        AWEList = new List <ApplicationWorkExperience>();
                        var appwork = db.HRISOnlineJobApplicationWorkExperiences.Where(m => m.ApplicationID == findapp.ApplicationID).ToList();
                        foreach (var x in appwork)
                        {
                            ApplicationWorkExperience awe = new ApplicationWorkExperience();
                            awe.Company          = x.CompanyName;
                            awe.InclusiveDate    = x.InclusiveDate;
                            awe.LastSalary       = x.LastSalary;
                            awe.Position         = x.Position;
                            awe.ReasonforLeaving = x.ReasonLeaving;
                            AWEList.Add(awe);
                        }
                        dgWorkExp.ItemsSource = AWEList;

                        //Seminars / Training Attended
                        ASList = new List <ApplicationSeminar>();
                        var appsem = db.HRISOnlineJobApplicationSeminars.Where(m => m.ApplicationID == findapp.ApplicationID).ToList();
                        foreach (var x in appsem)
                        {
                            ApplicationSeminar asem = new ApplicationSeminar();
                            asem.InclusiveDate = x.InclusiveDate;
                            asem.Seminar       = x.Title;
                            asem.Venue         = x.Venue;
                            ASList.Add(asem);
                        }
                        dgSem.ItemsSource = ASList;

                        //Additional Qualifications
                        txtSpecialskill.Text = findapp.SpecialSkills;
                        txtLanguage.Text     = findapp.LanguagesSpeak;
                        txtMachine.Text      = findapp.MachinesOperate;

                        txtKnowledge.Text  = findapp.AdditionalKnowledge;
                        txtImpairment.Text = findapp.PhyschologicalImpairments;

                        cbStatus.SelectedValue = Convert.ToInt32(findapp.ApplicationStatusID);
                    }
                    else
                    {
                        MessageBox.Show("Applicant not found.", "System Warning!", MessageBoxButton.OK, MessageBoxImage.Warning);
                    }
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Something went wrong.", "System Error!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Beispiel #3
0
        public ActionResult Create(int jobId, IFormCollection collection)
        {
            Template jobTemplate             = _templatesRepository.GetTemplateByJobId(jobId);
            int      userIdCurrentlyLoggedIn = Int32.Parse(User.Claims.FirstOrDefault(uc => uc.Type == ClaimTypes.NameIdentifier).Value);

            Application application = new Application
            {
                Status = "Pending",
                UserId = userIdCurrentlyLoggedIn,
                ApplicationWrittenAt = DateTime.Now,
                JobListingId         = jobId
            };

            if (jobTemplate.OtherNotes == 1)
            {
                application.OtherNotes = collection["otherNotes"];
            }

            int ApplicationId = _applicationsRepository.AddApplication(application);

            if (jobTemplate.WorkExperience == 1)
            {
                ApplicationWorkExperience newApplicationWorkExperience = new ApplicationWorkExperience
                {
                    CompanyName      = collection["workExpCompanyName"],
                    StartDate        = DateTime.Parse(collection["workExpStartDate"]),
                    EndDate          = DateTime.Parse(collection["workExpEndDate"]),
                    Position         = collection["workExpPosition"],
                    Responsibilities = collection["workExpResponsibilities"],
                    Duties           = collection["workExpDuties"],
                    ApplicationId    = ApplicationId
                };
                _dbContext.ApplicationWorkExperiences.Add(newApplicationWorkExperience);
                _dbContext.SaveChanges();
            }
            if (jobTemplate.Skills == 1)
            {
                ApplicationSkill newApplicationSkill = new ApplicationSkill
                {
                    Name          = collection["skillName"],
                    Rating        = Int16.Parse(collection["skillRating"]),
                    Description   = collection["skillDescription"],
                    ApplicationId = ApplicationId
                };
                _dbContext.ApplicationSkills.Add(newApplicationSkill);
                _dbContext.SaveChanges();
            }
            if (jobTemplate.Education == 1)
            {
                ApplicationEducation newApplicationEducation = new ApplicationEducation
                {
                    SchoolName    = collection["schoolName"],
                    StartDate     = DateTime.Parse(collection["educationStartDate"]),
                    EndDate       = DateTime.Parse(collection["educationEndDate"]),
                    Degree        = collection["educationDegree"],
                    ApplicationId = ApplicationId
                };
                _dbContext.ApplicationEducations.Add(newApplicationEducation);
                _dbContext.SaveChanges();
            }

            ViewBag.SelectedNav = "Jobs";
            return(RedirectToAction("Index", "Jobs"));
        }