예제 #1
0
        public ActionResult RejectAll(int awardId)
        {
            _logger.Log("Review-RejectAll-GET");

            var nominationInCurrentAwardPeriod = new List <Nomination>();
            var nominationIdsToReject          = new List <int>();
            var awards = _awardService.GetAllAwards();

            if (awardId == 0)
            {
                var customeDatesFoAllAwards = _customDateService.GetAllCustomDates();
                if (customeDatesFoAllAwards.Count > 0)
                {
                    var awardIsWithCustomdate = customeDatesFoAllAwards.Select(x => x.AwardId).ToList();
                    foreach (var customDate in customeDatesFoAllAwards)
                    {
                        nominationInCurrentAwardPeriod.AddRange(_nominationService.GetNominationsByDate(customDate.Month.Value, customDate.Year.Value, customDate.AwardId));
                    }

                    awards = awards.Where(x => !awardIsWithCustomdate.Contains(x.Id));

                    nominationInCurrentAwardPeriod.AddRange(GetnominationInCurrentAwardPeriod(awards.ToList()));
                }
                else
                {
                    nominationInCurrentAwardPeriod = GetnominationInCurrentAwardPeriod(awards.ToList());
                }
            }
            else
            {
                var customDate = _customDateService.GetCustomDate(awardId);

                nominationInCurrentAwardPeriod = _nominationService.GetNominationsByDate(customDate.Month, customDate.Year, awardId);
            }

            foreach (var item in nominationInCurrentAwardPeriod)
            {
                var shortlist = _encourageDatabaseContext.Query <Shortlist>().Any(x => x.NominationId == item.Id && x.IsWinner == false);
                if (shortlist)
                {
                    nominationIdsToReject.Add(item.Id);
                }
            }

            foreach (var nominationIdToreject in nominationIdsToReject)
            {
                _resultService.UnShortlistNomination(nominationIdToreject);
            }
            return(RedirectToAction("Index", "Home"));
        }
예제 #2
0
        public ActionResult Index()
        {
            var awards = _awardService.GetAllAwards().Select(x => new AwardViewModel()
            {
                AwardId    = x.Id,
                AwardCode  = x.Code,
                AwardTitle = x.Name
            }
                                                             ).ToList();

            var emailTemplateViewModel = new EmailTemplateViewModel()
            {
                Awards = awards
            };
            var emailTemplates = _emailTemplateService.GetAllTemplates();

            foreach (var template in emailTemplates)
            {
                emailTemplateViewModel.ProcessesViewModel.Add(new ProcessesViewModel()
                {
                    Id = template.Id, Name = template.TemplateName
                });
            }

            return(View(emailTemplateViewModel));
        }
예제 #3
0
        public ActionResult AddNomination()
        {
            _logger.Log("Nomination-AddNomination-GET");

            var model            = new NominationViewModel();
            var userEmailAddress = User.Identity.Name;
            var projects         = _awardService.GetProjectsUnderCurrentUserAsManager(userEmailAddress);
            var listOfAwards     = _awardService.GetAllAwards();

            if (projects.Any())
            {
                model.ProjectsUnderCurrentUser = new SelectList(projects, "Id", "Name");
            }

            var depts = _awardService.GetDepartmentsUnderCurrentUserAsManager(userEmailAddress);

            if (depts.Count > 0)
            {
                model.DepartmentsUnderCurrentUser = new SelectList(depts, "Id", "Name");
            }

            foreach (var award in listOfAwards)
            {
                switch (award.Code)
                {
                default:
                case "SOM":
                    model.SomCustomDate = _customDateService.GetCustomDate(award.Id);
                    break;

                case "PINNACLE":
                    model.PinnacleCustomDate = _customDateService.GetCustomDate(award.Id);
                    break;
                }
            }

            model.Resources    = new SelectList(new List <User>(), "Id", "DisplayName");
            model.ListOfAwards = new SelectList(listOfAwards, "Id", "Name");
            model.ManagerId    = _awardService.GetUserIdFromEmail(userEmailAddress);

            return(View(model));
        }
예제 #4
0
        public ActionResult Awards()
        {
            var awards = _awardService.GetAllAwards();

            return(View(awards));
        }