public async Task WithdrawFromAnnouncementTemplate(int userId, int joinRequestId) { AnnouncementJoinRequestSupplierTemplate joinRequest = await _joinRequestQueries.GetAnnouncementJoinRequestWithAttachmentsByRequestId(joinRequestId); joinRequest.Withdraw(userId, joinRequestId); await _joinRequestCommands.UpdateAnnouncementJoinRequestAsync(joinRequest); }
public void Should_UpdateSuppliersTemplateJoinRequestAttachments() { var attachments = new List <AnnouncementTemplateJoinRequestAttachment> { new AnnouncementTemplateJoinRequestAttachment("name", "123") }; var announcementId = 1; var cr = "123"; var statusId = 1; var announcementJoinRequestSupplierTemplate = new AnnouncementJoinRequestSupplierTemplate(attachments, announcementId, cr, statusId); announcementJoinRequestSupplierTemplate.UpdateSuppliersTemplateJoinRequestAttachments( new List <AnnouncementTemplateJoinRequestAttachment> { new AnnouncementTemplateJoinRequestAttachment("newname", "456") }, cr, false); announcementJoinRequestSupplierTemplate.ShouldNotBeNull(); announcementJoinRequestSupplierTemplate.AnnouncementId.ShouldBe(1); announcementJoinRequestSupplierTemplate.Cr.ShouldBe("123"); announcementJoinRequestSupplierTemplate.StatusId.ShouldBe(1); announcementJoinRequestSupplierTemplate.Attachments.Count.ShouldBeGreaterThanOrEqualTo(2); announcementJoinRequestSupplierTemplate.Attachments[0].Name.ShouldBe("name"); announcementJoinRequestSupplierTemplate.Attachments[0].State.ShouldBe(ObjectState.Deleted); announcementJoinRequestSupplierTemplate.Attachments[1].Name.ShouldBe("newname"); }
public async Task <AnnouncementSuppliersTemplateJoinRequestsDetailsModel> SaveJoinRequestResult(AnnouncementSuppliersTemplateJoinRequestsDetailsModel joinRequestModel) { AnnouncementJoinRequestSupplierTemplate joinRequest = await _joinRequestQueries.GetAnnouncementJoinRequestByRequestId(joinRequestModel.JoinRequestId); joinRequest.UpdateAnnouncementJoinRequest(joinRequestModel.UserId, joinRequest.Id, joinRequestModel.RequestResultId, joinRequestModel.RejectionReason, joinRequestModel.Notes); await _joinRequestCommands.UpdateAnnouncementJoinRequestAsync(joinRequest); return(joinRequestModel); }
public void Should_Empty_Construct_AnnouncementJoinRequestSupplierTemplate() { var announcementJoinRequestSupplierTemplate = new AnnouncementJoinRequestSupplierTemplate(); announcementJoinRequestSupplierTemplate.ShouldNotBeNull(); announcementJoinRequestSupplierTemplate.Id.ShouldBe(0); announcementJoinRequestSupplierTemplate.JoinRequestStatus.ShouldBeNull(); announcementJoinRequestSupplierTemplate.AnnouncementSupplierTemplate.ShouldBeNull(); announcementJoinRequestSupplierTemplate.Supplier.ShouldBeNull(); }
private void ChangeRequestsStatus(AnnouncementJoinRequestSupplierTemplate request, List <KeyValuePair <string, int> > modifiedCrs) { if (request.StatusId == (int)Enums.AnnouncementTemplateJoinRequestStatus.PendingAcceptance) { request.UpdateAnnouncementJoinRequest(_httpContextAccessor.HttpContext.User.UserId(), request.Id, (int)Enums.AnnouncementTemplateJoinRequestStatus.Accepted); modifiedCrs.Add(new KeyValuePair <string, int>(request.Cr, (int)Enums.AnnouncementTemplateJoinRequestStatus.Accepted)); } if (request.StatusId == (int)Enums.AnnouncementTemplateJoinRequestStatus.PendingRejection) { request.UpdateAnnouncementJoinRequest(_httpContextAccessor.HttpContext.User.UserId(), request.Id, (int)Enums.AnnouncementTemplateJoinRequestStatus.Rejected, request.RejectionReason); modifiedCrs.Add(new KeyValuePair <string, int>(request.Cr, (int)Enums.AnnouncementTemplateJoinRequestStatus.Rejected)); } }
public async Task DeleteSupplierFromAnnouncementTemplate(DeleteSupplierFromAnnouncementModel deleteModel) { int joinRequestId = Util.Decrypt(deleteModel.JoinRequestIdString); AnnouncementJoinRequestSupplierTemplate joinRequest = await _joinRequestQueries.GetAnnouncementJoinRequestWithAttachmentsAndAnnouncementByRequestId(joinRequestId); joinRequest.DeleteSupplierJoinRequest(deleteModel.UserId, joinRequestId, deleteModel.DeleteReason); var announcementList = joinRequest.AnnouncementSupplierTemplate; await SendNotificationAfterDeleteSupplierFromAnnoincementList(deleteModel, announcementList); await _joinRequestCommands.UpdateAnnouncementJoinRequestAsync(joinRequest); }
public AnnouncementJoinRequestSupplierTemplate GetJoinRequestWithAnnouncementDefaultData() { AnnouncementJoinRequestSupplierTemplate joinRequest = new AnnouncementJoinRequestSupplierTemplate(ATTACHMENTS, ANNOUNCEMENT_ID, CR, JOIN_REQUEST_STATUS_ID); AnnouncementSupplierTemplate announcementTemplate = new AnnouncementSupplierTemplate(); announcementTemplate.CreateAnnouncementSupplierTemplate(new AnnouncementTemplateDefaults().GetAllAnnouncementSupplierTemplateModelData(), new List <AnnouncementSuppliersTemplateAttachment>(), 1); joinRequest.SetAnnouncementTemplate(announcementTemplate); var lst = new List <AnnouncementTemplateJoinRequestHistory>(); lst.Add(new AnnouncementTemplateJoinRequestHistory(1, 1, 6, "", "")); joinRequest.setJoinRequestStatusForTest(lst); return(joinRequest); }
public void Should_Delete_SupplierFromAnnouncementTemplate() { var attachments = new List <AnnouncementTemplateJoinRequestAttachment> { new AnnouncementTemplateJoinRequestAttachment("name", "123") }; var announcementId = 1; var cr = "123"; var statusId = 4; var announcementJoinRequestSupplierTemplate = new AnnouncementJoinRequestSupplierTemplate(attachments, announcementId, cr, statusId); announcementJoinRequestSupplierTemplate.DeleteSupplierJoinRequest(1, 1, "delete Reason"); announcementJoinRequestSupplierTemplate.ShouldNotBeNull(); announcementJoinRequestSupplierTemplate.AnnouncementId.ShouldBe(announcementId); announcementJoinRequestSupplierTemplate.Cr.ShouldBe(cr); announcementJoinRequestSupplierTemplate.StatusId.ShouldBe((int)Enums.AnnouncementTemplateJoinRequestStatus.Deleted); }
public void Should_WithDraw_AnnouncementJoinRequestSupplierTemplate() { var attachments = new List <AnnouncementTemplateJoinRequestAttachment> { new AnnouncementTemplateJoinRequestAttachment("name", "123") }; var announcementId = 1; var cr = "123"; var statusId = 1; var announcementJoinRequestSupplierTemplate = new AnnouncementJoinRequestSupplierTemplate(attachments, announcementId, cr, statusId); announcementJoinRequestSupplierTemplate.Withdraw(1, 1); announcementJoinRequestSupplierTemplate.ShouldNotBeNull(); announcementJoinRequestSupplierTemplate.AnnouncementId.ShouldBe(announcementId); announcementJoinRequestSupplierTemplate.Cr.ShouldBe(cr); announcementJoinRequestSupplierTemplate.StatusId.ShouldBe((int)Enums.AnnouncementTemplateJoinRequestStatus.Withdrawn); }
public void Should_Construct_AnnouncementJoinRequestSupplierTemplate() { var attachments = new List <AnnouncementTemplateJoinRequestAttachment> { new AnnouncementTemplateJoinRequestAttachment("name", "123") }; var announcementId = 1; var cr = "123"; var statusId = 1; var announcementJoinRequestSupplierTemplate = new AnnouncementJoinRequestSupplierTemplate(attachments, announcementId, cr, statusId); announcementJoinRequestSupplierTemplate.ShouldNotBeNull(); announcementJoinRequestSupplierTemplate.AnnouncementId.ShouldBe(announcementId); announcementJoinRequestSupplierTemplate.Cr.ShouldBe(cr); announcementJoinRequestSupplierTemplate.StatusId.ShouldBe(statusId); announcementJoinRequestSupplierTemplate.Attachments.Count.ShouldBeGreaterThanOrEqualTo(1); announcementJoinRequestSupplierTemplate.Attachments[0].Name.ShouldBe("name"); }
public void Should_UpdateAnnouncementJoinRequestSupplierTemplate() { var attachments = new List <AnnouncementTemplateJoinRequestAttachment> { new AnnouncementTemplateJoinRequestAttachment("name", "123") }; var announcementId = 1; var cr = "123"; var statusId = 1; var announcementJoinRequestSupplierTemplate = new AnnouncementJoinRequestSupplierTemplate(attachments, announcementId, cr, statusId); announcementJoinRequestSupplierTemplate.UpdateAnnouncementJoinRequest(1, 1, 2, "rejectReason", "notes"); announcementJoinRequestSupplierTemplate.ShouldNotBeNull(); announcementJoinRequestSupplierTemplate.AnnouncementId.ShouldBe(1); announcementJoinRequestSupplierTemplate.Cr.ShouldBe("123"); announcementJoinRequestSupplierTemplate.StatusId.ShouldBe(2); announcementJoinRequestSupplierTemplate.RejectionReason.ShouldBe("rejectReason"); announcementJoinRequestSupplierTemplate.Notes.ShouldBe("notes"); announcementJoinRequestSupplierTemplate.Attachments.Count.ShouldBeGreaterThanOrEqualTo(1); announcementJoinRequestSupplierTemplate.Attachments[0].Name.ShouldBe("name"); }
public async Task <AnnouncementJoinRequestSupplierTemplate> UpdateAnnouncementJoinRequestAsync(AnnouncementJoinRequestSupplierTemplate request) { _context.AnnouncementRequestSupplierTemplate.Update(request); await _context.SaveChangesAsync(); return(request); }
public async Task UpdateAnnouncementJoinRequest(AnnouncementJoinRequestSupplierTemplate request) { Check.ArgumentNotNull(nameof(request), request); _context.AnnouncementRequestSupplierTemplate.Update(request); }
public async Task <AnnouncementJoinRequestSupplierTemplate> CreateAnnouncementJoinRequestAsync(AnnouncementJoinRequestSupplierTemplate request) { Check.ArgumentNotNull(nameof(request), request); await _context.AnnouncementRequestSupplierTemplate.AddAsync(request); return(request); }
public AnnouncementJoinRequestSupplierTemplate GetJoinRequestDefaultData() { AnnouncementJoinRequestSupplierTemplate joinRequest = new AnnouncementJoinRequestSupplierTemplate(ATTACHMENTS, ANNOUNCEMENT_ID, CR, JOIN_REQUEST_STATUS_ID); return(joinRequest); }