예제 #1
0
        public int EliminarNotaIngresoPlantaDocumentoAdjunto(RegistrarActualizarNotaIngresoPlantaDocumentoAdjuntoRequestDTO request)
        {
            ConsultaNotaIngresoPlantaDocumentoAdjuntoPorId NotaIngresoPlantaNotaIngresoPlantaDocumentoAdjunto = _INotaIngresoPlantaDocumentoAdjuntoRepository.ConsultarNotaIngresoPlantaDocumentoAdjuntoPorId(request.NotaIngresoPlantaDocumentoAdjuntoId);

            var AdjuntoBl = new AdjuntarArchivosBL(_fileServerSettings);

            int affected = _INotaIngresoPlantaDocumentoAdjuntoRepository.Eliminar(request.NotaIngresoPlantaDocumentoAdjuntoId);

            EliminarArchivoAdjuntoDTO adjunto = new EliminarArchivoAdjuntoDTO();

            adjunto.pathFile = NotaIngresoPlantaNotaIngresoPlantaDocumentoAdjunto.Path;

            if (!string.IsNullOrEmpty(NotaIngresoPlantaNotaIngresoPlantaDocumentoAdjunto.Path))
            {
                AdjuntoBl.EliminarArchivo(adjunto);
            }



            return(affected);
        }
        public ConsultaNotaIngresoPlantaDocumentoAdjuntoPorId ConsultarNotaIngresoPlantaDocumentoAdjuntoPorId(int NotaIngresoPlantaDocumentoAdjuntoId)
        {
            ConsultaNotaIngresoPlantaDocumentoAdjuntoPorId itemBE = null;

            var parameters = new DynamicParameters();

            parameters.Add("@NotaIngresoPlantaDocumentoAdjuntoId", NotaIngresoPlantaDocumentoAdjuntoId);


            using (IDbConnection db = new SqlConnection(_connectionString.Value.CoffeeConnectDB))
            {
                var list = db.Query <ConsultaNotaIngresoPlantaDocumentoAdjuntoPorId>("uspNotaIngresoPlantaDocumentoAdjuntoConsultaPorId", parameters, commandType: CommandType.StoredProcedure);

                if (list.Any())
                {
                    itemBE = list.First();
                }
            }

            return(itemBE);
        }