public Boolean updatedetalle(clsDetalleCotizacion detalle) { try { return(Mcotizacion.updatedetalle(detalle)); } catch (Exception ex) { DevComponents.DotNetBar.MessageBoxEx.Show("Se encontró el siguiente problema: " + ex.Message, "Advertencia", MessageBoxButtons.OK, MessageBoxIcon.Warning); return(false); } }
public Boolean insertdetalle(clsDetalleCotizacion detalle) { try { con.conectarBD(); cmd = new MySqlCommand("GuardaDetalleCotizacion", con.conector); cmd.CommandType = CommandType.StoredProcedure; MySqlParameter oParam; oParam = cmd.Parameters.AddWithValue("codpro", detalle.CodProducto); oParam = cmd.Parameters.AddWithValue("descpro", detalle.Descripcion); oParam = cmd.Parameters.AddWithValue("codCotizacion", detalle.CodCotizacion); oParam = cmd.Parameters.AddWithValue("codalma", detalle.CodAlmacen); oParam = cmd.Parameters.AddWithValue("unidad", detalle.UnidadIngresada); oParam = cmd.Parameters.AddWithValue("serielote", detalle.SerieLote); oParam = cmd.Parameters.AddWithValue("cantidad", detalle.Cantidad); oParam = cmd.Parameters.AddWithValue("cantidadp", detalle.CantidadPendiente); oParam = cmd.Parameters.AddWithValue("precio", detalle.PrecioUnitario); oParam = cmd.Parameters.AddWithValue("subtotal", detalle.Subtotal); oParam = cmd.Parameters.AddWithValue("dscto1", detalle.Descuento1); oParam = cmd.Parameters.AddWithValue("dscto2", detalle.Descuento2); oParam = cmd.Parameters.AddWithValue("dscto3", detalle.Descuento3); oParam = cmd.Parameters.AddWithValue("montodscto", detalle.MontoDescuento); oParam = cmd.Parameters.AddWithValue("igv", detalle.Igv); oParam = cmd.Parameters.AddWithValue("importe", detalle.Importe); oParam = cmd.Parameters.AddWithValue("precioreal", detalle.PrecioReal); oParam = cmd.Parameters.AddWithValue("valoreal", detalle.ValoReal); oParam = cmd.Parameters.AddWithValue("codusu", detalle.CodUser); oParam = cmd.Parameters.AddWithValue("newid", 0); oParam.Direction = ParameterDirection.Output; int x = cmd.ExecuteNonQuery(); detalle.CodDetalleCotizacion = Convert.ToInt32(cmd.Parameters["newid"].Value); if (x != 0) { return(true); } else { return(false); } } catch (MySqlException ex) { throw ex; } finally { con.conector.Dispose(); cmd.Dispose(); con.desconectarBD(); } }
public clsDetalleCotizacion CargaDetalleCotizacion(Int32 CodCotizacion, Int32 CodAlmacen) { clsDetalleCotizacion cotizacion = null; try { con.conectarBD(); cmd = new MySqlCommand("MuestraDetalleCotizacion", con.conector); cmd.Parameters.AddWithValue("codCotizacion", CodCotizacion); cmd.Parameters.AddWithValue("codalma", CodAlmacen); cmd.CommandType = CommandType.StoredProcedure; dr = cmd.ExecuteReader(); if (dr.HasRows) { while (dr.Read()) { cotizacion = new clsDetalleCotizacion(); cotizacion.CodDetalleCotizacion = dr.GetInt32(0); cotizacion.CodProducto = dr.GetInt32(1); cotizacion.Referencia = dr.GetString(2); cotizacion.Descripcion = dr.GetString(3); cotizacion.UnidadIngresada = dr.GetInt32(4); cotizacion.Unidad = dr.GetString(5); cotizacion.SerieLote = dr.GetString(6); cotizacion.Cantidad = dr.GetDouble(7); cotizacion.PrecioUnitario = dr.GetDouble(8); cotizacion.Subtotal = dr.GetDouble(9); cotizacion.Descuento1 = dr.GetDouble(10); cotizacion.Descuento2 = dr.GetDouble(11); cotizacion.Descuento3 = dr.GetDouble(12); cotizacion.MontoDescuento = dr.GetDouble(13); cotizacion.ValorVenta = dr.GetDouble(14); cotizacion.Igv = dr.GetDouble(15); cotizacion.Importe = dr.GetDouble(16); cotizacion.PrecioReal = dr.GetDouble(17); cotizacion.ValoReal = dr.GetDouble(18); cotizacion.CodUser = Convert.ToInt32(dr.GetDecimal(19)); cotizacion.FechaRegistro = dr.GetDateTime(20); } } return(cotizacion); } catch (MySqlException ex) { throw ex; } finally { con.conector.Dispose(); cmd.Dispose(); con.desconectarBD(); } }
public Boolean updatedetalle(clsDetalleCotizacion detalle) { try { con.conectarBD(); cmd = new MySqlCommand("ActualizaDetalleCotizacion", con.conector); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("coddeta", detalle.CodDetalleCotizacion); cmd.Parameters.AddWithValue("unidad", detalle.UnidadIngresada); cmd.Parameters.AddWithValue("serielote", detalle.SerieLote); cmd.Parameters.AddWithValue("cantidad", detalle.Cantidad); cmd.Parameters.AddWithValue("precio", detalle.PrecioUnitario); cmd.Parameters.AddWithValue("subtotal", detalle.Subtotal); cmd.Parameters.AddWithValue("descuento1", detalle.Descuento1); cmd.Parameters.AddWithValue("descuento2", detalle.Descuento2); cmd.Parameters.AddWithValue("descuento3", detalle.Descuento3); cmd.Parameters.AddWithValue("montodscto", detalle.MontoDescuento); cmd.Parameters.AddWithValue("igv", detalle.Igv); cmd.Parameters.AddWithValue("importe", detalle.Importe); cmd.Parameters.AddWithValue("precioreal", detalle.PrecioReal); cmd.Parameters.AddWithValue("valoreal", detalle.ValoReal); int x = cmd.ExecuteNonQuery(); if (x != 0) { return(true); } else { return(false); } } catch (MySqlException ex) { throw ex; } finally { con.conector.Dispose(); cmd.Dispose(); con.desconectarBD(); } }
private void añadedetalle(DataGridViewRow fila) { clsDetalleCotizacion deta = new clsDetalleCotizacion(); deta.CodProducto = Convert.ToInt32(fila.Cells[codproducto.Name].Value); deta.Referencia = fila.Cells[referencia.Name].Value.ToString(); if (deta.CodProducto == 1514) { deta.Descripcion = fila.Cells[descripcion.Name].Value.ToString(); } else { deta.Descripcion = ""; } deta.CodCotizacion = Convert.ToInt32(cotizacion.CodCotizacion); deta.CodAlmacen = frmLogin.iCodAlmacen; deta.UnidadIngresada = Convert.ToInt32(fila.Cells[codunidad.Name].Value); deta.SerieLote = fila.Cells[serielote.Name].Value.ToString(); deta.Cantidad = Convert.ToDouble(fila.Cells[cantidad.Name].Value); deta.PrecioUnitario = Convert.ToDouble(fila.Cells[preciounit.Name].Value); deta.Subtotal = Convert.ToDouble(fila.Cells[importe.Name].Value); deta.Descuento1 = Convert.ToDouble(fila.Cells[dscto1.Name].Value); //deta.Descuento2 = Convert.ToDouble(fila.Cells[dscto2.Name].Value); //deta.Descuento3 = Convert.ToDouble(fila.Cells[dscto3.Name].Value); deta.MontoDescuento = Convert.ToDouble(fila.Cells[montodscto.Name].Value); deta.Igv = Convert.ToDouble(fila.Cells[igv.Name].Value); deta.Importe = Convert.ToDouble(fila.Cells[precioventa.Name].Value); deta.PrecioReal = Convert.ToDouble(fila.Cells[precioreal.Name].Value); deta.ValoReal = Convert.ToDouble(fila.Cells[valoreal.Name].Value); deta.CodUser = frmLogin.iCodUser; deta.CantidadPendiente = Convert.ToDouble(fila.Cells[cantidad.Name].Value); detalle.Add(deta); if (deta.CodProducto != 1514) { detalle1.Add(deta); } }