public int Actualizar(NotaIngresoPlantaDocumentoAdjunto NotaIngresoPlantaDocumentoAdjunto) { int result = 0; var parameters = new DynamicParameters(); parameters.Add("@NotaIngresoPlantaDocumentoAdjuntoId", NotaIngresoPlantaDocumentoAdjunto.NotaIngresoPlantaDocumentoAdjuntoId); parameters.Add("@NotaIngresoPlantaId", NotaIngresoPlantaDocumentoAdjunto.NotaIngresoPlantaId); parameters.Add("@Nombre", NotaIngresoPlantaDocumentoAdjunto.Nombre); parameters.Add("@Descripcion", NotaIngresoPlantaDocumentoAdjunto.Descripcion); parameters.Add("@Path", NotaIngresoPlantaDocumentoAdjunto.Path); parameters.Add("@FechaUltimaActualizacion", NotaIngresoPlantaDocumentoAdjunto.FechaUltimaActualizacion); parameters.Add("@UsuarioUltimaActualizacion", NotaIngresoPlantaDocumentoAdjunto.UsuarioUltimaActualizacion); parameters.Add("@EstadoId", NotaIngresoPlantaDocumentoAdjunto.EstadoId); using (IDbConnection db = new SqlConnection(_connectionString.Value.CoffeeConnectDB)) { result = db.Execute("uspNotaIngresoPlantaDocumentoAdjuntoActualizar", parameters, commandType: CommandType.StoredProcedure); } return(result); }
public int RegistrarNotaIngresoPlantaDocumentoAdjunto(RegistrarActualizarNotaIngresoPlantaDocumentoAdjuntoRequestDTO request, IFormFile file) { NotaIngresoPlantaDocumentoAdjunto socioNotaIngresoPlanta = _Mapper.Map <NotaIngresoPlantaDocumentoAdjunto>(request); socioNotaIngresoPlanta.FechaRegistro = DateTime.Now; socioNotaIngresoPlanta.UsuarioRegistro = request.Usuario; var AdjuntoBl = new AdjuntarArchivosBL(_fileServerSettings); byte[] fileBytes = null; if (file != null) { if (file.Length > 0) { using (var ms = new MemoryStream()) { file.CopyTo(ms); fileBytes = ms.ToArray(); string s = Convert.ToBase64String(fileBytes); // act on the Base64 data } socioNotaIngresoPlanta.Nombre = file.FileName; ResponseAdjuntarArchivoDTO response = AdjuntoBl.AgregarArchivo(new RequestAdjuntarArchivosDTO() { filtros = new AdjuntarArchivosDTO() { archivoStream = fileBytes, filename = file.FileName, }, pathFile = _fileServerSettings.Value.NotaIngresoPlantasDocumentoAdjunto }); socioNotaIngresoPlanta.Path = _fileServerSettings.Value.NotaIngresoPlantasDocumentoAdjunto + "\\" + response.ficheroReal; } } //if (file != null) //{ // if (file.Length > 0) // { // //Adjuntos // socioNotaIngresoPlanta.Nombre = file.FileName; // ResponseAdjuntarArchivoDTO response = AdjuntoBl.AgregarArchivo(new RequestAdjuntarArchivosDTO() // { // filtros = new AdjuntarArchivosDTO() // { // archivoStream = fileBytes, // filename = file.FileName, // }, // pathFile = _fileServerSettings.Value.NotaIngresoPlantasCertificacion // }); // socioNotaIngresoPlanta.Path = _fileServerSettings.Value.NotaIngresoPlantasCertificacion + "\\" + response.ficheroReal; // } //} int affected = _INotaIngresoPlantaDocumentoAdjuntoRepository.Insertar(socioNotaIngresoPlanta); return(affected); }