public AgencyCommunicationRequest UpdatePlaintAgencyCommunicationRequest(int CommunicationRequestId, string EncryptedTenderId, int PlaintRequestId, string EncryptedOfferId, string PlaintReason, List <CommunicationAttachmentModel> attachments)
        {
            TenderId = Util.Decrypt(EncryptedTenderId);
            PlaintAcceptanceStatusId = (int)Enums.AgencyPlaintStatus.New;
            AgencyRequestTypeId      = (int)Enums.AgencyCommunicationRequestType.Plaint;
            StatusId = (int)Enums.AgencyCommunicationRequestStatus.RequestSent;
            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 (CommunicationRequestId == 0)
            {
                EntityCreated();
            }
            else
            {
                EntityUpdated();
            }
            return(this);
        }
Example #2
0
        public void Should_CreatePlaintRequest()
        {
            var plaintRequest = new PlaintRequest();

            plaintRequest.UpdatePlaintRequest(0, _offerId, _plaintReason, _attachments, _isEscalation);
            plaintRequest.ShouldNotBeNull();
            plaintRequest.State.ShouldBe(SharedKernal.ObjectState.Added);
            plaintRequest.Attachments.ShouldNotBe(null);
            plaintRequest.Attachments[0].State.ShouldBe(SharedKernal.ObjectState.Added);
        }