public static void Insert(DetalleOrdenCompra det, SqlConnection cn, SqlTransaction tran, int idOrden) { Acceso ac = new Acceso(); //SqlConnection conexion = new SqlConnection(ac.getCadenaConexion()); SqlCommand cmd = new SqlCommand("sp_insertar_detalle_orden_compra", cn); cmd.Parameters.AddWithValue("@idOrdenCompra", idOrden); cmd.Parameters.AddWithValue("@idProducto", det.producto.idProducto); cmd.Parameters.AddWithValue("@cantidad", det.cantidad); cmd.Parameters.AddWithValue("@precio", det.precio); cmd.Parameters.AddWithValue("@subtotal", det.subTotal); try { cmd.Connection = cn; cmd.Transaction = tran; cmd.CommandType = CommandType.StoredProcedure; cmd.ExecuteNonQuery(); } catch (ArgumentException ex) { throw new ApplicationException(ex.Message); } catch (SqlException ex) { throw new ApplicationException("Error en BD: " + ex.Message); } }
public static void UpdateCantidadIngresadaReal(DetalleOrdenCompra det, int idOrden, SqlConnection con, SqlTransaction tran) { Acceso ac = new Acceso(); string sql = ("UPDATE [Luiggi].[dbo].[DetalleOrdenCompra] SET [cantidadRealIngresada] = @cantidadRealIngresada, [subtotal] = @cantidadRealIngresada * @precio WHERE idProducto = @idProducto and idOrdenCompra = @idOrdenCompra"); SqlCommand cmd = new SqlCommand(sql, con, tran); cmd.Parameters.AddWithValue("@idProducto", det.producto.idProducto); cmd.Parameters.AddWithValue("@cantidadRealIngresada", det.cantidadRealIngresada); cmd.Parameters.AddWithValue("@idOrdenCompra", idOrden); cmd.Parameters.AddWithValue("@precio", det.precio); try { cmd.CommandType = CommandType.Text; cmd.ExecuteNonQuery(); ProductoDAO.UpdateStockActualYDisponibleInsumosYMPIngresadas(det, con, tran); } catch (ArgumentException ex) { throw new ApplicationException(ex.Message); } catch (SqlException ex) { throw new ApplicationException("Error en BD: " + ex.Message); } finally { } }
public bool RegistrarDetalleOC(DetalleOrdenCompra obj) { bool resultado = false; SqlConnection cn = null; SqlCommand cmd = null; try { cn = Conexion.GetInstance().ConexionDB(); cmd = new SqlCommand("SP_REGDETALLEORDENCOMPRA", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@PREUNITARIO", obj.Precio); cmd.Parameters.AddWithValue("@CANTIDAD", obj.Cantidad); cmd.Parameters.AddWithValue("@SUBTOTAL", obj.Subtotal); cmd.Parameters.AddWithValue("@CODMEDICAMENTO", obj.Medicamento.CodMedicamento); cmd.Parameters.AddWithValue("@CODORDCOMPRA", obj.OrdenCompra.CodOrdCompra); cn.Open(); resultado = cmd.ExecuteNonQuery() >= 1 ? true : false; } catch (SqlException ex) { throw ex; } finally { cn.Close(); } return(resultado); }
public async Task <HttpResponseMessage> Update(DetalleOrdenCompra obj) { string ruta = CommonEnums.CrudPath.DetalleOrdenCompraCrud; var response = await Client.PostAsJsonAsync(ruta, obj); return(response); }
public bool RegistrarDetalleOC(DetalleOrdenCompra obj) { try { return(OrdenCompraDAO.GetInstance().RegistrarDetalleOC(obj)); } catch (Exception ex) { throw ex; } }
private void dgv_detalle_pedido_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (dgv_detalle_pedido.CurrentCell is DataGridViewButtonCell) { try { double?valor = ((Double?)dgv_detalle_pedido.CurrentRow.Cells["cantReal"].Value); if (valor == null) { double canti = (double)dgv_detalle_pedido.Rows[dgv_detalle_pedido.CurrentRow.Index].Cells["cant"].Value; string resul = Microsoft.VisualBasic.Interaction.InputBox("Ingrese la Cantidad Comprada", "Orden de Compra", canti.ToString()); try { if (!string.IsNullOrEmpty(resul)) { DetalleOrdenCompra det = new DetalleOrdenCompra(); //det.ordenCompra = new OrdenDeCompra (){ idOrdenCompra = (int)dgv_detalle_pedido.Rows[dgv_detalle_pedido.CurrentRow.Index].Cells["codProd"].Value}; det.producto = new Producto() { idProducto = (int)dgv_detalle_pedido.Rows[dgv_detalle_pedido.CurrentRow.Index].Cells["codProd"].Value }; det.cantidad = canti; det.cantidadRealIngresada = Convert.ToDouble(resul); //OrdenDeTrabajoDAO.finalizarOTHija(det); MessageBox.Show("Finalizado con éxito", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); dgv_detalle_pedido.CurrentRow.Cells["cantReal"].Value = resul; dgv_detalle_pedido.CurrentRow.Cells["carrar"].Value = "Sin Opción"; cerraronLosHIjo(); } dgv_detalle_pedido.ClearSelection(); } catch (ApplicationException ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } catch (FormatException ex) { MessageBox.Show("Ingrese solo números", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); } } } catch (InvalidCastException ex) { } } }
private void btnIngresarProducto_Click(object sender, RoutedEventArgs e) { try { if (true) { if (txtCantidad.Text.Trim() == "" || txtIdOrden.Text.Trim() == "" || cboFamilia.SelectedIndex < 0 || cboProducto.SelectedIndex < 0 || cboProveedor.SelectedIndex < 0) { MessageBox.Show("No puede dejar campos sin rellenar", "ERROR"); return; } else { if (YC.LaOrdenNoFueEntregada(txtIdOrden.Text.Trim())) { if (YC.ComprobarProductoEnLaOrden(txtIdOrden.Text.Trim(), cboProducto.SelectedValue.ToString())) { MessageBox.Show("Ya fue ingresado este producto en esta orden", "ERROR"); return; } else { DetalleOrdenCompra detalleOrden = new DetalleOrdenCompra(); detalleOrden.Cantidad_pack = int.Parse(txtCantidad.Text); detalleOrden.Id_orden = txtIdOrden.Text; detalleOrden.Id_producto = cboProducto.SelectedValue.ToString(); if (YC.CrearDetalleOrden(detalleOrden)) { MessageBox.Show("Se ha ingresado un producto al detalle de la orden", "PRODUCTO INGRESADO A LA ORDEN"); this.cargarGrillaOrden(); this.cargarGrillaProducto(detalleOrden.Id_orden); return; } else { MessageBox.Show("Ha ocurrido un error, contacte a un tecnico a la brevedad", "ERROR"); return; } } } else { MessageBox.Show("Ingrese una orden de compra correcta y que no haya sido recepcionada", "ERROR"); return; } } } } catch (Exception) { throw; } }
private void btn_guardar_Click(object sender, EventArgs e) { if (_estado == estados.nuevo) { if (dgv_detalle.Rows.Count >= 1) { List <DetalleOrdenCompra> detalle = new List <DetalleOrdenCompra>(); for (int c = 0; c < dgv_detalle.RowCount; c++) { DetalleOrdenCompra de = new DetalleOrdenCompra(); Producto p = new Producto(); p.idProducto = (int)dgv_detalle.Rows[c].Cells["idProductodetalle"].Value; p.precio = (double)dgv_detalle.Rows[c].Cells["preciodetalle"].Value; de.cantidad = Convert.ToDouble(dgv_detalle.Rows[c].Cells["cantidad"].Value); de.precio = (double)dgv_detalle.Rows[c].Cells["preciodetalle"].Value; de.subTotal = (double)dgv_detalle.Rows[c].Cells["sub"].Value; de.producto = p; detalle.Add(de); } Persona prov = new Persona(); prov.idPersona = (int)cmb_proveedores.SelectedValue; OrdenDeCompra oc = new OrdenDeCompra() { detalleOrdenCompra = detalle, proveedor = prov, monto = Convert.ToDouble(txt_monto_total.Text), fechaOrden = dtp_creacion_OT.Value.Date }; try { OrdenDeCompraDAO.Insert(oc); MessageBox.Show("Registrado con Exito", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); limpiarCampos(); btn_guardar.Enabled = false; } catch (ApplicationException ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } } else { MessageBox.Show("La orden de compra no tiene productos, Por favor carguelos", "ATENCION"); } } }
public async Task <ActionResult> PostOrdenCompra(DTOOrdenCompra orden) { string _id = null; try { _id = User.Claims.First(x => x.Type == "Idusuario").Value; } catch (Exception) { return(await Task.FromResult(StatusCode(401, "Acceso restringido"))); } OrdenCompra item = new OrdenCompra() { FechaCreacion = DateTime.Now, FechaEspectativa = orden.FechaEspectativa, UserCreatedId = Int32.Parse(_id), Idproveedor = orden.Idproveedor, IdestadoOrdenCompra = (int)EnumCompras.Compra, Tipo = orden.Tipo, SubTotal = orden.SubTotal, Impuesto = orden.Impuesto, Total = orden.Total }; _context.OrdenCompra.Add(item); await _context.SaveChangesAsync(); foreach (var detalle in orden.DetalleOrdenCompra) { DetalleOrdenCompra itemDetalle = new DetalleOrdenCompra() { IdordenCompra = item.IdordenCompra, Idproducto = detalle.Idproducto, IdunidadMedida = detalle.IdunidadMedida, Cantidad = detalle.Cantidad, TotalUnidadCompra = detalle.TotalUnidadCompra }; _context.DetalleOrdenCompra.Add(itemDetalle); //var producto = await _context.Inventario.FirstOrDefaultAsync(x => x.Idproducto == detalle.Idproducto); //producto.Cantidad += detalle.Cantidad; await _context.SaveChangesAsync(); } return(Ok("Orden de compra realizada")); }
private void button5_Click(object sender, EventArgs e) { try { DetalleOrdenCompra detalleSeleccionado = (DetalleOrdenCompra)dataGridView1.CurrentRow.DataBoundItem; total = total - detalleSeleccionado.Subtotal; textBox9.Text = total.ToString(); detalles.Remove(detalleSeleccionado); } catch (Exception) { MessageBox.Show("Debe seleccionar un detalle de la Orden de Produccion", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } }
private void dgGrillaProducto_SelectionChanged(object sender, SelectionChangedEventArgs e) { try { DetalleOrdenCompra detalleOrden = (DetalleOrdenCompra)dgGrillaProducto.SelectedItem; cboProveedor.SelectedValue = detalleOrden.Id_proveedor; cboFamilia.SelectedValue = detalleOrden.Id_familia; cboProducto.ItemsSource = YC.ObtenerProductoFiltrado(detalleOrden.Id_proveedor, detalleOrden.Id_familia); cboProducto.SelectedValue = detalleOrden.Id_producto; txtCantidad.Text = detalleOrden.Cantidad_pack.ToString(); } catch (Exception) { return; } }
public List <DetalleOrdenCompra> ListarDetalleOC(string codOrdenCompra) { SqlConnection cn = null; SqlCommand cmd = null; SqlDataReader dr = null; List <DetalleOrdenCompra> Lista = new List <DetalleOrdenCompra>(); try { cn = Conexion.GetInstance().ConexionDB(); cmd = new SqlCommand("SP_DETALLEOC", cn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@CODOC", codOrdenCompra); cn.Open(); dr = cmd.ExecuteReader(); while (dr.Read()) { DetalleOrdenCompra objDetalleOC = new DetalleOrdenCompra() { IdDetalle = Convert.ToInt32(dr[0].ToString()), Medicamento = new Medicamento() { CodMedicamento = dr[1].ToString(), Descripcion = dr[2].ToString() }, Precio = Convert.ToDecimal(dr[3].ToString()), Cantidad = Convert.ToInt32(dr[4].ToString()), Subtotal = Convert.ToDecimal(dr[5].ToString()) }; Lista.Add(objDetalleOC); } } catch (Exception ex) { throw ex; } finally { cn.Close(); } return(Lista); }
private void button1_Click(object sender, EventArgs e) { if (String.IsNullOrEmpty(textBox5.Text)) { MessageBox.Show("Debe seleccionar un insumo", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (String.IsNullOrWhiteSpace(textBox8.Text)) { MessageBox.Show("Debe ingresar una cantidad", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (textBox8.ForeColor == Color.Red) { MessageBox.Show("Cantidad invalida", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (Convert.ToInt32(textBox8.Text) == 0) { MessageBox.Show("Cantidad debe ser mayor a cero", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } DetalleOrdenCompra d = new DetalleOrdenCompra(); d.Insumo = this.insumoSeleccionado; d.Cantidad = Convert.ToInt32(textBox8.Text); d.Subtotal = d.Cantidad * Convert.ToSingle(textBox7.Text); this.estadoBotones(2); total = total + d.Subtotal; textBox9.Text = total.ToString(); foreach (DetalleOrdenCompra de in detalles) { if (d.Insumo.Id == de.Insumo.Id) { de.Cantidad = de.Cantidad + d.Cantidad; de.Subtotal = de.Subtotal + d.Subtotal; this.estadoBotones(2); dataGridView1.Update(); dataGridView1.Refresh(); return; } } detalles.Add(d); }
public static void UpdateStockActualYDisponibleInsumosYMPIngresadas(DetalleOrdenCompra det, SqlConnection cn, SqlTransaction tran) { Acceso ac = new Acceso(); SqlConnection conexion = new SqlConnection(ac.getCadenaConexion()); SqlCommand cmd = new SqlCommand("UPDATE [Luiggi].[dbo].[Producto] SET [stockDisponible] = stockDisponible + @cantidad, [stockActual] = stockActual + @cantidad WHERE idProducto = @idProducto", conexion); cmd.Parameters.AddWithValue("@idProducto", det.producto.idProducto); if (det.producto.Unidad.Descripcion == "g") { cmd.Parameters.AddWithValue("@cantidad", det.cantidadRealIngresada * 1000); } else { cmd.Parameters.AddWithValue("@cantidad", det.cantidadRealIngresada); } try { conexion.Open(); cmd.Connection = cn; cmd.Transaction = tran; cmd.CommandType = CommandType.Text; cmd.ExecuteNonQuery(); } catch (ArgumentException ex) { throw new ApplicationException(ex.Message); } catch (SqlException ex) { throw new ApplicationException("Error en BD: " + ex.Message); } finally { conexion.Close(); } }
public static string RegistrarDetalleOC(decimal _precio, int _cantidad, decimal _subtotal, string _codmedicamento, string _codoc) { bool resultado = false; DetalleOrdenCompra obj = new DetalleOrdenCompra() { Precio = _precio, Cantidad = _cantidad, Subtotal = _subtotal, Medicamento = new Medicamento() { CodMedicamento = _codmedicamento }, OrdenCompra = new OrdenCompra() { CodOrdCompra = _codoc } }; resultado = OrdenCompraLN.GetInstance().RegistrarDetalleOC(obj); return(resultado == true ? "Correcto" : "Incorrecto"); }
private void dgv_pedidos_CellContentClick(object sender, DataGridViewCellEventArgs e) { if (dgv_pedidos.CurrentCell is DataGridViewButtonCell) { if ((int)dgv_pedidos.Rows[dgv_pedidos.CurrentRow.Index].Cells["idestado"].Value == 31) { if (cerraronLosHIjo()) { try { List <DetalleOrdenCompra> detalle = new List <DetalleOrdenCompra>(); double montoReal = 0; for (int i = 0; i < dgv_detalle_pedido.Rows.Count; i++)//SE CARGA CADA DETALLE PARA LUEGO ACTUALIZAR STOCK DE MP { DetalleOrdenCompra det = new DetalleOrdenCompra(); det.producto = new Producto() { idProducto = (int)dgv_detalle_pedido.Rows[i].Cells["codProd"].Value }; det.cantidadRealIngresada = Convert.ToDouble(dgv_detalle_pedido.Rows[i].Cells["cantReal"].Value); UnidadMedida u = new UnidadMedida(); if ((string)dgv_detalle_pedido.Rows[i].Cells["unidadReal"].Value == "g") { u.Descripcion = "g"; } else { u.Descripcion = ""; } det.producto.Unidad = u; det.precio = (Double)dgv_detalle_pedido.Rows[i].Cells["precio"].Value; if (((string)dgv_detalle_pedido.Rows[i].Cells["unidad"].Value).Equals("g")) { det.precio = det.precio / 1000; } montoReal += det.cantidadRealIngresada * det.precio; detalle.Add(det); } OrdenDeCompra ord = new OrdenDeCompra(); ord.montoReal = montoReal; ord.detalleOrdenCompra = detalle; ord.idOrdenCompra = (int)dgv_pedidos.CurrentRow.Cells["idOrden"].Value; ord.estado = new Estado() { idEstado = 32 }; OrdenDeCompraDAO.UpdateEstadoOrdenCompra(ord); MessageBox.Show("Finalizado con éxito", "Exito", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); } catch (ApplicationException ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1); } } else { MessageBox.Show("Falta Registrar la Cantidades de Productos", "Atención", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); } cargarGrilla(); dgv_detalle_pedido.Rows.Clear(); } } }
public ActionResult Create([Bind(Include = "OrdenDeCompraGeneralID,fechaEntrega,formaRetiro,formaPago,subtotal,miscelaneos,totalNeto,IVA,total, texto, tipo")] OrdenDeCompraGeneral ordenDeCompraGeneral, FormCollection post) { if (Session["ID"] == null || !roles.tienePermiso(numeroPermiso, int.Parse(Session["ID"].ToString()))) { return(RedirectToAction("Index", "Home")); } ordenDeCompraGeneral.estado = "NUEVA"; ordenDeCompraGeneral.añoOC = DateTime.Now.Year; ordenDeCompraGeneral.obtenerNumeroOC(); ordenDeCompraGeneral.ProveedorID = db.Proveedores.Find(int.Parse(post["ProveedorID"].ToString())); if (string.IsNullOrEmpty(ordenDeCompraGeneral.ProveedorID.personaContacto1)) { ordenDeCompraGeneral.atencionA = "--"; } else { ordenDeCompraGeneral.atencionA = ordenDeCompraGeneral.ProveedorID.personaContacto1; } string fechaEntrega = post["fechaEntrega"].ToString(); ordenDeCompraGeneral.fechaEntrega = new DateTime(int.Parse(fechaEntrega.Split('/')[2]), int.Parse(fechaEntrega.Split('/')[1]), int.Parse(fechaEntrega.Split('/')[0])); string Fecha = post["Fecha"].ToString(); ordenDeCompraGeneral.Fecha = new DateTime(int.Parse(Fecha.Split('/')[2]), int.Parse(Fecha.Split('/')[1]), int.Parse(Fecha.Split('/')[0])); /* * string FechaVigencia = post["FechaVigencia"].ToString(); * * ordenDeCompraGeneral.FechaVigencia = new DateTime(int.Parse(FechaVigencia.Split('/')[2]), * int.Parse(FechaVigencia.Split('/')[1]), int.Parse(FechaVigencia.Split('/')[0])); * //*/ ordenDeCompraGeneral.obtenerID(); ordenDeCompraGeneral.guardar(); //Se guarda el detalle: string[] codigoDetalle = Request.Form.GetValues("codigoDetalle"); string[] cantidadDetalle = Request.Form.GetValues("cantidadDetalle"); string[] descripcionDetalle = Request.Form.GetValues("descripcionDetalle"); string[] tipoDeCompraDetalle = Request.Form.GetValues("tipoDeCompraDetalle"); string[] codigoInternoDetalleStock = Request.Form.GetValues("codigoInternoDetalleStock"); string[] codigoInternoDetalle = Request.Form.GetValues("codigoInternoDetalle"); string[] plazoEntregaDetalle = Request.Form.GetValues("plazoEntregaDetalle"); string[] precioUnitarioDetalle = Request.Form.GetValues("precioUnitarioDetalle"); string[] descuentoDetalle = Request.Form.GetValues("descuentoDetalle"); string[] totalDetalle = Request.Form.GetValues("totalDetalle"); for (int i = 0; i < codigoDetalle.Length; i++) { DetalleOrdenCompra detalle = new DetalleOrdenCompra(); //detalle.DetalleOrdenCompraID = detalle.IDOrdenCompra = ordenDeCompraGeneral.OrdenDeCompraGeneralID; detalle.codigo = codigoDetalle[i]; detalle.cantidad = double.Parse(cantidadDetalle[i].Replace(',', '.')); detalle.descripcion = descripcionDetalle[i]; detalle.tipoDeCompra = tipoDeCompraDetalle[i]; if (detalle.tipoDeCompra.Equals("Compra Directa")) { detalle.codigoInternoRentamaq = codigoInternoDetalle[i]; } else { detalle.codigoInternoRentamaq = codigoInternoDetalleStock[i]; } detalle.plazoEntrega = int.Parse(plazoEntregaDetalle[i].Split('.')[0]); detalle.precioUnitario = int.Parse(precioUnitarioDetalle[i].Split('.')[0]); detalle.descuento = int.Parse(descuentoDetalle[i].Split('.')[0]); detalle.porcentajeDescuento = 0; detalle.valorTotal = detalle.cantidad * (detalle.precioUnitario - detalle.descuento); detalle.obtenerID(); detalle.guardar(); } return(RedirectToAction("Index")); }
public static List <DetalleOrdenCompra> GetDetalleXOrdenDeCompra(int oc) { Acceso ac = new Acceso(); List <DetalleOrdenCompra> detalles = new List <DetalleOrdenCompra>(); string sql = "SELECT * from CONSULTAR_DETALLE_ORDEN_COMPRA where idOrdenCompra = @oc"; SqlCommand cmd = new SqlCommand(); cmd.Parameters.AddWithValue("@oc", oc); SqlConnection conexion = new SqlConnection(ac.getCadenaConexion()); try { conexion.Open(); cmd.Connection = conexion; cmd.CommandText = sql; cmd.CommandType = CommandType.Text; SqlDataReader dr = cmd.ExecuteReader(); DetalleOrdenCompra d; Producto p; UnidadMedida u; OrdenDeCompra o; while (dr.Read()) { o = new OrdenDeCompra(); o.idOrdenCompra = Convert.ToInt32(dr["idOrdenCompra"]); u = new UnidadMedida(); u.IDUnidad = Convert.ToInt32(dr["idUnidadMedida"]); u.Nombre = dr["Unidad"].ToString(); p = new Producto(); p.Nombre = dr["nombre"].ToString(); p.Unidad = u; p.idProducto = Convert.ToInt16(dr["idProducto"]); p.StockDisponible = Convert.ToDouble(dr["stockDisponible"]); p.StockRiesgo = Convert.ToDouble(dr["stockdeRiesgo"]); p.StockActual = Convert.ToDouble(dr["stockactual"]); p.StockReservado = Convert.ToDouble(dr["stockreservado"]); d = new DetalleOrdenCompra(); d.cantidad = Convert.ToDouble(dr["cantidad"]); d.producto = p; d.precio = Convert.ToDouble(dr["precio"]); d.subTotal = Convert.ToDouble(dr["subTotal"]); d.cantidadRealIngresada = Convert.ToDouble(dr["cantidadRealIngresada"]); d.ordenCompra = o; detalles.Add(d); } } catch (InvalidOperationException ex) { throw new ApplicationException(ex.Message); } catch (SqlException ex) { throw new ApplicationException("Error en BD: " + ex.Message); } finally { conexion.Close(); } return(detalles); }