public void Should_Constructor_CreateEntity() { var plaintRequestNotification = new PlaintRequestNotification(0, _isSent); plaintRequestNotification.ShouldNotBeNull(); plaintRequestNotification.State.ShouldBe(SharedKernal.ObjectState.Added); }
public AgencyCommunicationRequest UpdatePlaintAgencyCommunicationRequest(int statusId, string rejectReason) { if (statusId == (int)Enums.AgencyCommunicationRequestStatus.Approved) { if (TenderPlaintRequestProcedureId == (int)Enums.TenderPlaintRequestProcedure.ReOpenTenderChecking) { Tender.UpdateTenderStatus(Enums.TenderStatus.OffersChecking); } else if (TenderPlaintRequestProcedureId == (int)Enums.TenderPlaintRequestProcedure.ReOpenTenderAwarding) { Tender.UpdateTenderStatus(Enums.TenderStatus.OffersAwarding); } } if (PlaintNotification == null) { PlaintNotification = new PlaintRequestNotification(0, false); } else { this.PlaintNotification.UpdateApprovalDate(); } StatusId = statusId; RejectionReason = rejectReason; if (!string.IsNullOrEmpty(RejectionReason)) { RejectionHistories.Add(new RejectionHistory(AgencyRequestId, (int)Enums.RequestRejectionType.Plaint, statusId, RejectionReason)); } EntityUpdated(); return(this); }
public AgencyCommunicationRequest(int CommunicationRequestId, string EncryptedTenderId, int PlaintRequestId, string EncryptedOfferId, string PlaintReason, string UserRoleName, List <CommunicationAttachmentModel> attachments) { TenderId = Util.Decrypt(EncryptedTenderId); PlaintAcceptanceStatusId = (int)Enums.AgencyPlaintStatus.New; AgencyRequestTypeId = (int)Enums.AgencyCommunicationRequestType.Plaint; StatusId = (int)Enums.AgencyCommunicationRequestStatus.RequestSent; RequestedByRoleName = UserRoleName; PlaintRequest plaint = PlaintRequests.FirstOrDefault(p => p.PlainRequestId == PlaintRequestId); if (plaint == null) { PlaintRequests.Add(new PlaintRequest(PlaintRequestId, Util.Decrypt(EncryptedOfferId), PlaintReason, attachments)); } else { plaint.UpdatePlaintRequest(PlaintRequestId, Util.Decrypt(EncryptedOfferId), PlaintReason, attachments); } if (PlaintNotification == null) { PlaintNotification = new PlaintRequestNotification(0, false); } if (CommunicationRequestId == 0) { EntityCreated(); } else { EntityUpdated(); } }
public void Should_DeActive() { var plaintRequestNotification = new PlaintRequestNotification(); plaintRequestNotification.DeActive(); plaintRequestNotification.IsActive.ShouldBe(false); plaintRequestNotification.State.ShouldBe(SharedKernal.ObjectState.Modified); }
public void Should_UpdateApprovalDate() { var plaintRequestNotification = new PlaintRequestNotification(); plaintRequestNotification.UpdateApprovalDate(); plaintRequestNotification.ApprovalDate.ShouldNotBeNull(); plaintRequestNotification.State.ShouldBe(SharedKernal.ObjectState.Modified); }
public void Should_Update_ReturnsObj() { var plaintRequestNotification = new PlaintRequestNotification(); var obj = plaintRequestNotification.Update(_isSent); obj.ShouldNotBeNull(); obj.ShouldBeOfType(typeof(PlaintRequestNotification)); obj.IsSent.ShouldBeTrue(); obj.State.ShouldBe(SharedKernal.ObjectState.Modified); }
public async Task FindTendersWithPlaintsAfterStoppingPeriodJob() { List <AgencyCommunicationRequest> agencyCommunications = await _communicationRequestJobQueries.FindTendersWithPlaintsAfterStoppingPeriodJob(); var agencyCodeList = agencyCommunications.Select(d => d.Tender.AgencyCode).Distinct().ToList(); var agencies = await _communicationRequestJobQueries.FindAgenciesByAgencyCodes(agencyCodeList); int?agencyCategoryId = 0; foreach (var request in agencyCommunications) { if (request.PlaintNotification == null) { continue; } PlaintRequestNotification obj = request.PlaintNotification; obj.Update(true); _genericCommandRepository.Update(obj); await _genericCommandRepository.SaveAsync(); agencyCategoryId = agencies.Where(a => a.AgencyCode == request.Tender.AgencyCode).FirstOrDefault().CategoryId; NotificationArguments NotificationArguments = new NotificationArguments { BodyEmailArgs = new object[] { "", request.PlaintAcceptanceStatus.Name, request.Tender.ReferenceNumber }, SubjectEmailArgs = new object[] { }, PanelArgs = new object[] { request.Tender.ReferenceNumber }, SMSArgs = new object[] { request.Tender.ReferenceNumber } }; MainNotificationTemplateModel approveTender = new MainNotificationTemplateModel(NotificationArguments, $"Tender/Details?STenderId{Util.Encrypt(request.Tender.TenderId)}", NotificationEntityType.Tender, request.Tender.TenderId.ToString(), request.Tender.BranchId); if (request.Tender.TenderTypeId == (int)Enums.TenderType.NewDirectPurchase) { await _notificationJobAppService.SendNotifications(NotificationOperations.DirectPurchaseSecretary.AgencyCommunicationRequest.PlaintStoppingPeriodEnd, request.Tender.AgencyCode, agencyCategoryId.Value, approveTender, Enums.UserRole.NewMonafasat_SecretaryDirtectPurshasingCommittee.ToString(), (int)request.Tender.DirectPurchaseCommitteeId); } else { await _notificationJobAppService.SendNotifications(NotificationOperations.OffersCheckSecretary.AgencyCommunicationRequest.PlaintStoppingPeriodEnd, request.Tender.AgencyCode, agencyCategoryId.Value, approveTender, Enums.UserRole.NewMonafasat_OffersCheckSecretary.ToString(), (int)request.Tender.OffersCheckingCommitteeId); } } }
public void Should_Empty_Construct_PlaintRequestNotification() { var plaintRequestNotification = new PlaintRequestNotification(); plaintRequestNotification.ShouldNotBeNull(); }