Esempio n. 1
0
        public void Should_GetAllEnquiryRepliesByTenderId_ReturnEnquiry()
        {
            _enquiryQueries.Setup(x => x.GetAllEnquiryRepliesByTenderId(It.IsAny <SimpleSearchCretriaModel>()))
            .Returns(() =>
            {
                return(Task.FromResult(new QueryResult <Core.Entities.Enquiry>(new List <Core.Entities.Enquiry> {
                    new Core.Entities.Enquiry()
                }, 1, 1, 1)));
            });
            var criteria = new SimpleSearchCretriaModel();

            var result = _sut.GetAllEnquiryRepliesByTenderId(criteria);

            Assert.NotNull(result);
            Assert.IsType <QueryResult <Core.Entities.Enquiry> >(result.Result);
        }
Esempio n. 2
0
        public async Task GetInvitedCommitesByEnquiryId_Returns_Data()
        {
            var _simpleSearchCretriaModel = new SimpleSearchCretriaModel()
            {
                EnquiryId = 1
            };

            var result = await _enquiryController.GetInvitedCommitesByEnquiryId(_simpleSearchCretriaModel);

            Assert.NotNull(result);
            Assert.IsType <QueryResult <JoinTechnicalCommitteeModel> >(result);
            Assert.NotEmpty(result.Items);
            Assert.True(result.PageSize > 0);
            Assert.True(result.PageNumber > 0);
            Assert.True(result.TotalCount > 0);
        }
Esempio n. 3
0
        public void Should_GetInvitedCommitesByEnquiryId()
        {
            _enquiryQueries.Setup(x => x.GetInvitedCommitesByEnquiryId(It.IsAny <SimpleSearchCretriaModel>()))
            .Returns(() =>
            {
                return(Task.FromResult(new QueryResult <JoinTechnicalCommitteeModel>(new List <JoinTechnicalCommitteeModel> {
                    new JoinTechnicalCommitteeModel()
                }, 1, 1, 1)));
            });
            var criteria = new SimpleSearchCretriaModel();

            var result = _sut.GetInvitedCommitesByEnquiryId(criteria);

            Assert.NotNull(result);
            Assert.IsType <QueryResult <JoinTechnicalCommitteeModel> >(result.Result);
        }
Esempio n. 4
0
        public async Task GetAllEnquiryRepliesByEnquiryId_Returns_Data()
        {
            var _simpleSearchCretriaModel = new SimpleSearchCretriaModel()
            {
                EnquiryIdString = Util.Encrypt(1)
            };

            var result = await _enquiryController.GetAllEnquiryRepliesByEnquiryId(_simpleSearchCretriaModel);

            Assert.NotNull(result);
            Assert.IsType <QueryResult <EnquiryReplyModel> >(result);
            Assert.NotEmpty(result.Items);
            Assert.True(result.PageSize > 0);
            Assert.True(result.PageNumber > 0);
            Assert.True(result.TotalCount > 0);
        }
Esempio n. 5
0
        public async Task <QueryResult <Enquiry> > GetAllEnquiryRepliesByTenderId(SimpleSearchCretriaModel search)
        {
            var TechnicalCommitteIdForTender = (await _context.Tenders.Where(x => x.TenderId == search.TenderId).FirstOrDefaultAsync()).TechnicalOrganizationId.Value;
            var enquiryReplyList             = await _context.Enquiries
                                               .Include(x => x.Tender)
                                               .ThenInclude(c => c.TechnicalOrganization)
                                               .ThenInclude(c => c.CommitteeUsers)
                                               .Include(x => x.JoinTechnicalCommittees)
                                               .ThenInclude(x => x.Committee.CommitteeUsers)
                                               .Include(x => x.Supplier)
                                               .Include(x => x.EnquiryReplies)
                                               .ThenInclude(x => x.Committee.CommitteeUsers)
                                               .Where(x => x.TenderId == search.TenderId && x.IsActive == true && x.Tender.TechnicalOrganizationId != null)
                                               .WhereIf(isInRole(RoleNames.TechnicalCommitteeUser) && _httpContextAccessor.HttpContext.User.SelectedCommittee() != TechnicalCommitteIdForTender, x => x.JoinTechnicalCommittees.Any(y => y.CommitteeId == _httpContextAccessor.HttpContext.User.SelectedCommittee() && y.IsActive == true))
                                               .OrderBy(x => x.EnquiryReplies.Count)
                                               .ThenByDescending(x => x.CreatedAt)
                                               .ToQueryResult(search.PageNumber, search.PageSize);

            return(enquiryReplyList);
        }
Esempio n. 6
0
        public async Task <ActionResult> GetInvitedCommitesByEnquiryId(SimpleSearchCretriaModel criteria)
        {
            try
            {
                var result = await _ApiClient.GetQueryResultAsync <JoinTechnicalCommitteeModel>("Enquiry/GetInvitedCommitesByEnquiryId", criteria.ToDictionary());

                return(Json(new PaginationModel(result.Items, result.TotalCount, _pageSize, result.PageNumber, null)));
            }
            catch (AuthorizationException ex)
            {
                throw ex;
            }
            catch (BusinessRuleException ex)
            {
                return(JsonErrorMessage(ex.Message));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.ToString(), ex);
                return(JsonErrorMessage(Resources.TenderResources.ErrorMessages.UnexpectedError));
            }
        }
Esempio n. 7
0
        public async Task <ActionResult> GetAllEnquiryRepliesByTenderIdSerach(SimpleSearchCretriaModel criteria)
        {
            try
            {
                criteria.TenderId = Util.Decrypt(criteria.TenderIdString);
                var result = await _ApiClient.GetQueryResultAsync <EnquiryModel>("Enquiry/GetAllEnquiryRepliesByTenderId", criteria.ToDictionary());

                return(Json(new PaginationModel(result.Items, result.TotalCount, result.PageSize, result.PageNumber, null)));
            }
            catch (AuthorizationException ex)
            {
                throw ex;
            }
            catch (BusinessRuleException ex)
            {
                return(JsonErrorMessage(ex.Message));
            }
            catch (Exception ex)
            {
                _logger.LogError(ex.ToString(), ex);
                return(JsonErrorMessage(Resources.TenderResources.ErrorMessages.UnexpectedError));
            }
        }
Esempio n. 8
0
        public async Task GetAllEnquiryRepliesByTenderId_BySearchCriteria_Returns_Data()
        {
            var _userId = "1";

            _claims = new Claim[1] {
                new Claim(IdentityConfigs.Claims.NameIdentifier, _userId)
            };
            _enquiryController = _enquiryController.WithIdentity(_claims);

            var _simpleSearchCretriaModel = new SimpleSearchCretriaModel()
            {
                TenderId = 18
            };

            var result = await _enquiryController.GetAllEnquiryRepliesByTenderId(_simpleSearchCretriaModel);

            Assert.NotNull(result);
            Assert.IsType <QueryResult <EnquiryModel> >(result);
            Assert.NotEmpty(result.Items);
            Assert.True(result.PageSize > 0);
            Assert.True(result.PageNumber > 0);
            Assert.True(result.TotalCount > 0);
        }
Esempio n. 9
0
        public async Task <QueryResult <Enquiry> > GetAllEnquiryRepliesByTenderId(SimpleSearchCretriaModel criteria)
        {
            var result = await _enquiryQueries.GetAllEnquiryRepliesByTenderId(criteria);

            return(result);
        }
Esempio n. 10
0
        public async Task <QueryResult <JoinTechnicalCommitteeModel> > GetInvitedCommitesByEnquiryId(SimpleSearchCretriaModel criteria)
        {
            var result = await _enquiryQueries.GetInvitedCommitesByEnquiryId(criteria);

            return(result);
        }
Esempio n. 11
0
        public async Task <QueryResult <JoinTechnicalCommitteeModel> > GetInvitedCommitesByEnquiryId(SimpleSearchCretriaModel search)
        {
            var enquiryInternalComments = await _context.JoinTechnicalCommittees
                                          .Where(c => c.EnquiryId == search.EnquiryId && c.IsActive == true)
                                          .Select(x => new JoinTechnicalCommitteeModel
            {
                JoinTechnicalCommitteeId = x.JoinTechnicalCommitteeId,
                CommitteeName            = x.Committee.CommitteeName,
                InternelComments         = x.Enquiry.EnquiryReplies.Where(r => r.EnquiryId == search.EnquiryId && x.IsActive == true && r.IsActive == true && r.IsComment == true)
                                           .Select(r => new CommentModel
                {
                    InternelComment = r.EnquiryReplyMessage
                }).ToList(),     //r => r.EnquiryReplyMessage);.ToList(),
                //EnquiryComment = x.Enquiry.EnquiryReplies.FirstOrDefault(r => r.EnquiryId == search.EnquiryId && r.IsActive == true && r.IsComment == true).EnquiryReplyMessage,
                ReplyId = x.Enquiry.EnquiryReplies.FirstOrDefault(r => r.EnquiryId == search.EnquiryId && r.IsActive == true && r.IsComment == true).EnquiryReplyId
            })
                                          .ToQueryResult(search.PageNumber, search.PageSize);

            return(enquiryInternalComments);
        }
Esempio n. 12
0
        public async Task <QueryResult <EnquiryReplyModel> > GetAllEnquiryRepliesByEnquiryId(SimpleSearchCretriaModel criteria)
        {
            criteria.EnquiryId = Util.Decrypt(criteria.EnquiryIdString);
            var enquiryReplyList = await _context.EnquiryReplies
                                   .Where(t => t.EnquiryId == criteria.EnquiryId && t.IsActive == true)
                                   .Select(t => new EnquiryReplyModel
            {
                EnquiryReplyStatusId = t.EnquiryReplyStatusId,
                EnquiryReplyMessage  = t.EnquiryReplyMessage,
                EnquiryReplyIdString = Util.Encrypt(t.EnquiryReplyId),
                EnquiryReplyDate     = t.UpdatedAt,
                CreationDate         = t.CreatedAt,
                IsComment            = (bool)t.IsComment,
                CommitteeId          = (int)t.CommitteeId,
                CommitteeName        = t.Committee.CommitteeName
            }).ToQueryResult(criteria.PageNumber, criteria.PageSize);

            return(enquiryReplyList);
        }
Esempio n. 13
0
        public async Task <QueryResult <EnquiryModel> > GetAllEnquiryRepliesByTenderId(SimpleSearchCretriaModel criteria)
        {
            bool statusFlag = false;

            if (User.IsInRole(RoleNames.supplier))
            {
                statusFlag = true;
            }
            int userIdFlag = User.UserId();

            criteria.UserId = User.UserId();
            QueryResult <Core.Entities.Enquiry> result = await _enquiryAppService.GetAllEnquiryRepliesByTenderId(criteria);

            QueryResult <EnquiryModel> enquiryModel = _mapper.Map <QueryResult <EnquiryModel> >(result, opt => { opt.Items[nameof(statusFlag)] = statusFlag; opt.Items[nameof(userIdFlag)] = userIdFlag; });

            return(enquiryModel);
        }
Esempio n. 14
0
        public async Task <QueryResult <EnquiryReplyModel> > GetAllEnquiryRepliesByEnquiryId(SimpleSearchCretriaModel criteria)
        {
            var enquiryModel = await _enquiryAppService.GetAllEnquiryRepliesByEnquiryId(criteria);

            return(enquiryModel);
        }