Beispiel #1
0
        public virtual ActionResult Create(int internshipOfferId)
        {
            var internshipOffer       = _offerRepository.GetById(internshipOfferId);
            var studentId             = _httpContext.GetUserId();
            var internshipApplication = new InternshipApplication()
            {
                StudentId         = studentId,
                InternshipOfferId = internshipOfferId,
                InternshipOffer   = internshipOffer
            };
            var IAViewModel = Mapper.Map <Create>(internshipApplication);

            return(View(IAViewModel));
        }
Beispiel #2
0
        public virtual ActionResult CoordinatorApplicationIndex()
        {
            var allStudents               = _studentRepository.GetAll().ToList();
            var allApplications           = _applicationRepository.GetAll().ToList();
            var bestProgressionOfStudents = new List <CoordinatorProgressionIndex>();

            foreach (var student in allStudents)
            {
                var studentApplications = allApplications.Where(x => x.ApplyingStudent.Id == student.Id).ToList();
                InternshipApplication mostProgressedApp = null;

                if (studentApplications.Count() != 0)
                {
                    var bestProgressionStatus = studentApplications.Max(x => (InternshipApplication.ApplicationStatus?)x.Progression);
                    mostProgressedApp = studentApplications.First(x => x.Progression == bestProgressionStatus);
                }

                var newStudent = new CoordinatorProgressionIndex
                {
                    StudentId       = student.Id,
                    FirstName       = student.FirstName,
                    LastName        = student.LastName,
                    BestProgression = Mapper.Map <StudentIndex>(mostProgressedApp)
                };

                if (newStudent.BestProgression != null)
                {
                    SetInternshipApplicationViewModelContent(newStudent.BestProgression);
                }
                else
                {
                    newStudent.BestProgression = new StudentIndex();

                    newStudent.BestProgression.ProgressionPercentage         = 0;
                    newStudent.BestProgression.InternshipOfferTitle          = WebMessage.GlobalMessage.NOT_APPLICABLE;
                    newStudent.BestProgression.ProgressionDescription        = WebMessage.InternshipApplicationMessage.NO_APPLICATION_FOR_THIS_STUDENT;
                    newStudent.BestProgression.ProgessionUpdateHtmlContent   = WebMessage.GlobalMessage.NOT_APPLICABLE;
                    newStudent.BestProgression.ProgessionUpdateHtmlTitle     = WebMessage.GlobalMessage.NOT_APPLICABLE;
                    newStudent.BestProgression.LastProgressionUpdateDateText = WebMessage.GlobalMessage.NOT_APPLICABLE;
                }

                bestProgressionOfStudents.Add(newStudent);
            }

            return(View(MVC.InternshipApplication.Views.ViewNames.CoordinatorIndex, bestProgressionOfStudents));
        }
Beispiel #3
0
        private bool SetNextProgression(InternshipApplication application, DateTime lastUpdateDate)
        {
            switch (application.Progression)
            {
            case Stagio.Domain.Entities.InternshipApplication.ApplicationStatus.StudentHasApplied:
                application.Progression   = InternshipApplication.ApplicationStatus.StudentHadInterview;
                application.InterviewDate = lastUpdateDate;
                break;

            case Stagio.Domain.Entities.InternshipApplication.ApplicationStatus.StudentHadInterview:
                application.Progression         = InternshipApplication.ApplicationStatus.CompanyAcceptedStudent;
                application.CompanyAcceptedDate = lastUpdateDate;
                break;

            case Stagio.Domain.Entities.InternshipApplication.ApplicationStatus.CompanyAcceptedStudent:
                application.Progression         = InternshipApplication.ApplicationStatus.StudentAcceptedOffer;
                application.StudentAcceptedDate = lastUpdateDate;
                break;

            default:
                return(false);
            }
            return(true);
        }