Exemple #1
0
        // MÉTODO QUE DEVUELVE UNA OPCIÓN DENTRO DEL TOPE INDICADO
        // @param - tope: la opción máxima posible en byte (no más de 255 opciones)
        // @return - byte: la opción elegida
        public static byte leerOpcion(byte tope)
        {
            byte   opcion = 0;
            bool   salir  = false;
            string aux    = null;

            do
            {
                Console.ForegroundColor = ConsoleColor.Cyan;
                Console.Write("?> OK... ¿QUÉ DESEAS HACER?: ");
                Console.ForegroundColor = ConsoleColor.Gray;
                aux = Console.ReadLine();
                if (byte.TryParse(aux, out opcion))
                {
                    if (opcion >= 0 && opcion <= tope)
                    {
                        salir = true;
                    }
                    else
                    {
                        Console.WriteLine("!> OPCIÓN FUERA DE RANGO [0-" + tope + "]");
                    }
                }
                else
                {
                    CH.lcdColor("!> ¿¡Perdona!?... ?@#!!", ConsoleColor.Red);
                }
            } while (!salir);
            return(opcion);
        }
Exemple #2
0
        // FUNCIÓN PARA LEER UN FLOTANTE O DECIMAL POR PANTALLA
        // @param - string: el mensaje a mostrar por pantalla
        // @return - float: el número introducido
        public static float leerFloat(string msg)
        {
            float  cantidad = 0.0F;
            bool   salir    = false;
            string aux      = null;

            do
            {
                Console.Write("?> " + msg + ": ");
                aux = Console.ReadLine();
                if (!(String.IsNullOrEmpty(aux)) && (Single.TryParse(aux, out cantidad)))
                {
                    if (cantidad <= 100 && cantidad >= 0)
                    {
                        salir = true;
                    }
                    else
                    {
                        CH.lcdColor("!> NO MAS DE 100% O MENOS QUE 0%!! ... @#!", ConsoleColor.Red);
                    }
                }
                else
                {
                    CH.lcdColor("!> Valor NO valido!! ... @#!", ConsoleColor.Red);
                }
            } while (!salir);
            return(cantidad);
        }
Exemple #3
0
        public static void menu_principal(string nombre)
        {
            string salida = "\n";

            CH.cls();
            Console.ForegroundColor = ConsoleColor.Cyan;
            //Console.BackgroundColor = ConsoleColor.Gray;
            salida += "+==============================+\n";
            salida += "|  MENU DE OPCIONES PRINCIPAL  |\n";
            salida += "|   - - - - - - - - - - - -    |\n";
            salida += "|        GESTBANK V 1.0        |\n";
            salida += "+==============================+\n";
            Console.WriteLine(salida);
            Console.ForegroundColor = ConsoleColor.White;
            //Console.BackgroundColor = ConsoleColor.Black;
            salida = "1. MÓDULO DE ADMINISTRACIÓN";
            CH.lcd(salida);
            salida = "--------------------------------";
            CH.lcdColor(salida, ConsoleColor.DarkGray);
            salida = "2. MÓDULO PARA CLIENTES";
            CH.lcd(salida);
            salida = "--------------------------------";
            CH.lcdColor(salida, ConsoleColor.DarkGray);
            salida  = "3. CARGAR DATOS MODO DEBUG\n";
            salida += "--------------------------------";
            CH.lcdColor(salida, ConsoleColor.DarkGray);
            salida = "\n0. SALIR\n\n";
            Console.Write(salida);
        }
Exemple #4
0
        // FUNCION PARA LEER UN DNI POR PANTALLA, CON VALIDACON POR REGEXP
        // @return - string: el documento a comprobar
        public static string leerDni()
        {
            bool    salir  = false;
            string  aux    = null;
            int     numero = 0;
            decimal dec    = 0;

            do
            {
                Console.Write("?> INTRODUCE UN DNI: ");
                aux = Console.ReadLine();
                if ((String.IsNullOrEmpty(aux)) || (decimal.TryParse(aux, out dec)))
                {
                    CH.lcdColor("!> ¿¡Perdona!?... ?@#!!", ConsoleColor.Red);
                }
                else
                {
                    if (esValidoCifNifNIE(aux))
                    {
                        salir = true;
                    }
                    else
                    {
                        CH.lcdColor("!> FORMATO DNI/NIF/CIF ERRONEO!!", ConsoleColor.Red);
                    }
                }
            } while (!salir);
            return(aux);
        }
        // FUNCIÓN QUE DEVUELTE EL INDICE DE UN CLIENTE LISTADO
        public static int pedirCliente(int tope, string msg)
        {
            int    opcion = 0;
            bool   salir  = false;
            string aux    = null;

            do
            {
                Console.Write("?> " + msg + ": ");
                aux = Console.ReadLine();
                if (Int32.TryParse(aux, out opcion))
                {
                    if (opcion > 0 && opcion <= tope)
                    {
                        salir = true;
                    }
                    else
                    {
                        Console.WriteLine("!> OPCIÓN FUERA DE RANGO [1-" + tope + "]");
                    }
                }
                else
                {
                    CH.lcdColor("!> ¿¡Perdona!?... ?@#!!", ConsoleColor.Red);
                }
            } while (!salir);
            return(opcion);
        }
        public static void listarEmpleadosIndice(Empleado[] empleados)
        {
            string cadena = "";
            int    indice = 1;

            CH.cls();
            cadena += "\nLISTADO DE EMPLEADOS GESTBANKV1\n";
            cadena += "===============================";
            CH.lcdColor(cadena, ConsoleColor.DarkBlue);
            cadena = "";
            if (empleados != null)
            {
                Console.ForegroundColor = ConsoleColor.Blue;
                Console.WriteLine("{0}{1}{2}{3}{4}", "ID".PadRight(5), "APELLIDOS".PadRight(20), "NOMBRE".PadRight(15), "D.N.I.  ".PadRight(10), "CARGO".PadRight(10));
                Console.ForegroundColor = ConsoleColor.White;

                foreach (Empleado empleado in empleados)
                {
                    //CH.lcd(empleado.ToString()); -- COMO COÑO LLEGO AL los datos del cliente heredado....!!
                    Console.WriteLine("{0}{1}{2}{3}{4}", indice.ToString() + ".".PadRight(4), empleado.cliente.apellidos.PadRight(20), empleado.cliente.nombre.PadRight(15), empleado.cliente.dni.PadRight(10), empleado.tipo_empleado.nombre.PadRight(10));
                    indice++;
                }
            }
            else
            {
                Console.WriteLine("LA BANKA TODAVÍA NO TIENE EMPLEADOS\n");
                CH.pausa();
            }
        }
Exemple #7
0
        // FUNCIÓN QUE DEVUELVE UN STRING (CUALQUIER COSA) QUE NO ESTE VACIO PEDIDO POR TECLADO
        // MOSTRANDO UN MENSAJE PERSONALIZADO POR PANTALLA
        // @param - string: un mensaje para mostrar por pantalla
        public static string leerCadena(string msg)
        {
            bool   salir = false;
            string aux   = null;

            do
            {
                Console.Write("?> " + msg + ": ");
                aux = Console.ReadLine();
                if ((String.IsNullOrEmpty(aux)))
                {
                    CH.lcdColor("!> ¿¡Perdona!?... ?@#!!", ConsoleColor.Red);
                }
                else
                {
                    salir = true;
                }
            } while (!salir);
            return(aux);
        }
Exemple #8
0
        // FUNCIÓN DE DEVUELVE UN STRING (NO NUMERO REAL) PEDIDO POR TECLADO
        // @param - string: el mensaje a mostrar
        // @return - string: el string introducido
        public static string leerString(string msg)
        {
            bool   salir  = false;
            string aux    = null;
            int    numero = 0;

            do
            {
                Console.Write("?> " + msg + ": ");
                aux = Console.ReadLine();
                if ((String.IsNullOrEmpty(aux)) || (Int32.TryParse(aux, out numero)))
                {
                    CH.lcdColor("!> ¿¡Perdona!?... ?@#!!", ConsoleColor.Red);
                }
                else
                {
                    salir = true;
                }
            } while (!salir);
            return(aux);
        }
Exemple #9
0
        public static string leerDni()
        {
            bool   salir  = false;
            string aux    = null;
            int    opcion = 0;

            do
            {
                Console.Write("?> DNI DEL CLIENTE...: ");
                aux = Console.ReadLine();
                if (!Int32.TryParse(aux, out opcion) && aux != "")
                {
                    salir = true;
                }
                else
                {
                    CH.lcdColor("!> ¿¡Perdona!?... ?@#!!", ConsoleColor.Red);
                }
            } while (!salir);
            return(aux);
        }