//Agrega venta private void AddSale() { Connection.OpenConnection(); Class_.Venta nVenta = new Class_.Venta(1, fecha, comboBoxTipoPago.Text, "V", true, textBoxSaldo.Text, Empleado.ID, int.Parse(textBoxIDcliente.Text)); Class_.Venta.AgregarVenta(Connection.myConnection, nVenta); MessageBox.Show("Compra exitosa", "GRACIAS POR SU COMPRA", MessageBoxButtons.OK, MessageBoxIcon.None); Connection.CloseConnection(); }
private void Consulta_Factura_Load(object sender, EventArgs e) { if (Factura.Disponible) { labelCancel.Visible = false; } labelFolioD.Text = Factura.ID.ToString(); labelFecha.Text = Factura.Fecha; Class_.Venta sale = LoadSale(); LoadCustomer(sale.ID_Cliente.ToString()); LoadDetail(sale.ID.ToString()); dataGridView1.ClearSelection(); }
private void LoadForm() { Connection.OpenConnection(); MySqlDataReader readerVenta = Class_.Venta.BuscarVenta(Connection.myConnection, idSale); if (readerVenta.Read()) { Class_.Venta venta = new Class_.Venta(readerVenta.GetInt32(0), readerVenta.GetString(1), readerVenta.GetString(2), readerVenta.GetString(3), readerVenta.GetBoolean(4), readerVenta.GetString(5), readerVenta.GetInt32(6), readerVenta.GetInt32(7)); string[] fecha = venta.Fecha_y_Hora.Split(' '); labelFecha.Text = fecha[0] + "\n" + fecha[1]; labelIDcliente.Text = venta.ID_Cliente.ToString(); labelTipoPago.Text = venta.TipoPago; labelSaldo.Text = venta.Balance; saldo = venta.Balance; if (!venta.Disponible) { labelCancelada.Text = "CANCELADA"; } Connection.CloseConnection(); Connection.OpenConnection(); MySqlDataReader readerCliente = Class_.Cliente.BuscarCliente(Connection.myConnection, venta.ID_Cliente.ToString()); if (readerCliente.Read()) { labelNombreCliente.Text = readerCliente.GetString(1) + " " + readerCliente.GetString(2); labelAdress.Text = readerCliente.GetString(3); labelTel.Text = readerCliente.GetString(6); labelEmail.Text = readerCliente.GetString(5); Connection.CloseConnection(); } Connection.CloseConnection(); Connection.OpenConnection(); MySqlDataReader readerEmpleado = Class_.Empleado.BuscarEmpleado(Connection.myConnection, venta.ID_Empleado.ToString()); if (readerEmpleado.Read()) { labelNombreEmpleado.Text = readerEmpleado.GetString(1) + " " + readerEmpleado.GetString(2); } } Connection.CloseConnection(); }
private Class_.Venta LoadSale() { Connection.OpenConnection(); MySqlDataReader reader = Class_.Venta.BuscarVenta(Connection.myConnection, Factura.ID_Venta.ToString()); if (reader.Read()) { Class_.Venta sale = new Class_.Venta(reader.GetInt32(0), reader.GetString(1), reader.GetString(2), reader.GetString(3), reader.GetBoolean(4), reader.GetString(5), reader.GetInt32(6), reader.GetInt32(7)); Connection.CloseConnection(); return(sale); } Connection.CloseConnection(); Class_.Venta sale2 = null; return(sale2); }