Example #1
0
        public List <AgencyCommunicationRequest> GetAgencyCommunicationRequests()
        {
            Tender tender = new TenderDefault().GetGeneralTender();
            List <AgencyCommunicationRequest> generalAgencyCommunicationRequests = new List <AgencyCommunicationRequest>();
            var communicationRequest = new AgencyCommunicationRequest(agencyRequestId, tenderId, agencyRequestTypeId, statusId, requestedByRoleName);

            communicationRequest.AddTender(tender);
            communicationRequest.UpdatePlaintAgencyCommunicationRequest(1, "no");
            communicationRequest.UpdateAgencyCommunicationRequestStatus(1, "");
            communicationRequest.UpdateAgencyCommunicationPlaintRequestStatus(1, 1, null, "", "");
            AgencyCommunicationPlaintStatus PlaintAcceptanceStatus = new AgencyCommunicationPlaintStatus();

            typeof(AgencyCommunicationPlaintStatus).GetProperty(nameof(AgencyCommunicationPlaintStatus.Name)).SetValue(PlaintAcceptanceStatus, "name");

            typeof(AgencyCommunicationRequest).GetProperty(nameof(AgencyCommunicationRequest.PlaintAcceptanceStatus)).SetValue(communicationRequest, PlaintAcceptanceStatus);
            communicationRequest.Negotiations = new List <Negotiation>();
            generalAgencyCommunicationRequests.Add(communicationRequest);

            var communicationRequest2 = new AgencyCommunicationRequest(2, 2, agencyRequestTypeId, statusId, requestedByRoleName);

            communicationRequest2.AddTender(tender);
            communicationRequest2.Negotiations = new List <Negotiation>();
            generalAgencyCommunicationRequests.Add(communicationRequest2);
            return(generalAgencyCommunicationRequests);
        }
Example #2
0
        public async Task <AgencyCommunicationRequest> UpdateAsync(AgencyCommunicationRequest agencyCommunicationRequest)
        {
            _context.AgencyCommunicationRequests.Update(agencyCommunicationRequest);
            await _context.SaveChangesAsync();

            return(agencyCommunicationRequest);
        }
        public void Should_Construct_AgencyCommunicationRequest()
        {
            AgencyCommunicationRequest communicationRequest = new AgencyCommunicationRequest(TENDER_ID, AGENCY_REQUEST_TYPE_ID, AGENCY_REQUEST__STATUSE_ID, RoleNames.supplier);

            communicationRequest.ShouldNotBeNull();
            communicationRequest.StatusId.ShouldBe((int)Enums.AgencyCommunicationRequestStatus.RequestSent);
        }
        public void Should_UpdateSupplierOfferExtendDatesRequestStatus()
        {
            AgencyCommunicationRequest communicationRequest = new AgencyCommunicationRequest();

            communicationRequest.UpdateSupplierOfferExtendDatesRequestStatus((int)Enums.AgencyCommunicationRequestStatus.UnderRevision);
            communicationRequest.ShouldNotBeNull();
            communicationRequest.StatusId.ShouldBe((int)Enums.AgencyCommunicationRequestStatus.UnderRevision);
        }
        public void Should_UpdateAgencyCommunicationRequestStatus()
        {
            AgencyCommunicationRequest communicationRequest = new AgencyCommunicationRequest();

            communicationRequest.UpdateAgencyCommunicationRequestStatus((int)Enums.AgencyCommunicationRequestStatus.Approved);
            communicationRequest.ShouldNotBeNull();
            communicationRequest.StatusId.ShouldBe((int)Enums.AgencyCommunicationRequestStatus.Approved);
        }
        public void Should_UpdateEscalationRequest()
        {
            AgencyCommunicationRequest communicationRequest = new AgencyCommunicationRequest();

            communicationRequest.UpdateEscalationRequest((int)Enums.AgencyCommunicationRequestStatus.Rejected, REJECTION_REASON);
            communicationRequest.ShouldNotBeNull();
            communicationRequest.EscalationStatusId.ShouldBe((int)Enums.AgencyCommunicationRequestStatus.Rejected);
            communicationRequest.EscalationRejectionReason.ShouldBe(REJECTION_REASON);
        }
Example #7
0
        public void ShouldNegotiationCommunicationRequest()
        {
            AgencyCommunicationRequest agencyRequest         = new AgencyCommunicationRequest();
            NegotiationFirstStage      negotiationFirstStage = new NegotiationDefaults().GetNegotiationFirstStage();

            negotiationFirstStage.SetNegotiationCommunicationRequest(agencyRequest);

            Assert.Equal(negotiationFirstStage.AgencyCommunicationRequest, agencyRequest);
        }
        public void Should_UpdateEscalatePlaint()
        {
            AgencyCommunicationRequest communicationRequest = new AgencyCommunicationRequest();

            communicationRequest.UpdateEscalatePlaint((int)Enums.AgencyPlaintStatus.New, (int)Enums.AgencyCommunicationRequestStatus.RequestSent);

            communicationRequest.ShouldNotBeNull();
            communicationRequest.EscalationStatusId.ShouldBe((int)Enums.AgencyCommunicationRequestStatus.RequestSent);
            communicationRequest.EscalationAcceptanceStatusId.ShouldBe((int)Enums.AgencyPlaintStatus.New);
        }
Example #9
0
        public AgencyCommunicationRequest GetAgencyCommunicationRequestById()
        {
            AgencyCommunicationRequest generalAgencyCommunicationRequest = new AgencyCommunicationRequest(agencyRequestId, tenderId, agencyRequestTypeId, statusId, requestedByRoleName);

            generalAgencyCommunicationRequest.AddAgencyCommunicationRequestValidity(extendOffersValidityId, offersDuration, extendOffersReason, replyReceivingDurationDays, replyReceivingDurationTime);
            generalAgencyCommunicationRequest.AddTender(tenderId, tenderTypeId, "TenderName", "1", "", 1, 1, _agencyCode, 1);
            generalAgencyCommunicationRequest.AddEscalationAcceptanceStatusForUnitTest();
            generalAgencyCommunicationRequest.EscalationAcceptanceStatus.SetIdAndNameForUnitTest((int)Enums.AgencyPlaintStatus.Accepted, "Accepted");
            return(generalAgencyCommunicationRequest);
        }
        public void Should_Construct_ExtendOfferValidityAgencyCommunicationRequest()
        {
            AgencyCommunicationRequest communicationRequest = new AgencyCommunicationRequest(CommunicationRequestId, TENDER_ID, (int)Enums.AgencyCommunicationRequestType.ExtendOfferValidtiy, (int)Enums.AgencyCommunicationRequestStatus.UnderUpdate, RoleNames.supplier);

            communicationRequest.ShouldNotBeNull();
            communicationRequest.IsActive.ShouldNotBeNull();
            communicationRequest.IsActive.Value.ShouldBeTrue();
            communicationRequest.StatusId.ShouldBe((int)Enums.AgencyCommunicationRequestStatus.UnderUpdate);
            communicationRequest.AgencyRequestTypeId.ShouldBe((int)Enums.AgencyCommunicationRequestType.ExtendOfferValidtiy);
        }
        public void Should_DeleteExtendOfferValidityRequests()
        {
            AgencyCommunicationRequest communicationRequest = new AgencyCommunicationRequest();

            communicationRequest.AddAgencyCommunicationRequestValidity(0, 20, "Extend Offers Reason", 10, "5:00 pm");

            communicationRequest.DeleteExtendOfferValidityRequests();
            communicationRequest.ShouldNotBeNull();
            communicationRequest.IsActive.ShouldNotBeNull();
            communicationRequest.IsActive.Value.ShouldBeFalse();
        }
        public void Should_UpdateAgencyCommunicationEscalationRequestStatus()
        {
            AgencyCommunicationRequest communicationRequest = new AgencyCommunicationRequest();

            communicationRequest.UpdateAgencyCommunicationEscalationRequestStatus((int)Enums.AgencyCommunicationRequestStatus.Pending, (int)Enums.AgencyPlaintStatus.Rejected, null, "", REJECTION_REASON);
            communicationRequest.ShouldNotBeNull();
            communicationRequest.EscalationStatusId.ShouldBe((int)Enums.AgencyCommunicationRequestStatus.Pending);
            communicationRequest.EscalationAcceptanceStatusId.ShouldBe((int)Enums.AgencyPlaintStatus.Rejected);
            communicationRequest.TenderPlaintRequestProcedureId.ShouldBeNull();
            communicationRequest.EscalationRejectionReason.ShouldBe(REJECTION_REASON);
        }
Example #13
0
 public void IsValidToRejectSupplierExtendOfferDatesRequest(AgencyCommunicationRequest request)
 {
     if (request == null)
     {
         throw new BusinessRuleException(Resources.CommunicationRequest.ErrorMessages.RequestNotFound);
     }
     if (request.StatusId != (int)Enums.AgencyCommunicationRequestStatus.RequestSent)
     {
         var RequestStatus = Resources.CommunicationRequest.Messages.ResourceManager.GetString(nameof(Enums.AgencyCommunicationRequestStatus.RequestSent));
         throw new BusinessRuleException(Resources.CommunicationRequest.ErrorMessages.CanNotProceedStatusIs + RequestStatus);
     }
 }
Example #14
0
        public PlaintRequest GetPlaintRequest()
        {
            var plaintRequest = new PlaintRequest(1, 1, "Test", new List <CommunicationAttachmentModel>(), true);

            plaintRequest.Offer = new Offer(1, "1299659801", null, 1, false);
            AgencyCommunicationRequest agencyCommunicationRequest = new AgencyCommunicationRequest(1, 1);

            PropertyInfo propertyInfo = plaintRequest.GetType().GetProperty("AgencyCommunicationRequest");

            propertyInfo.SetValue(plaintRequest, Convert.ChangeType(agencyCommunicationRequest, propertyInfo.PropertyType), null);

            return(plaintRequest);
        }
Example #15
0
        public async Task <AgencyCommunicationRequest> CreateAsync(AgencyCommunicationRequest agencyCommunicationRequest)
        {
            try
            {
                await _context.AgencyCommunicationRequests.AddAsync(agencyCommunicationRequest);

                await _context.SaveChangesAsync();
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(agencyCommunicationRequest);
        }
        public void Should_AddAgencyCommunicationRequestValidity()
        {
            AgencyCommunicationRequest communicationRequest = new AgencyCommunicationRequest();

            communicationRequest.AddAgencyCommunicationRequestValidity(0, 20, "Extend Offers Reason", 10, "5:00 pm");
            communicationRequest.ExtendOffersValidity.ShouldNotBeNull();

            communicationRequest.ExtendOffersValidity.ShouldNotBeNull();
            communicationRequest.ExtendOffersValidity.IsActive.ShouldNotBeNull();
            communicationRequest.ExtendOffersValidity.IsActive.Value.ShouldBeTrue();
            communicationRequest.ExtendOffersValidity.OffersDuration.ShouldBe(20);
            communicationRequest.ExtendOffersValidity.NewOffersExpiryDate.Date.ShouldBe(DateTime.Now.AddDays(20).Date);
            communicationRequest.ExtendOffersValidity.ExtendOffersReason.ShouldBe("Extend Offers Reason");
            communicationRequest.ExtendOffersValidity.ReplyReceivingDurationDays.ShouldBe(10);
        }
Example #17
0
 public void IsValidToDeleteExtendOffersRequest(AgencyCommunicationRequest request)
 {
     if (request == null)
     {
         throw new BusinessRuleException(Resources.CommunicationRequest.ErrorMessages.RequestNotFound);
     }
     if (request.StatusId != (int)Enums.AgencyCommunicationRequestStatus.Rejected && request.StatusId != (int)Enums.AgencyCommunicationRequestStatus.UnderUpdate)
     {
         var RequestStatus = Resources.CommunicationRequest.Messages.ResourceManager.GetString(nameof(Enums.AgencyCommunicationRequestStatus.Rejected));
         throw new BusinessRuleException(Resources.CommunicationRequest.ErrorMessages.CanNotProceedStatusIs + RequestStatus);
     }
     if (request.Tender.AgencyCode != _httpContextAccessor.HttpContext.User.UserAgency())
     {
         throw new UnHandledAccessException();
     }
 }
Example #18
0
        public PlaintRequest EscalatePlaintRequest(string attachmentId, string attachmentName)
        {
            IsEscalation      = true;
            EscalationRequest = new EscalationRequest(0, PlainRequestId, attachmentId, attachmentName);

            AgencyCommunicationRequest.UpdateEscalatePlaint((int)Enums.AgencyPlaintStatus.New, (int)Enums.AgencyCommunicationRequestStatus.RequestSent);
            List <CommunicationAttachmentModel> lst = new List <CommunicationAttachmentModel>();

            lst.Add(new CommunicationAttachmentModel()
            {
                FileNetReferenceId = attachmentId, Name = attachmentName, AttachmentTypeId = (int)Enums.AttachmentType.Escalation
            });
            UpdateAttachments(lst, (int)Enums.AttachmentType.Escalation);
            EntityUpdated();
            return(this);
        }
Example #19
0
        private async Task SendNotificationAfterApproveReply(EnquiryReply enquiryReply)
        {
            var           tender = enquiryReply.Enquiry.Tender;
            List <string> crs    = (tender.TenderTypeId == (int)Enums.TenderType.PreQualification || tender.TenderTypeId == (int)Enums.TenderType.PostQualification) ? await _iDMAppService.QualificationToSendInvitation(tender.TenderId) : await _iDMAppService.GetAllSupplierOnTender(tender.TenderId);

            NotificationArguments NotificationArgument = new NotificationArguments();

            if (tender.TenderTypeId == (int)Enums.TenderType.PreQualification || tender.TenderTypeId == (int)Enums.TenderType.PostQualification)
            {
                NotificationArgument.BodyEmailArgs = new object[] { "", tender.TenderName, tender.ReferenceNumber, tender?.LastEnqueriesDate, tender?.LastOfferPresentationDate };
            }
            else
            {
                NotificationArgument.BodyEmailArgs = new object[] { "", tender.TenderName, tender.ReferenceNumber, tender.Purpose, tender?.LastEnqueriesDate, tender?.LastOfferPresentationDate, tender.OffersOpeningDate, tender?.OffersOpeningDate?.Hour };
            }

            NotificationArgument.SubjectEmailArgs = new object[] { };
            NotificationArgument.PanelArgs        = new object[] { tender.ReferenceNumber };
            NotificationArgument.SMSArgs          = new object[] { tender.ReferenceNumber };

            MainNotificationTemplateModel mainNotificationTemplateModel = new MainNotificationTemplateModel(NotificationArgument, $"Enquiry/SupplierEnquiriesOnTender?id={Util.Encrypt(tender.TenderId)}", NotificationEntityType.Tender, tender.TenderId.ToString(), 0, tender.TechnicalOrganizationId);

            if (tender.TenderTypeId == (int)Enums.TenderType.PreQualification || tender.TenderTypeId == (int)Enums.TenderType.PostQualification)
            {
                await _notificationAppService.SendNotificationForSuppliers(NotificationOperations.Supplier.InquiriesAboutTender.publishfaqanswerforQualification, crs, mainNotificationTemplateModel);

                await _notificationAppService.SendNotificationForCommitteeUsers(NotificationOperations.TechnicalCommitteeSecretary.InquiriesAboutTender.PublishfaqanswerforQualification, tender.TechnicalOrganizationId, mainNotificationTemplateModel);
            }
            else
            {
                await _notificationAppService.SendNotificationForSuppliers(NotificationOperations.Supplier.InquiriesAboutTender.publishfaqanswer, crs, mainNotificationTemplateModel);

                await _notificationAppService.SendNotificationForCommitteeUsers(NotificationOperations.TechnicalCommitteeSecretary.InquiriesAboutTender.publishfaqanswerbackend, tender.TechnicalOrganizationId, mainNotificationTemplateModel);
            }

            enquiryReply.Enquiry.Tender.AddActionHistory(tender.TenderStatusId, TenderActions.ApproveFAQ, "", _httpContextAccessor.HttpContext.User.UserId());
            var comunicationRequest = await _enquiryQueries.GetEnquiryReplyWithCommunicationRequest(enquiryReply.EnquiryReplyId);

            AgencyCommunicationRequest agencyCommunicationRequest = await _enquiryDomain.GetEnquiryCommunicationRequestByRequestId(comunicationRequest.Enquiry.AgencyCommunicationRequest.AgencyRequestId);

            if (agencyCommunicationRequest.StatusId == (int)Enums.AgencyCommunicationRequestStatus.PendingEnquiryForReply && enquiryReply.EnquiryReplyStatusId == (int)Enums.EnquiryReplyStatus.Approved)
            {
                agencyCommunicationRequest.UpdateAgencyCommunicationRequestStatus((int)Enums.AgencyCommunicationRequestStatus.ReplyOnEnquiry);
                await _enquiryDomain.UpdateCommunicationRequest(agencyCommunicationRequest);
            }
        }
        public void Should_Construct_PlaintAgencyCommunicationRequest()
        {
            var attachments = new List <CommunicationAttachmentModel>();

            attachments.Add(new CommunicationAttachmentModel()
            {
                FileNetReferenceId = "id", Name = "Name", AttachmentTypeId = (int)Enums.AttachmentType.PlainRequest
            });

            AgencyCommunicationRequest communicationRequest = new AgencyCommunicationRequest(CommunicationRequestId, Util.Encrypt(1), PLAINT_REQUEST_ID, Util.Encrypt(1), PlaintReason, RoleNames.supplier, attachments);

            communicationRequest.ShouldNotBeNull();
            communicationRequest.PlaintRequests.Count.ShouldBe(1);
            communicationRequest.PlaintAcceptanceStatusId.ShouldBe((int)Enums.AgencyPlaintStatus.New);
            communicationRequest.AgencyRequestTypeId.ShouldBe((int)Enums.AgencyCommunicationRequestType.Plaint);
            communicationRequest.StatusId.ShouldBe((int)Enums.AgencyCommunicationRequestStatus.RequestSent);
        }
        public void Should_UpdatePlaintAgencyCommunicationRequest()
        {
            var attachments = new List <CommunicationAttachmentModel>();

            attachments.Add(new CommunicationAttachmentModel()
            {
                FileNetReferenceId = "id", Name = "Name", AttachmentTypeId = (int)Enums.AttachmentType.PlainRequest
            });

            AgencyCommunicationRequest communicationRequest = new AgencyCommunicationRequest();

            communicationRequest.UpdatePlaintAgencyCommunicationRequest(CommunicationRequestId, Util.Encrypt(1), 1, Util.Encrypt(1), PlaintReason, attachments);
            communicationRequest.ShouldNotBeNull();
            communicationRequest.PlaintAcceptanceStatusId.ShouldBe((int)Enums.AgencyPlaintStatus.New);
            communicationRequest.AgencyRequestTypeId.ShouldBe((int)Enums.AgencyCommunicationRequestType.Plaint);
            communicationRequest.StatusId.ShouldBe((int)Enums.AgencyCommunicationRequestStatus.RequestSent);
        }
Example #22
0
        public async Task <Enquiry> SendEnquiry(EnquiryModel enquiryModel)
        {
            Enquiry enquiry = _mapper.Map <Enquiry>(enquiryModel);
            Tender  tender  = await _tenderAppService.FindTenderByTenderId(enquiry.TenderId);

            if (tender != null)
            {
                await _enquiryDomain.CheckCanAddEnquiry(tender, enquiry.CommericalRegisterNo);
            }

            #region
            NotificationArguments NotificationArgument = new NotificationArguments();
            NotificationArgument.BodyEmailArgs    = new object[] { "", tender?.TenderName, tender?.ReferenceNumber, enquiryModel.EnquiryName };
            NotificationArgument.SubjectEmailArgs = new object[] { };
            NotificationArgument.PanelArgs        = new object[] { tender?.ReferenceNumber };
            NotificationArgument.SMSArgs          = new object[] { tender?.ReferenceNumber };
            #endregion

            MainNotificationTemplateModel mainNotificationTemplateModel;
            if (tender != null)
            {
                mainNotificationTemplateModel = new MainNotificationTemplateModel(NotificationArgument,
                                                                                  $"Enquiry/SupplierEnquiriesOnTender?id={Util.Encrypt(tender.TenderId)}",
                                                                                  NotificationEntityType.Tender,
                                                                                  tender.TenderId.ToString(),
                                                                                  tender.TechnicalOrganizationId);

                await _notificationAppService.SendNotificationForCommitteeUsers(NotificationOperations.TechnicalCommitteeSecretary.InquiriesAboutTender.vendoraskquestion, tender?.TechnicalOrganizationId, mainNotificationTemplateModel);

                tender.AddActionHistory(tender.TenderStatusId, TenderActions.AskQuestion, "", _httpContextAccessor.HttpContext.User.UserId());

                var request = new AgencyCommunicationRequest(tender.TenderId, (int)Enums.AgencyCommunicationRequestType.Enquiry, (int)Enums.AgencyCommunicationRequestStatus.PendingEnquiryForReply, RoleNames.supplier);
                tender.AddAgencyCommunicationRequest(request);
                enquiry.SetCommunicationRequest(request);
            }
            return(await _enquiryCommands.CreateAsync(enquiry));
        }
        public void Should_SetSupplierExtendOfferDates()
        {
            AgencyCommunicationRequest communicationRequest = new AgencyCommunicationRequest();

            communicationRequest.SetSupplierExtendOfferDates(1);
        }
Example #24
0
        public async Task <AgencyCommunicationRequest> GetEnquiryCommunicationRequestByRequestId(int communcicationRequestId)
        {
            AgencyCommunicationRequest agencyCommunicationRequest = await _communicationAppService.GetCommunicationRequestByRequestId(communcicationRequestId);

            return(agencyCommunicationRequest);
        }
Example #25
0
        public AgencyCommunicationRequest GetGeneralAgencyCommunicationRequest()
        {
            AgencyCommunicationRequest generalAgencyCommunicationRequest = new AgencyCommunicationRequest(agencyRequestId, tenderId, agencyRequestTypeId, statusId, requestedByRoleName);

            return(generalAgencyCommunicationRequest);
        }
Example #26
0
 public async Task UpdateCommunicationRequest(AgencyCommunicationRequest agencyCommunicationRequest)
 {
     await _communicationCommands.UpdateAsync(agencyCommunicationRequest);
 }
Example #27
0
 public NegotiationFirstStage SetNegotiationCommunicationRequest(AgencyCommunicationRequest agencyCommunicationRequest)
 {
     AgencyCommunicationRequest = agencyCommunicationRequest;
     EntityUpdated();
     return(this);
 }