public Consulta_Factura(Class_.Connection Connection, Class_.Factura Factura) { InitializeComponent(); this.Connection = Connection; this.Factura = Factura; }
private void buttonGenerar_Click(object sender, EventArgs e) { if (!Repetido(dataGridViewVenta.CurrentRow.Cells[0].Value.ToString())) { Connection.OpenConnection(); string fecha = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); Class_.Factura nFactura = new Class_.Factura(1, fecha, true, Convert.ToInt32(dataGridViewVenta.CurrentRow.Cells[0].Value)); Class_.Factura.AgregarFactura(Connection.myConnection, nFactura); Connection.CloseConnection(); MessageBox.Show("Factura Generada con exito"); this.Close(); } else { MessageBox.Show("Ya se ha facturado esta venta"); } }
private void buttonConsulta_Click(object sender, EventArgs e) { Connection.OpenConnection(); MySqlDataReader reader = Class_.Factura.BuscarFactura(Connection.myConnection, dataGridView1.CurrentRow.Cells[0].Value.ToString()); if (reader.Read()) { Class_.Factura nFactura = new Class_.Factura(reader.GetInt32(0), reader.GetString(1), reader.GetBoolean(2), reader.GetInt32(3)); Consulta_Factura consulta_factura = new Consulta_Factura(Connection, nFactura); Connection.CloseConnection(); consulta_factura.ShowDialog(); LoadDataActive(); } else { MessageBox.Show("Folio no existe"); } Connection.CloseConnection(); }