Exemple #1
0
        public async Task ProceedForReview(long id)
        {
            // call identity to request for officer
            // call request micro to proceed for review
            var request = await _apiClient.RequestSdk.GetByID(id);

            if (request != null)
            {
                ProceedForReviewParam param = new ProceedForReviewParam
                {
                    RequestID = id
                };
                IdentityFilter identityFilter = new IdentityFilter
                {
                    RequestTypes = new RequestType[] { request.Type }
                };
                var premise = request.Premises?.FirstOrDefault(e => e.IsPrimary);
                if (premise != null)
                {
                    string node    = premise.Postal.Substring(0, 2).Trim();
                    var    officer = await _apiClient.IdentitySdk.GetCertAuditor(node, identityFilter);

                    if (officer != null)
                    {
                        Officer assignOfficer = new Officer
                        {
                            ID   = officer.ID,
                            Name = officer.Name
                        };
                        param.AssignOfficer = assignOfficer;
                    }
                    await _apiClient.RequestSdk.ProceedForReview(param);
                }
            }
        }
Exemple #2
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);
        }
Exemple #3
0
 public async Task <IList <Identity> > List(IdentityFilter filter)
 {
     return(await _apiClient.IdentitySdk.List(filter));
 }