public void Handle(AddPersonDocumentNoFileCommand 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.Save(personDocument); }
public void Handle(AddPersonDocumentCommand command) { var repository = this.contextFactory(); var person = _PersonDao.GetByPersonIntegrationId(command.PersonIntegrationId); var personDocument = new Domain.PersonDocument(command.PersonDocumentId, person.PersonId, command.DocumentTypeId, command.Number, command.Complement, command.DateIssued, command.DateValidUntil, DateTime.UtcNow, command.FileId, command.Active, command.UserSystemId); if (command.listFileTemp != null) { foreach (var item in command.listFileTemp) { FIleServer fs = new FIleServer(); Domain.ReadModel.FileTemp fileTmp = new Domain.ReadModel.FileTemp(); fileTmp = _FileTemp.Get(item); fs.FilePath = fileTmp.FilePath; fs.Width = fileTmp.Width; fs.Height = fileTmp.Height; fs.OriginalName = fileTmp.OriginalName; fs.FileIntegrationCode = fileTmp.FileIntegrationCode; fs.FileTempId = item; fs.Description = "Usuário do Heeelp"; fs.FileUtilizationId = Convert.ToByte(GeneralEnumerators.EnumFileUtiliaztion.Album); fs.FriendlyName = person.Name; fs.Alt = person.Name; fs.Name = person.Name; fs.FileOriginTypeId = (int)GeneralEnumerators.EnumModules.Core_User; fs.PersonId = command.PersonId; fs.UploadedBy = command.UserSystemId; var ret = fs.SendFilePath(fs); if (ret > 0) { _FileTemp.Delete(fs.FileTempId); personDocument.FileId = ret; } else { throw new Exception(); } } } repository.Save(personDocument); }