public IActionResult Review(int id)
        {
            var reward = _rewardService.GetReward(id);

            if (reward == null)
            {
                return(NotFound());
            }

            if (reward.Review?.IsApproved != null)
            {
                return(View("Status", new StatusViewModel
                {
                    Message = "This reward has already been reviewed."
                }));
            }

            return(View(reward));
        }
Example #2
0
        public async Task <IActionResult> RewardeesAsync(int id)
        {
            var reward = _rewardService.GetReward(id);

            if (reward == null)
            {
                return(NotFound());
            }

            var authResult = await _authorizationService.AuthorizeAsync(User, reward, Policy.CanEmail);

            if (!authResult.Succeeded)
            {
                return(Forbid());
            }

            return(View("Compose", new EmailInputModel
            {
                To = $"Rewardees of {reward.Name}",
                RedirectUrl = $"{Request.PathBase}/MyRewards/Rewardees/{id}"
            }));
        }
Example #3
0
        public IActionResult View(int id)
        {
            var reward = _rewardService.GetReward(id);

            if (reward == null)
            {
                return(View("Error", new ErrorViewModel
                {
                    Message = "This reward does not exist."
                }));
            }

            if (reward.Review?.IsApproved != true)
            {
                return(Forbid());
            }

            return(View(reward));
        }
Example #4
0
        private List <BillingResult> GetExcelItems(string path)
        {
            var result = new List <BillingResult>();

            try
            {
                IWorkbook workbook;
                using (FileStream file = new FileStream(path, FileMode.Open, FileAccess.Read))
                {
                    workbook = WorkbookFactory.Create(file);
                }

                var importer = new Mapper(workbook);
                var items    = importer.Take <BillingReport>(0).Select(y => y.Value).ToList <BillingReport>();


                var batchID = Guid.NewGuid().ToString();

                if (items != null)
                {
                    result = items.Select(x => new BillingResult
                    {
                        Amount           = rewardService.GetReward(x.Count),
                        AccountName      = string.IsNullOrEmpty(GetAccountName(x.BankCode, FormatAccountNumber(x.AccountNumber))) ? x.AccountName : GetAccountName(x.BankCode, FormatAccountNumber(x.AccountNumber)),
                        AccountNumber    = FormatAccountNumber(x.AccountNumber),
                        AgrntMgrInstCode = FormatInstitutionCode(x.AgtMgrInstCode),
                        AgrntMgrInstName = x.AgtMgrInstName,
                        BankCode         = FormatBankCode(x.BankCode),
                        Narration        = MySessions.CurrentFileName,
                        Count            = x.Count, AgentCode = x.AgentCode,
                        SN = x.SN
                    }).ToList();
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }


            return(result);
        }
Example #5
0
        public IActionResult View(int id)
        {
            var reward = _rewardService.GetReward(id);

            if (reward == null)
            {
                return(NotFound());
            }

            if (reward.CreatorId != User.FindFirstValue(ClaimTypes.NameIdentifier))
            {
                return(Forbid());
            }

            return(View(reward));
        }