public AsientosDiario(string Compania) { this.compania = Compania; InitializeComponent(); this.numAsiento = LogicaAsientos.obtenerNuevoNumeroAsiento(compania); this.txtNumAsiento.Text = this.numAsiento.ToString(); this.listaCuentas = LogicaCuentas.cargarCuentasDisponiblesAsiento(compania); this.cmbCuenta.DisplayMember = "Nombre"; this.cmbCuenta.ValueMember = "ID"; this.cmbCuenta.SelectedText = "Nombre"; this.cmbCuenta.DataSource = this.listaCuentas; this.cuentasAsiento = new DataTable();//Datatable que se enviará cuando se guarda el asiento this.cuentasAsiento.TableName = "@Cuentas"; this.cuentasAsiento.Columns.Add("IdCuenta", typeof(int)); this.cuentasAsiento.Columns.Add("Debe", typeof(double)); this.cuentasAsiento.Columns.Add("Haber", typeof(double)); this.cuentasAsiento.Columns.Add("Moneda", typeof(string)); }
private void ButtonGuardarSeguir_Click(object sender, EventArgs e) { if (this.cuentasAsiento.Rows.Count > 1) { try { LogicaAsientos.crearAsiento(cuentasAsiento, compania, this.numAsiento, this.txtDetalle.Text); MessageBox.Show("Asiento creado con éxito."); this.cuentasAsiento.Clear(); this.DataGridViewAsiento.Rows.Clear(); this.numAsiento = LogicaAsientos.obtenerNuevoNumeroAsiento(compania); this.txtDetalle.Text = ""; } catch (Exception exc) { MessageBox.Show(exc.Message); } } else { MessageBox.Show("Ingrese al menos dos cuentas para realizar el asiento"); } }