示例#1
0
        public virtual ActionResult UpdateProgression(StudentIndex item)
        {
            var internshipApplication = _applicationRepository.GetById(item.Id);

            var currentStudent = _studentRepository.GetById(_httpContext.GetUserId());

            if (internshipApplication == null || currentStudent == null)
            {
                return(HttpNotFound());
            }

            bool applicationIsAssociatedToCurrentStudent = (internshipApplication.StudentId == currentStudent.Id);

            bool nextProgressionWasSuccessfullySet = this.SetNextProgression(internshipApplication, item.LastProgressionUpdateDate);

            if (!applicationIsAssociatedToCurrentStudent || !nextProgressionWasSuccessfullySet)
            {
                return(HttpNotFound());
            }

            _applicationRepository.Update(internshipApplication);

            if (internshipApplication.Progression == InternshipApplication.ApplicationStatus.CompanyAcceptedStudent)
            {
                _notificationService.RoleGroupNotification(RoleNames.Student,
                                                           WebMessage.NotificationMessage.ACompanyChoosedYouForOneOfTheirOffer(internshipApplication.InternshipOffer.Company.Name),
                                                           "InternshipApplication", "StudentApplicationIndex");

                _notificationService.RoleGroupNotification(RoleNames.Coordinator,
                                                           WebMessage.NotificationMessage.ACompanyChoosedStudentOneOfTheirOffer(internshipApplication.InternshipOffer.Company.Name,
                                                                                                                                internshipApplication.ApplyingStudent.FirstName + " " + internshipApplication.ApplyingStudent.LastName),
                                                           "InternshipApplication", "CoordinatorApplicationIndex");
            }
            else if (internshipApplication.Progression == InternshipApplication.ApplicationStatus.StudentAcceptedOffer)
            {
                _notificationService.CompanyNotification(internshipApplication.InternshipOffer.Company,
                                                         WebMessage.NotificationMessage.AStudentAcceptedYourInternshipOffer(internshipApplication.ApplyingStudent.FirstName, internshipApplication.ApplyingStudent.LastName),
                                                         "InternshipOffer", "EmployeePublicatedOffersIndex");

                _notificationService.RoleGroupNotification(RoleNames.Coordinator,
                                                           WebMessage.NotificationMessage.AStudentHasBeenSelected(internshipApplication.ApplyingStudent.FirstName, internshipApplication.ApplyingStudent.LastName),
                                                           "InternshipApplication", "CoordinatorApplicationIndex");
            }

            const string feedbackMessage = WebMessage.InternshipApplicationMessage.APPLICATION_PROGRESSION_UPDATE_SUCCESS;

            return(RedirectToAction(MVC.InternshipApplication.StudentApplicationIndex().Success(feedbackMessage)));
        }
 private void LoadDisciplines(long SemesterID)
 {
     studentIndex = App.API.StudentGetIndex(SemesterID);
     CurrentSemID = SemesterID;
     Title        = $"БРС - {SemesterList.Find(s => s.Id == CurrentSemID)}";
     DisciplineItems.Clear();
     if (studentIndex.Disciplines.Length != 0)
     {
         EmptyListText.IsVisible = false;
         foreach (var d in studentIndex.Disciplines)
         {
             var percent = (d.MaxCurrentRate != 0 ? ((d.Rate == null) ? 0 : Math.Min((int)d.Rate, 100)) / (double)d.MaxCurrentRate : 0).ToString("P0");
             DisciplineItems.Add(new DisciplineItem(d.Id, percent, d.SubjectName, $"{((d.Rate == null) ? 0 : d.Rate)}/{d.MaxCurrentRate}/100"));
         }
     }
     else
     {
         EmptyListText.IsVisible = true;
     }
 }
示例#3
0
        private void SetInternshipApplicationViewModelContent(StudentIndex application)
        {
            switch (application.Progression)
            {
            case Stagio.Domain.Entities.InternshipApplication.ApplicationStatus.StudentHasApplied:
                application.ProgressionPercentage         = 25;
                application.ProgressionDescription        = WebMessage.InternshipApplicationMessage.StudentHasApplied.PROGRESSION_DESCRIPTION;
                application.ProgessionUpdateHtmlContent   = WebMessage.InternshipApplicationMessage.StudentHasApplied.PROGRESSION_UPDATE_HTML_CONTENT;
                application.ProgessionUpdateHtmlTitle     = WebMessage.InternshipApplicationMessage.StudentHasApplied.PROGRESSION_UPDATE_HTML_TITLE;
                application.LastProgressionUpdateDateText = WebMessage.InternshipApplicationMessage.StudentHasApplied.PROGRESSION_UPDATE_DATE_TEXT;
                break;

            case Stagio.Domain.Entities.InternshipApplication.ApplicationStatus.StudentHadInterview:
                application.ProgressionPercentage         = 50;
                application.ProgressionDescription        = WebMessage.InternshipApplicationMessage.StudentHadInterview.PROGRESSION_DESCRIPTION;
                application.ProgessionUpdateHtmlContent   = WebMessage.InternshipApplicationMessage.StudentHadInterview.PROGRESSION_UPDATE_HTML_CONTENT;
                application.ProgessionUpdateHtmlTitle     = WebMessage.InternshipApplicationMessage.StudentHadInterview.PROGRESSION_UPDATE_HTML_TITLE;
                application.LastProgressionUpdateDateText = WebMessage.InternshipApplicationMessage.StudentHadInterview.PROGRESSION_UPDATE_DATE_TEXT;
                break;

            case Stagio.Domain.Entities.InternshipApplication.ApplicationStatus.CompanyAcceptedStudent:
                application.ProgressionPercentage         = 75;
                application.ProgressionDescription        = WebMessage.InternshipApplicationMessage.CompanyAcceptedStudent.PROGRESSION_DESCRIPTION;
                application.ProgessionUpdateHtmlContent   = WebMessage.InternshipApplicationMessage.CompanyAcceptedStudent.PROGRESSION_UPDATE_HTML_CONTENT;
                application.ProgessionUpdateHtmlTitle     = WebMessage.InternshipApplicationMessage.CompanyAcceptedStudent.PROGRESSION_UPDATE_HTML_TITLE;
                application.LastProgressionUpdateDateText = WebMessage.InternshipApplicationMessage.CompanyAcceptedStudent.PROGRESSION_UPDATE_DATE_TEXT;
                break;

            case Stagio.Domain.Entities.InternshipApplication.ApplicationStatus.StudentAcceptedOffer:
                application.ProgressionPercentage         = 100;
                application.ProgressionDescription        = WebMessage.InternshipApplicationMessage.StudentAcceptedOffer.PROGRESSION_DESCRIPTION;
                application.ProgessionUpdateHtmlContent   = WebMessage.InternshipApplicationMessage.StudentAcceptedOffer.PROGRESSION_UPDATE_HTML_CONTENT;
                application.ProgessionUpdateHtmlTitle     = WebMessage.InternshipApplicationMessage.StudentAcceptedOffer.PROGRESSION_UPDATE_HTML_TITLE;
                application.LastProgressionUpdateDateText = WebMessage.InternshipApplicationMessage.StudentAcceptedOffer.PROGRESSION_UPDATE_DATE_TEXT;
                break;

            default:
                break;
            }
        }