public BindingList <BilleteFalso> selectBilletesFalsos(int codigoDeposito) { BindingList <BilleteFalso> bf = new BindingList <BilleteFalso>(); SqlCommand comando = _manejador.obtenerProcedimiento("SelectBilleteFalsoDeposito"); _manejador.agregarParametro(comando, "@IDDEPOSITO", codigoDeposito, SqlDbType.Int); SqlDataReader datareader = null; try { datareader = _manejador.ejecutarConsultaDatos(comando); while (datareader.Read()) { int ID = (int)datareader["pk_ID"]; string serie = (string)datareader["Serie"]; Monedas moneda = (Monedas)datareader["Moneda"]; Decimal valorDen = (Decimal)datareader["Denominacion"]; Denominacion denominacion = new Denominacion(valor: valorDen, moneda: moneda); BilleteFalso billete = new BilleteFalso(id: ID, serie_billete: serie, denominacion: denominacion, moneda: moneda); bf.Add(billete); } comando.Connection.Close(); } catch { comando.Connection.Close(); throw new Excepcion("Error al obtener datos de la tabla billetes falsos"); } return(bf); }
public void updateBilleteFalsoDeposito(BilleteFalso bf) { SqlCommand comando = _manejador.obtenerProcedimiento("UpdateProcBajoVolDepositoBilleteF"); _manejador.agregarParametro(comando, "@id", bf.ID, SqlDbType.Int); _manejador.agregarParametro(comando, "@serie", bf.SerieBillete, SqlDbType.NVarChar); _manejador.agregarParametro(comando, "@moneda", bf.Moneda, SqlDbType.TinyInt); _manejador.agregarParametro(comando, "@denominacion", bf.denominacion.Valor, SqlDbType.Decimal); try { _manejador.ejecutarConsultaActualizacion(comando); comando.Connection.Close(); } catch { comando.Connection.Close(); throw new Excepcion("Error al actualizar la lista de billetes falsos"); } }
public void insertBilleteFalsoDepostito(int p, BilleteFalso bf) { SqlCommand comando = _manejador.obtenerProcedimiento("InsertBilleteFalsoDeposito"); _manejador.agregarParametro(comando, "@ID_ProcesamientoBajoVolumenDeposito", p, SqlDbType.Int); _manejador.agregarParametro(comando, "@serie", bf.SerieBillete, SqlDbType.NVarChar); _manejador.agregarParametro(comando, "@Moneda", bf.Moneda, SqlDbType.Int); _manejador.agregarParametro(comando, "@Denominacion", bf.denominacion.Valor, SqlDbType.Money); try { _manejador.ejecutarConsultaActualizacion(comando); comando.Connection.Close(); } catch { comando.Connection.Close(); throw new Excepcion("Error al insertar en la lista de cheques "); } }
private void btnAgregar_Click(object sender, EventArgs e) { try { if (validarcamposagregar()) { epError.SetError(dgvbilletes, ""); _listabilletefalso = (BindingList <BilleteFalso>)dgvbilletes.DataSource; billete = new BilleteFalso(serie_billete: txtCodigo.Text, moneda: (Monedas)cboMoneda.SelectedIndex, denominacion: (Denominacion)cboDenominacion.SelectedItem); if (dgvbilletes.SelectedRows.Count != 0) { billete.ID = Int32.Parse(dgvbilletes.SelectedRows[0].Cells["ID"].Value.ToString()); _listabilletefalso[dgvbilletes.SelectedRows[0].Index] = billete; /*dgvbilletes.Rows[dgvbilletes.SelectedRows[0].Index].Cells["Serie"].Value = billete.SerieBillete; * dgvbilletes.Rows[dgvbilletes.SelectedRows[0].Index].Cells["Denominacion"].Value = billete.denominacion; * dgvbilletes.Rows[dgvbilletes.SelectedRows[0].Index].Cells["Moneda"].Value = billete.Moneda;*/ dgvbilletes.Refresh(); dgvbilletes.ClearSelection(); //billete.Moneda = (Monedas)cboMoneda.SelectedValue; //billete.SerieBillete = txtCodigo.Text; //billete.Monto = decimal.Parse(cboDenominacion.SelectedValue); } else { _listabilletefalso.Add(billete); /*dgvbilletes.Rows.Add(billete.Moneda, billete.denominacion, billete.SerieBillete); */ dgvbilletes.Refresh(); limpiarcampos(); } } } catch (Excepcion ex) { ex.mostrarMensaje(); } }
/// <summary> /// Este método permite borrar billetes falsos /// </summary> /// <param name="billete">Objeto Billete Falso (BilleteFalso)</param> public void borrarBilleteFalso(BilleteFalso billete) { _billetesfalsos.Remove(billete); }
/// <summary> /// Este método permite agregar billetes falsos /// </summary> /// <param name="billete">Objeto Billete Falso (BilleteFalso)</param> public void agregarBilleteFalso(BilleteFalso billete) { _billetesfalsos.Add(billete); }