public int InsertarTC(int tipo, int periodovencimiento, double limitecompra, int nroplastico, int idcliente) { TarjetaCredito TC = new TarjetaCredito(tipo, periodovencimiento, limitecompra, nroplastico, idcliente); TransactionResult resultado = mapper.Insert(TC); if (resultado.IsOk) { return(resultado.Id); } else { throw new Exception("Ha habido un erro al crear la tarjeta" + resultado.Error); } }
public int IngresarTarjetaCredito(TarjetaCredito tarjeta) { tarjeta.NroPlastico = GeneradorPlastico(tarjeta.Tipo); string reglas = ReglasTarjetaCredito(tarjeta); if (!string.IsNullOrEmpty(reglas)) { throw new TarjetaException("Error " + reglas); } else { TransactionResult resultado = TarjetaCreditoMapper.Insert(tarjeta); if (resultado.IsOk) { RecargarListaTarjeta(); return(resultado.Id); } else { throw new TarjetaException("Error al ingresar tarjeta " + resultado.Error); } } }