Ejemplo n.º 1
0
        public void ModificarSaldo(float saldo, int idcuenta)
        {
            Cuenta c = new Cuenta();

            if (saldo < 0)
            {
                throw new Exception("El saldo debe ser mayor a 0.");
            }

            if (idcuenta <= 0)
            {
                throw new Exception("Debe ser un id de cuenta valido.");
            }

            TransactionResult t = mapper.Update(c);

            if (!t.IsOk)
            {
                throw new Exception("Error al modificar el saldo de la cuenta. " + t.Error);
            }
        }
Ejemplo n.º 2
0
        public void ModificarSaldo(int idCuenta, float saldo)
        {
            Cuenta c = new Cuenta();

            c.Id    = idCuenta;
            c.Saldo = saldo;
            if (c.Saldo < 0)
            {
                throw new Exception("El saldo debe ser mayor a 0");
            }
            if (c.Id <= 0)
            {
                throw new Exception("Debe ser un ID de cuenta válido");
            }
            TransactionResult t = mapper.Update(c);

            if (!t.IsOk)
            {
                throw new Exception("Error al modificar el saldo de la cuenta. " + t.Error);
            }
        }
        public void AgregarSaldo(int idcuenta, float saldonuevo, float acreditacion)
        {
            Cuenta C = new Cuenta();

            C.Id    = idcuenta;
            C.Saldo = saldonuevo;

            TransactionResult resultado = mapper.Update(C);

            if (!resultado.IsOk)
            {
                throw new Exception("Hubo un error en la petición al servidor.Detalle: " + resultado.Error);
            }

            Utilidades U = new Utilidades(idcuenta, C.Saldo, acreditacion);

            TransactionResult enviomail = mapper.EnviarEmail(U);

            if (!enviomail.IsOk)
            {
                throw new Exception("Hubo un error en la petición al servidor.Detalle: " + resultado.Error);
            }
        }