Example #1
0
        public void Handle(UpdatePersonDocument command)
        {
            var repository     = this.contextFactory();
            var personDocument = new Domain.PersonDocument(command.PersonDocumentId, command.PersonId,
                                                           command.DocumentTypeId, command.Number, command.Complement, command.DateIssued,
                                                           command.DateValidUntil, command.InsertedDateUTC, command.FileId, command.Active, command.UserSystemId);

            repository.Update(personDocument);
        }
Example #2
0
        public void Handle(PersonDocumentFileAddedEvent @event)
        {
            FIleServer fs = new FIleServer();

            fs.FilePath          = @event.FilePath;
            fs.Width             = @event.Width;
            fs.Height            = @event.Height;
            fs.OriginalName      = @event.OriginalName;
            fs.FileTempId        = @event.FileTempId;
            fs.Description       = @event.Description;
            fs.FriendlyName      = @event.FriendlyName;
            fs.Alt               = @event.Alt;
            fs.Name              = @event.Name;
            fs.FileOriginTypeId  = @event.FileOriginTypeId;
            fs.PersonId          = @event.PersonId;
            fs.FileUtilizationId = @event.FileUtilizationId;
            fs.UploadedBy        = @event.UploadedBy;

            var ret = fs.SendFilePath(fs);

            if (ret > 0)
            {
                _FileTemp.Delete(fs.FileTempId);
                var personFileCommand = new UpdatePersonDocument()
                {
                    PersonDocumentId = @event.PersonDocumentId,
                    PersonId         = @event.PersonId,
                    DocumentTypeId   = @event.DocumentTypeId,
                    InsertedDateUTC  = @event.InsertedDateUTC,
                    FileId           = ret,
                    Active           = @event.Active,
                    UserSystemId     = Convert.ToInt32(@event.UploadedBy)
                };
                this.bus.Send(personFileCommand);
            }
            else
            {
                throw new Exception();
            }
        }