public static SaleDetail SearchDetail(MySqlConnection Connection, string idSale) { MySqlCommand command = new MySqlCommand(String.Format("SELECT * FROM detalleventa WHERE Venta_idVenta = '{0}'", idSale), Connection); MySqlDataReader reader = command.ExecuteReader(); SaleDetail newSale = new SaleDetail(reader.GetInt32(0), reader.GetInt32(1), reader.GetInt32(2), reader.GetDecimal(3)); return(newSale); }
public static int AddDetail(MySqlConnection Connection, SaleDetail saleDetail) { string Query = "INSERT INTO detalleventa (Producto_idProducto, Venta_idVenta, Cantidad, Precio) VALUES({0}, {1}, {2}, {3})"; MySqlCommand command = new MySqlCommand(String.Format(Query, saleDetail.idProduct, saleDetail.idSale, saleDetail.quantity, saleDetail.price), Connection); int Confirmation = command.ExecuteNonQuery(); return(Confirmation); }
//Agrega Detalle de venta private void AddDetail(int idProduct, int idSale, int quantity, decimal price) { Class_.SaleDetail newSale = new Class_.SaleDetail(idProduct, idSale, quantity, price); Class_.SaleDetail.AddDetail(Connection.myConnection, newSale); }