Пример #1
0
        public async Task Review(IList <Review> reviews)
        {
            var recommendParam = new RecommendParam();

            recommendParam.Reviews = reviews;

            await _apiClient.RequestSdk.Review(recommendParam);
        }
Пример #2
0
 public Task <string> Review(RecommendParam recommendParam)
 {
     return(_requestProvider.BuildUpon(_url)
            .Uri($"/api/request/review")
            .Method(HttpMethod.Post)
            .Content(new JsonContent(recommendParam))
            .AddInterceptor(new JsonDeserializerInterceptor())
            .Execute <string>());
 }
Пример #3
0
        public async Task <string> Review([FromBody] RecommendParam recommendParam, Guid userID,
                                          string userName)
        {
            foreach (var review in recommendParam.reviews)
            {
                review.ReviewerID   = userID;
                review.ReviewerName = userName;
            }

            await _requestservice.Review(recommendParam);

            return("Ok");
        }
Пример #4
0
        public async Task Recommend(RecommendParam recommendParam)
        {
            var hasRejectedItems = recommendParam.reviews
                                   .Any(e => e.LineItems.Any(li => !li.Approved.Value));

            if (hasRejectedItems)
            {
                await Execute(new RecommendRequestWithRejectionCommand(recommendParam.reviews,
                                                                       _eventBus, _emailService, recommendParam.AssignedTo));
            }
            else
            {
                await Execute(new RecommendRequestCommand(recommendParam.reviews, _eventBus));
            }
        }
Пример #5
0
        public async Task Recommend(IList <Review> reviews)
        {
            var recommendParam = new RecommendParam();

            var hasRejectedItems = reviews.Any(e => e.LineItems.Any(li => !li.Approved.Value));

            if (hasRejectedItems)
            {
                var requestID = reviews.First().RequestID;
                var request   = await _apiClient.RequestSdk.GetByID(requestID);

                var    premise = request.Premises?.FirstOrDefault(e => e.IsPrimary);
                string node    = premise.Postal.Substring(0, 2).Trim();

                IdentityFilter identityFilter = new IdentityFilter
                {
                    Permissions = new Permission[] { Permission.RequestReviewApproval },
                    Nodes       = new string[] { node }
                };

                var officers = await _apiClient.IdentitySdk.List(identityFilter);

                if (!officers.Any())
                {
                    throw new BadRequestException("[Missing Request.Review.Approval permission] Cannot " +
                                                  "proceed with the recommendation. No assigned supervisor for the specific " +
                                                  "cluster. Please contact administrator.");
                }

                recommendParam.AssignedTo = new Officer
                {
                    ID   = officers.First().ID,
                    Name = officers.First().Name
                };
            }
            recommendParam.Reviews = reviews;

            await _apiClient.RequestSdk.Recommend(recommendParam);
        }
Пример #6
0
 public async Task Review(RecommendParam recommendParam)
 {
     await Execute(new ReviewRequestCommand(recommendParam.reviews,
                                            _eventBus, _emailService));
 }