Ejemplo n.º 1
0
 public void Sacar_320_Retorna_3_Notas_De_100_Eh_1_Nota_De_20()
 {
     var atm = new ATM();
     var resultado = atm.sacar(320);
     Assert.AreEqual(3, resultado.Quantidade_Da_Nota(100));
     Assert.AreEqual(1, resultado.Quantidade_Da_Nota(20));
 }
Ejemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     // find ATM in parent
     if (!atm)
     {
         atm = gameObject.GetComponentInParent<ATM>();
     }
 }
    // Code that runs on entering the state.
    public override void OnEnter()
    {
        atm = Owner.GetComponent<ATM>();

        atm.screenInfo = "You Got a Ticket!\nThank you.";
        atm.Display();

        currentTime = delayTime;
    }
Ejemplo n.º 4
0
    // Code that runs on entering the state.
    public override void OnEnter()
    {
        atm = Owner.GetComponent<ATM>();

        // Next AD to show
        atm.NextAD();
        atm.Display();

        Finish();
    }
Ejemplo n.º 5
0
  public static void Main(string[] args)
  {
    // crear hilos
    ATM at1 = new ATM ();
    Thread t1 = new ThreadStart();
    Thread t2 = new ThreadStart();

    t1.Start();
    t2.Start();
  }
Ejemplo n.º 6
0
        private void UpdateNearbyATM()
        {
            if (_nearbyATM == null)
            {
                return;
            }

            if (Game.Player.Character.Position.DistanceTo(_nearbyATM.position) < 1f)
            {
                if (Game.IsControlJustPressed(Control.Talk))
                {
                    if (_usingAtm)
                    {
                        Game.Player.Character.Task.ClearAll();
                        Game.Player.Character.Task.ClearSecondary();
                        Wait(7000);
                        _usingAtm = false;
                    }
                    else
                    {
                        Game.Player.Character.Weapons.Select(WeaponHash.Unarmed);
                        Wait(200);
                        Game.Player.Character.Task.GoStraightTo(_nearbyATM.position, -1, _nearbyATM.heading, 600);
                        Wait(600);
                        Vector3 newPos = Game.Player.Character.Position - Game.Player.Character.ForwardVector * 0.15f;
                        Function.Call(Hash.TASK_START_SCENARIO_AT_POSITION, Game.Player.Character, "PROP_HUMAN_ATM", newPos.X, newPos.Y, newPos.Z, _nearbyATM.heading, 600000, false, false);
                        Wait(7000);
                        _usingAtm = true;
                    }
                }
                else
                {
                    if (_usingAtm)
                    {
                        Screen.ShowHelpTextThisFrame("Press ~INPUT_TALK~ to stop using the ATM.");
                    }
                    else
                    {
                        Screen.ShowHelpTextThisFrame("Press ~INPUT_TALK~ to use the ATM.");
                    }
                }
            }
            else
            {
                _nearbyATM = null;
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Mostrar la ventana de modificación.
        /// </summary>
        public void mostrarVentanaModificacion()
        {
            try
            {
                if (dgvATMs.SelectedRows.Count > 0)
                {
                    ATM atm = (ATM)dgvATMs.SelectedRows[0].DataBoundItem;
                    frmMantenimientoATMs formulario = new frmMantenimientoATMs(atm);

                    formulario.ShowDialog(this);
                }
            }
            catch (Excepcion ex)
            {
                ex.mostrarMensaje();
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// Clic en el botón de actualizar.
        /// </summary>
        private void btnActualizar_Click(object sender, EventArgs e)
        {
            try
            {
                DateTime    fecha  = dtpFecha.Value;
                Colaborador cajero = cboCajero.SelectedItem is Colaborador ?
                                     (Colaborador)cboCajero.SelectedItem : null;
                ATM atm = cboATM.SelectedItem is ATM ?
                          (ATM)cboATM.SelectedItem : null;

                dgvDescargas.DataSource = _coordinacion.listarDescargasATMsFull(cajero, atm, fecha);
            }
            catch (Excepcion ex)
            {
                ex.mostrarMensaje();
            }
        }
Ejemplo n.º 9
0
        public bool UpdateATM(ATM atm)
        {
            int rowsAffected = this._db.Execute("ATMs_Update",
                                                new
            {
                Id     = atm.Id,
                Name   = atm.Name,
                BankId = atm.BankId
            }, commandType: CommandType.StoredProcedure);

            if (rowsAffected > 0)
            {
                return(true);
            }

            return(false);
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Obtener los detalle de una falla .
        /// </summary>
        /// <param name="c">Falla para el cual se obtiene la lista de detalles de falla</param>
        public void obtenerDatosPromedioDescargaATM(ref PromedioDescargaATM promedio)
        {
            SqlCommand    comando    = _manejador.obtenerProcedimiento("SelectPromedioDescargaATMDatos");
            SqlDataReader datareader = null;

            _manejador.agregarParametro(comando, "@atm", promedio.ATM.ID, SqlDbType.SmallInt);

            try
            {
                datareader = _manejador.ejecutarConsultaDatos(comando);

                if (datareader.Read())
                {
                    int     id    = (int)datareader["ID_Promedio"];
                    decimal monto = (decimal)datareader["Monto"];

                    ATM atm = null;

                    short  id_atm = 0;
                    short  numero = 0;
                    string codigo = "";

                    if (datareader["ID_ATM"] != DBNull.Value)
                    {
                        id_atm = (short)datareader["ID_ATM"];
                        numero = (short)datareader["Numero"];
                        codigo = (string)datareader["Codigo"];

                        atm = new ATM(id: id_atm, numero: numero, codigo: codigo);
                    }


                    promedio.ATM   = atm;
                    promedio.ID    = id;
                    promedio.Monto = monto;
                }


                comando.Connection.Close();
            }
            catch (Exception)
            {
                comando.Connection.Close();
                throw new Excepcion("ErrorDatosConexion");
            }
        }
Ejemplo n.º 11
0
            public void InsertCard(Card card, ATM atm)
            {
                atm.RequestPIN();
                int PIN = EnterPIN();

                if (!atm.VerifyPIN(PIN, card))
                {
                    Console.WriteLine("PIN Not Accepted ...");
                }
                else
                {
                    Console.WriteLine("PIN Accepted ...");
                    Console.WriteLine("Please choose options");
                    Console.WriteLine("1. Deposit");
                    Console.WriteLine("2. Withdraw");
                }
            }
Ejemplo n.º 12
0
 static void Main(string[] args)
 {
     Atm = new ATM();
     while (true)
     {
         Atm.ReinicializarATM();
         if (IsAuthenticated())
         {
             SeleccionarOpcion();
         }
         else
         {
             Console.WriteLine("Invalid ATM card. It will be retained");
             Thread.Sleep(3000);
         }
     }
 }
Ejemplo n.º 13
0
        public void OnClientEvent(Client client, string eventName, params object[] arguments)         //arguments param can contain multiple params
        {
            switch (eventName)
            {
            case "KeyboardKey_E_Pressed":
                if (!client.isInVehicle)
                {
                    if (client.hasData("player"))
                    {
                        ATM atm = ATMService.ATMList.FirstOrDefault(x => x.Position.DistanceTo(client.position) <= 1);
                        if (atm != null)
                        {
                            OpenATM(client);
                            API.sendChatMessageToPlayer(client, "ATM with ID: ~y~" + atm.Id + " ~w~found");
                        }
                    }
                }
                break;

            case "ATM_Withdraw":
                if (MoneyService.HasPlayerEnoughBank(client, Convert.ToDouble(arguments[0])))
                {
                    MoneyService.WithdrawMoney(client, Convert.ToDouble(arguments[0]));
                    API.sendNotificationToPlayer(client, "~g~" + arguments[0] + " $~w~ was withdrawn from the account.");
                    API.triggerClientEvent(client, "ATM_CloseMenu");
                }
                else
                {
                    API.sendNotificationToPlayer(client, "~r~You don't have enough money on your account.");
                }
                break;

            case "ATM_Deposit":
                if (MoneyService.HasPlayerEnoughCash(client, Convert.ToDouble(arguments[0])))
                {
                    MoneyService.DepositMoney(client, Convert.ToDouble(arguments[0]));
                    API.sendNotificationToPlayer(client, "There were ~g~" + arguments[0] + " $~w~ added to your account.");
                    API.triggerClientEvent(client, "ATM_CloseMenu");
                }
                else
                {
                    API.sendNotificationToPlayer(client, "~r~You don't have enough money at your wallet.");
                }
                break;
            }
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Eliminar los datos de un ATM.
        /// </summary>
        /// <param name="a">Objeto ATM con los datos del ATM a eliminar</param>
        public void eliminarATM(ATM a)
        {
            SqlCommand comando = _manejador.obtenerProcedimiento("DeleteATM");

            _manejador.agregarParametro(comando, "@atm", a, SqlDbType.SmallInt);

            try
            {
                _manejador.ejecutarConsultaActualizacion(comando);
                comando.Connection.Close();
            }
            catch (Exception)
            {
                comando.Connection.Close();
                throw new Excepcion("ErrorATMEliminacion");
            }
        }
Ejemplo n.º 15
0
        public void ATM_Withdrawal_60_Returns_A_50_And_10_Dollar_Bill()
        {
            var atm    = new ATM();
            var result = atm.Withdrawal(60);

            Assert.True(result.Count == 2);
            Assert.True(result.Find(bill => bill.BillDenomination == 50).TotalToWithdrawal == 1);
            Assert.True(result.Find(bill => bill.BillDenomination == 10).TotalToWithdrawal == 1);


            Assert.True(atm.Bills.AvailableBills.Find(bill => bill.BillDenomination == 100).TotalInATM == 10);
            Assert.True(atm.Bills.AvailableBills.Find(bill => bill.BillDenomination == 50).TotalInATM == 9);
            Assert.True(atm.Bills.AvailableBills.Find(bill => bill.BillDenomination == 20).TotalInATM == 10);
            Assert.True(atm.Bills.AvailableBills.Find(bill => bill.BillDenomination == 10).TotalInATM == 9);
            Assert.True(atm.Bills.AvailableBills.Find(bill => bill.BillDenomination == 5).TotalInATM == 10);
            Assert.True(atm.Bills.AvailableBills.Find(bill => bill.BillDenomination == 1).TotalInATM == 10);
        }
Ejemplo n.º 16
0
    public static void Main(string [] args)
    {
        bool flag = true;
        Bank bank = new Bank();

        bank.OpenAccount("2222", "2222", 20);
        bank.OpenAccount("3333", "3333", 50);
        bank.OpenCreditCard(100, "4444", "4444", 50);
        bank.OpenCreditCard(100, "5555", "5555", 500);
        ATM atm = new ATM(bank);

        while (flag)
        {
            Console.Clear();
            atm.Transaction();
        }
    }
Ejemplo n.º 17
0
        private void SelecionarTransacao()
        {
            var atm = ATM.GetInstance();

            while (atm.UsuarioAutenticado == true)
            {
                MostrarMenu();
                try
                {
                    int opc = atm.ServicoTeclado.ObterEntrada();

                    switch (opc)
                    {
                    case 1:

                        Transacao(new ServicoPesquisaSaldo(atm.numeroConta));

                        break;

                    case 2:

                        Transacao(new ServicoSaque(atm.numeroConta));

                        break;

                    case 3:

                        Transacao(new ServicoDeposito(atm.numeroConta));

                        break;

                    case 4:
                        atm.UsuarioAutenticado = false;
                        atm.ServicoTela.LimparTela();
                        break;

                    default:
                        break;
                    }
                }
                catch (FormatException)
                {
                    atm.ServicoTela.MostrarMensagemLinhaEspera("Formato incorreto! Informe apenas números.");
                }
            }
        }
Ejemplo n.º 18
0
        public void Init()
        {
            _logger    = NSubstitute.Substitute.For <ILogger>();
            _airspace  = NSubstitute.Substitute.For <IAirspace>();
            _rendition = Substitute.For <IRendition>();

            _planeSeparation = Substitute.For <IPlaneSeparation>();
            _planeSeparation.CheckPlanes(Arg.Any <List <IPlane> >()).Returns(new List <List <IPlane> >());



            // Todo: delete comment
            //_planeSeparation = new PlaneSeparation( 500, 3000 );

            // Air Traffic Monitor
            uut = new ATM(_airspace, _planeSeparation, _rendition, _logger);
        }
Ejemplo n.º 19
0
        public ATM LayThongTinMayATM(string maATM)
        {
            ATM       atm   = new ATM();
            string    query = @"SELECT [MaATM]
      ,[TenChiNhanh]
      ,[ViTriATM]
  FROM [M_ATM].[dbo].[ATM] where MaATM = @ma";
            DataTable dt    = DataProvider.Instance.ExcuteQuery(query, new object[] { maATM });

            if (dt.Rows.Count > 0)
            {
                atm.MaATM       = dt.Rows[0][0].ToString();
                atm.TenChiNhanh = dt.Rows[0][1].ToString();
                atm.ViTriATM    = dt.Rows[0][2].ToString();
            }
            return(atm);
        }
    private void OnTriggerExit(Collider other)
    {
        WeaponPickedUpOrLeft();

        //player leaves GUN-inator premise
        if (the_GUNINATOR != null)
        {
            the_GUNINATOR = null;
            press_E.SetActive(false);
        }
        //player enter ATM premise
        if (the_ATM != null)
        {
            the_ATM = null;
            press_E.SetActive(false);
        }
    }
Ejemplo n.º 21
0
        /// <summary>
        /// Leer los montos remanentes del AS400.
        /// </summary>
        private void leerRemanentesAS400()
        {
            try
            {
                _remanentes.Clear();

                //  DataTable datos = _coordinacion.listarRemanentesAS400();
                DataTable datos = _coordinacion.listarRemanentesATMsCompletos();
                DateTime  fecha = DateTime.Now;

                foreach (DataRow fila in datos.Rows)
                {
                    // Asignar el ATM

                    string valor_numero_atm = (string)fila["CAJLNO"];

                    short numero_atm = short.Parse(valor_numero_atm);

                    ATM atm = new ATM(numero: numero_atm);

                    _mantenimiento.obtenerDatosATM(ref atm);

                    if (atm.ID_Valido)
                    {
                        RegistroRemanentesATM nuevo = new RegistroRemanentesATM(atm: atm, fecha: fecha);

                        // Asignar los remanentes de los cartuchos

                        string codigos = (string)fila["CAJCDI"];

                        this.leerCantidadRemanenteCartucho(codigos[0].ToString(), (decimal)fila["CAJCB1"], nuevo, 1);
                        this.leerCantidadRemanenteCartucho(codigos[1].ToString(), (decimal)fila["CAJCB2"], nuevo, 2);
                        this.leerCantidadRemanenteCartucho(codigos[2].ToString(), (decimal)fila["CAJCB3"], nuevo, 3);
                        this.leerCantidadRemanenteCartucho(codigos[3].ToString(), (decimal)fila["CAJCB4"], nuevo, 4);

                        _remanentes.Add(nuevo);
                    }
                }

                dgvMontos.DataSource = _remanentes;
            }
            catch (Excepcion ex)
            {
                ex.mostrarMensaje();
            }
        }
Ejemplo n.º 22
0
        public void ATM_Withdrawal_Documentation_Example()
        {
            var atm     = new ATM();
            var result1 = atm.Withdrawal(208);

            Assert.True(result1.Count == 3);
            Assert.True(result1.Find(bill => bill.BillDenomination == 100).TotalToWithdrawal == 2);
            Assert.True(result1.Find(bill => bill.BillDenomination == 5).TotalToWithdrawal == 1);
            Assert.True(result1.Find(bill => bill.BillDenomination == 1).TotalToWithdrawal == 3);

            Assert.True(atm.Bills.AvailableBills.Find(bill => bill.BillDenomination == 100).TotalInATM == 8);
            Assert.True(atm.Bills.AvailableBills.Find(bill => bill.BillDenomination == 50).TotalInATM == 10);
            Assert.True(atm.Bills.AvailableBills.Find(bill => bill.BillDenomination == 20).TotalInATM == 10);
            Assert.True(atm.Bills.AvailableBills.Find(bill => bill.BillDenomination == 10).TotalInATM == 10);
            Assert.True(atm.Bills.AvailableBills.Find(bill => bill.BillDenomination == 5).TotalInATM == 9);
            Assert.True(atm.Bills.AvailableBills.Find(bill => bill.BillDenomination == 1).TotalInATM == 7);

            var result2 = atm.Withdrawal(9);

            Assert.True(result2.Count == 2);
            Assert.True(result2.Find(bill => bill.BillDenomination == 5).TotalToWithdrawal == 1);
            Assert.True(result2.Find(bill => bill.BillDenomination == 1).TotalToWithdrawal == 4);

            Assert.True(atm.Bills.AvailableBills.Find(bill => bill.BillDenomination == 100).TotalInATM == 8);
            Assert.True(atm.Bills.AvailableBills.Find(bill => bill.BillDenomination == 50).TotalInATM == 10);
            Assert.True(atm.Bills.AvailableBills.Find(bill => bill.BillDenomination == 20).TotalInATM == 10);
            Assert.True(atm.Bills.AvailableBills.Find(bill => bill.BillDenomination == 10).TotalInATM == 10);
            Assert.True(atm.Bills.AvailableBills.Find(bill => bill.BillDenomination == 5).TotalInATM == 8);
            Assert.True(atm.Bills.AvailableBills.Find(bill => bill.BillDenomination == 1).TotalInATM == 3);

            try
            {
                atm.Withdrawal(9);
            }
            catch (Exception e)
            {
                Assert.True(e.Message == "Insufficient Funds.");
                Assert.True(atm.Bills.AvailableBills.Find(bill => bill.BillDenomination == 100).TotalInATM == 8);
                Assert.True(atm.Bills.AvailableBills.Find(bill => bill.BillDenomination == 50).TotalInATM == 10);
                Assert.True(atm.Bills.AvailableBills.Find(bill => bill.BillDenomination == 20).TotalInATM == 10);
                Assert.True(atm.Bills.AvailableBills.Find(bill => bill.BillDenomination == 10).TotalInATM == 10);
                Assert.True(atm.Bills.AvailableBills.Find(bill => bill.BillDenomination == 5).TotalInATM == 8);
                Assert.True(atm.Bills.AvailableBills.Find(bill => bill.BillDenomination == 1).TotalInATM == 3);
            }
        }
Ejemplo n.º 23
0
        /// <summary>
        /// Asignar un día de carga a un ATM.
        /// </summary>
        /// <param name="a">Objeto ATM con los datos del ATM</param>
        /// <param name="d">Día de carga que se asigna al ATM</param>
        public void agregarDiaCargaATM(ATM a, Dias d)
        {
            SqlCommand comando = _manejador.obtenerProcedimiento("InsertATMDiaCarga");

            _manejador.agregarParametro(comando, "@atm", a, SqlDbType.SmallInt);
            _manejador.agregarParametro(comando, "@dia", d, SqlDbType.TinyInt);

            try
            {
                _manejador.ejecutarConsultaActualizacion(comando);
                comando.Connection.Close();
            }
            catch (Exception)
            {
                comando.Connection.Close();
                throw new Excepcion("ErrorATMActualizacion");
            }
        }
Ejemplo n.º 24
0
        /// <summary>
        /// Buscar si ya se registro la carga para un ATM.
        /// </summary>
        private CargaATM buscarCarga(ATM atm, DateTime fecha)
        {
            foreach (CargaATM carga in _cargas)
            {
                if (carga.ATM.Numero == atm.Numero)
                {
                    return(carga);
                }
            }

            CargaATM nueva = new CargaATM(atm, transportadora: atm.Empresa_encargada, fecha_asignada: fecha,
                                          tipo: atm.Tipo, externa: atm.Externo, atm_full: atm.Full,
                                          cartucho_rechazo: atm.Cartucho_rechazo, ena: atm.ENA);

            _cargas.Add(nueva);

            return(nueva);
        }
Ejemplo n.º 25
0
        static void Main(string[] args)
        {
            RepositoryATM     repository    = new RepositoryATM();
            AccountRepository accRepository = new AccountRepository();
            Account           acc1          = new Account();
            Card card1 = acc1.Initialize(accRepository);

            User      user1      = new User(card1);
            Collector collector1 = new Collector("John");

            ATM atm1 = new ATM();

            atm1.InitializeATM(repository, atm1);

            atm1.LoadCurrency(collector1, 50000);

            atm1.Start(accRepository, user1);
        }
Ejemplo n.º 26
0
        /// <summary>
        /// Clic en el boton de Actualizar para coordinadores.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnActualizarEspecial_Click(object sender, EventArgs e)
        {
            try
            {
                DateTime    fecha  = dtpFecha.Value;
                Colaborador cajero = null;
                ATM         atm    = null;
                byte?       ruta   = chkRuta.Checked ?
                                     (byte?)nudRuta.Value : null;
                EmpresaTransporte transportadora = null;

                dgvCargasSucursales.DataSource = _coordinacion.listarCargasATMsEspeciales(cajero, atm, fecha, ruta, transportadora);
            }
            catch (Excepcion ex)
            {
                ex.mostrarMensaje();
            }
        }
Ejemplo n.º 27
0
        static void Main(string[] args)
        {
            Console.WriteLine("=====CAJERO FIA USMP=====");
            GenerateCuentas gen = new GenerateCuentas();

            Console.WriteLine();
            ATM atm = new ATM();

            Console.WriteLine("Cuentas disponibles (Información para Login)");
            List <Cuenta> listaCuentas = gen.getListaCuentas();
            BaseDatos     bd           = new BaseDatos();

            bd.listaCuenta = listaCuentas;

            gen.ImprimirCuentas(listaCuentas);
            Console.WriteLine();
            atm.login(bd);
        }
Ejemplo n.º 28
0
        /// <summary>
        /// Listar las cargas de emergencia por fecha.
        /// </summary>
        /// <param name="f">Fecha de las cargas que se listarán</param>
        public BindingList <CargaEmergenciaATM> listarCargasEmergenciaATMs(DateTime f)
        {
            BindingList <CargaEmergenciaATM> cargas = new BindingList <CargaEmergenciaATM>();
            SqlCommand    comando    = _manejador.obtenerProcedimiento("SelectCargasEmergenciaATMs");
            SqlDataReader datareader = null;

            _manejador.agregarParametro(comando, "@fecha", f, SqlDbType.Date);

            try
            {
                datareader = _manejador.ejecutarConsultaDatos(comando);

                while (datareader.Read())
                {
                    int  id_carga          = (int)datareader["ID_Carga"];
                    bool descargada        = (bool)datareader["Descargada"];
                    int  numero_emergencia = (int)(byte)datareader["Numero_Emergencia"];

                    ATM atm = null;

                    if (datareader["ID_ATM"] != DBNull.Value)
                    {
                        short  id_atm = (short)datareader["ID_ATM"];
                        short  numero = (short)datareader["Numero"];
                        string codigo = (string)datareader["Codigo"];

                        atm = new ATM(id: id_atm, numero: numero, codigo: codigo);
                    }

                    CargaEmergenciaATM carga = new CargaEmergenciaATM(id: id_carga, atm: atm, fecha: f, descargada: descargada, numero_emergencia: numero_emergencia);

                    cargas.Add(carga);
                }

                comando.Connection.Close();
            }
            catch (Exception)
            {
                comando.Connection.Close();
                throw new Excepcion("ErrorDatosConexion");
            }

            return(cargas);
        }
        private static void Main()
        {
            Console.WriteLine("Choose the operation");
            Console.WriteLine("1 - OCP");
            Console.WriteLine("2 - LSP");

            var option = Console.ReadKey();

            switch (option.KeyChar)
            {
            case '1':
                ATM.Operations();
                break;

            case '2':
                AreaCalculation.Calculate();
                break;
            }
        }
Ejemplo n.º 30
0
        /// <summary>
        /// Clic en el botón de eliminar ATM.
        /// </summary>
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            try
            {
                if (Mensaje.mostrarMensajeConfirmacion("MensajeATMEliminacion") == DialogResult.Yes)
                {
                    ATM atm = (ATM)dgvATMs.SelectedRows[0].DataBoundItem;

                    _mantenimiento.eliminarATM(atm);

                    dgvATMs.Rows.Remove(dgvATMs.SelectedRows[0]);
                    Mensaje.mostrarMensaje("MensajeATMConfirmacionEliminacion");
                }
            }
            catch (Excepcion ex)
            {
                ex.mostrarMensaje();
            }
        }
Ejemplo n.º 31
0
        public static int Main(string[] args)
        {
            ATM airTrafficMonitor = new ATM(new AreaMonitorPrinter(),
                                            new VelocityCalculator(), new HeadingCalculator());

            CollisionWarner separationWarningSystem = new CollisionWarner(new SeparationPrinter());

            // Using the real transponder data receiver
            var receiver = TransponderReceiverFactory.CreateTransponderDataReceiver();

            AreaMonitor areaMonitorReceiver = new AreaMonitor(new DataHandler(receiver));

            areaMonitorReceiver.Attach(airTrafficMonitor);
            areaMonitorReceiver.Attach(separationWarningSystem);
            while (true)
            {
                Thread.Sleep(1000);
            }
        }
Ejemplo n.º 32
0
        public void TakeoutTenTest()
        {
            double input = 10;
            double intial;

            if (Globals.BalanceAmount > 20)
            {
                intial = Globals.BalanceAmount;
            }
            else
            {
                Globals.BalanceAmount += 50;
                intial = Globals.BalanceAmount;
            }
            double result   = ATM.Withdraw(input);
            double expected = intial - 10;

            Assert.Equal(expected, result);
        }
Ejemplo n.º 33
0
        static void Main(string[] args)
        {
            // loginStatus -1 is logged out.  Anything else is the "account number"
            int loginStatus = -1;

            int mainMenuSelection = 0;

            List <string> mainMenu = new List <string>
            {
                "Register", "Login"
            };

            // Build initial bank and account info
            List <Account> accountList = new List <Account> {
            };

            ATM.BuildABank(accountList);

            ShowTitle("ATM Program");
            do
            {
                DisplayMenu(mainMenu);
                mainMenuSelection = UserChoice($"Please select an option [1-{mainMenu.Count}]", $"That is not a valid option", mainMenu.Count);
                switch (mainMenuSelection)
                {
                case 1:         // Register
                    ATM.Register(accountList);
                    break;

                case 2:         // Login
                    loginStatus = ATM.Login(loginStatus, accountList);
                    if (loginStatus != -1)
                    {
                        LoggedInOptions(loginStatus, accountList);
                    }
                    loginStatus = -1;
                    break;

                default:
                    break;
                }
            }while (loginStatus == -1);
        }
Ejemplo n.º 34
0
        ///////////////////////////////////////////////DESCARGAS COMPLETAS /////////////////////////////////////////////////////////

        /// <summary>
        /// Obtener una lista de las descargas pendientes.
        /// </summary>
        /// <returns>Lista de descargas no descargadas</returns>
        public BindingList <DescargaATM> listarDescargasATMsPendientesCompletas()
        {
            BindingList <DescargaATM> descargas = new BindingList <DescargaATM>();
            SqlCommand    comando    = _manejador.obtenerProcedimiento("SelectCargasATMsNoDescargadasCompletas");
            SqlDataReader datareader = null;

            try
            {
                datareader = _manejador.ejecutarConsultaDatos(comando);

                while (datareader.Read())
                {
                    int           id_carga         = (int)datareader["ID_Carga"];
                    DateTime      fecha_asignada   = (DateTime)datareader["Fecha_Asignada"];
                    TiposCartucho tipo             = (TiposCartucho)datareader["Tipo"];
                    bool          atm_full         = (bool)datareader["ATM_Full"];
                    bool          cartucho_rechazo = (bool)datareader["Cartucho_Rechazo"];
                    bool          ena = (bool)datareader["ENA"];

                    short  id_atm     = (short)datareader["ID_ATM"];
                    short  numero     = (short)datareader["Numero"];
                    string codigo_atm = (string)datareader["Codigo"];
                    string oficinas   = (string)datareader["Oficinas"];

                    ATM      atm   = new ATM(id: id_atm, numero: numero, codigo: codigo_atm, oficinas: oficinas);
                    CargaATM carga = new CargaATM(atm, id: id_carga, fecha_asignada: fecha_asignada, tipo: tipo,
                                                  atm_full: atm_full, cartucho_rechazo: cartucho_rechazo, ena: ena);

                    DescargaATM descarga = new DescargaATM(carga: carga);

                    descargas.Add(descarga);
                }

                comando.Connection.Close();
            }
            catch (Exception)
            {
                comando.Connection.Close();
                throw new Excepcion("ErrorDatosConexion");
            }

            return(descargas);
        }
Ejemplo n.º 35
0
    public void SeedData()
    {
        var atms = context.ATMs;

        if (atms.Count() > 0)
        {
            return;
        }

        var atm1 = new ATM {
            Title = "Honey Badger Pender St",
            Lat   = 49.2831122f,
            Long  = -123.1231192f
        };

        atms.Add(atm1);

        var atm2 = new ATM {
            Title = "BitNational Waves Coffee",
            Lat   = 49.2793048f,
            Long  = -123.1136826f
        };

        atms.Add(atm2);

        var atm3 = new ATM {
            Title = "Honey Badger West Georgia",
            Lat   = 49.2817575f,
            Long  = -123.1227369f
        };

        atms.Add(atm3);

        var atm4 = new ATM {
            Title = "ConnectedCoin Robson",
            Lat   = 49.2838037f,
            Long  = -123.1299892f
        };

        atms.Add(atm4);

        context.SaveChanges();
    }
Ejemplo n.º 36
0
 public virtual int FillBySecurerInfo(ATM.CustomerDataTable dataTable, string UserId, System.Nullable<int> Pin) {
     this.Adapter.SelectCommand = this.CommandCollection[1];
     if ((UserId == null)) {
         this.Adapter.SelectCommand.Parameters[0].Value = System.DBNull.Value;
     }
     else {
         this.Adapter.SelectCommand.Parameters[0].Value = ((string)(UserId));
     }
     if ((Pin.HasValue == true)) {
         this.Adapter.SelectCommand.Parameters[1].Value = ((int)(Pin.Value));
     }
     else {
         this.Adapter.SelectCommand.Parameters[1].Value = System.DBNull.Value;
     }
     if ((this.ClearBeforeFill == true)) {
         dataTable.Clear();
     }
     int returnValue = this.Adapter.Fill(dataTable);
     return returnValue;
 }
Ejemplo n.º 37
0
 public void Sacar_80_Negativo_Retorna_Uma_Exception()
 {
     var atm = new ATM();
     var resultado = atm.sacar(-80);
 }
Ejemplo n.º 38
0
 public virtual int Update(ATM.CustomerDataTable dataTable) {
     return this.Adapter.Update(dataTable);
 }
Ejemplo n.º 39
0
 public void Sacar_8_Retorna_Uma_Exception()
 {
     var atm = new ATM();
     var resultado = atm.sacar(35);
 }
Ejemplo n.º 40
0
    // Code that runs on entering the state.
    public override void OnEnter()
    {
        atm = Owner.GetComponent<ATM>();

        currentTime = delayTime + Random.Range(0.0f,randomlyTime);
    }
Ejemplo n.º 41
0
 public virtual int Update(ATM dataSet) {
     return this.Adapter.Update(dataSet, "Customer");
 }
Ejemplo n.º 42
0
 public virtual int FillTransactions(ATM.TransactionDataTable dataTable) {
     this.Adapter.SelectCommand = this.CommandCollection[0];
     if ((this.ClearBeforeFill == true)) {
         dataTable.Clear();
     }
     int returnValue = this.Adapter.Fill(dataTable);
     return returnValue;
 }
Ejemplo n.º 43
0
Archivo: Program.cs Proyecto: GAlex7/TA
        public static void Main()
        {
            var atm = new ATM();

            atm.Start();
        }
Ejemplo n.º 44
0
 public virtual int Update(ATM.TransactionDataTable dataTable) {
     return this.Adapter.Update(dataTable);
 }
Ejemplo n.º 45
0
 public virtual int Update(ATM dataSet) {
     return this.Adapter.Update(dataSet, "Transaction");
 }
Ejemplo n.º 46
0
 public virtual int FillByAccountNumber(ATM.AccountDataTable dataTable, int AccountNumber) {
     this.Adapter.SelectCommand = this.CommandCollection[1];
     this.Adapter.SelectCommand.Parameters[0].Value = ((int)(AccountNumber));
     if ((this.ClearBeforeFill == true)) {
         dataTable.Clear();
     }
     int returnValue = this.Adapter.Fill(dataTable);
     return returnValue;
 }
Ejemplo n.º 47
0
 public virtual int Update(ATM.AccountDataTable dataTable) {
     return this.Adapter.Update(dataTable);
 }
Ejemplo n.º 48
0
 // this constructor will be used by the other one
 public NoCashState(int amountRemaining, ATM atmBeingUsed)
 {
     this.ATM = atmBeingUsed;
     this.DummyCashPresent = amountRemaining;
 }
Ejemplo n.º 49
0
 public virtual int FillByCustomerNumber(ATM.AccountDataTable dataTable, System.Nullable<int> CustomerNumber) {
     this.Adapter.SelectCommand = this.CommandCollection[0];
     if ((CustomerNumber.HasValue == true)) {
         this.Adapter.SelectCommand.Parameters[0].Value = ((int)(CustomerNumber.Value));
     }
     else {
         this.Adapter.SelectCommand.Parameters[0].Value = System.DBNull.Value;
     }
     if ((this.ClearBeforeFill == true)) {
         dataTable.Clear();
     }
     int returnValue = this.Adapter.Fill(dataTable);
     return returnValue;
 }
Ejemplo n.º 50
0
 // this constructor will be used by the other one
 public CardValidatedState(int amountRemaining, ATM atmBeingUsed)
 {
     this.ATM = atmBeingUsed;
     this.DummyCashPresent = amountRemaining;
 }
Ejemplo n.º 51
0
 // Main method is the application's entry point
 public static void Main( string[] args )
 {
     ATM theATM = new ATM();
       theATM.Run();
 }
Ejemplo n.º 52
0
 public void Sacar_50_Retorna_Uma_Nota_De_50()
 {
     var atm = new ATM();
     var resultado = atm.sacar(50);
     Assert.AreEqual(1, resultado.Quantidade_Da_Nota(50));
 }
Ejemplo n.º 53
0
 public virtual int Update(ATM dataSet) {
     return this.Adapter.Update(dataSet, "Account");
 }