예제 #1
0
        public static void Main(string[] args)
        {
            // Mi central
            Centralita c = new Centralita("Fede Center");
            // Mis 4 llamadas
            Local      l1 = new Local("Bernal", 30, "Rosario", 2.65f);
            Provincial l2 = new Provincial("Morón", Provincial.Franja.Franja_1, 21, "Bernal");
            Local      l3 = new Local("Lanús", 45, "San Rafael", 1.99f);
            Provincial l4 = new Provincial(Provincial.Franja.Franja_3, l2);

            // Las llamadas se irán registrando en la Centralita.
            // La centralita mostrará por pantalla todas las llamadas según las vaya registrando.
            c += l1;
            Console.WriteLine(c.ToString());
            c += l2;
            c.OrdenarLlamadas();
            Console.WriteLine(c.ToString());
            c += l3;
            c.OrdenarLlamadas();
            Console.WriteLine(c.ToString());
            c += l4;
            c.OrdenarLlamadas();
            Console.WriteLine(c.ToString());
            Console.ReadKey();
        }
예제 #2
0
        static void Main(string[] args)
        {
            // Mi central
            Centralita c = new Centralita("Fede Center");
            // Mis 4 llamadas
            Local      l1 = new Local("Bernal", 30, "Rosario", 2.65f);
            Provincial l2 = new Provincial("Morón", Provincial.Franja.Franja_1, 21, "Bernal");
            Local      l3 = new Local("Lanús", 45, "San Rafael", 1.99f);
            Provincial l4 = new Provincial(Provincial.Franja.Franja_3, l2);

            // Las llamadas se irán registrando en la Centralita.
            // La centralita mostrará por pantalla todas las llamadas según las vaya registrando.
            try
            {
                c += l1;
                c += l2;
                c += l3;
                c += l4;
                Console.WriteLine(c.ToString());
            }
            catch (CentralitaException ce)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Ocurrio un error de centralita " + ce.Message);
                Console.ForegroundColor = ConsoleColor.White;
            }
            catch (Exception e)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("ocurrio un error desconocido " + e.Message);
                Console.ForegroundColor = ConsoleColor.White;
            }
            c.OrdenarLlamadas();
            Console.WriteLine(c.ToString());
            Console.ReadKey();
예제 #3
0
파일: Program.cs 프로젝트: xTomluca/ProLab2
        static void Main(string[] args)
        {
            // Mi central
            Centralita c = new Centralita("Fede Center");
            // Mis 4 llamadas
            Local      l1 = new Local("Bernal", 30, "Rosario", 2.65f);
            Provincial l2 = new Provincial("Morón", Provincial.Franja.Franja_1, 21, "Bernal");
            Local      l3 = new Local("Lanús", 45, "San Rafael", 1.99f);
            Provincial l4 = new Provincial(Provincial.Franja.Franja_3, l2);

            // Las llamadas se irán registrando en la Centralita.
            // La centralita mostrará por pantalla todas las llamadas según las vaya registrando.
            try
            {
                c += l1;
                c += l2;
                c += l3;
                c += l4;
            }
            catch (CentralitaExcepcion e)
            {
                Console.WriteLine("{0} - {1} - {2}", e.Message, e.NombreClase, e.NombreMetodo);
            }
            c.OrdenarLlamadas();
            Console.WriteLine(c.ToString());
            Console.ReadKey();
        }
예제 #4
0
        static void Main(string[] args)
        {
            // Mi central
            Centralita c = new Centralita("Fede Center");
            // Mis 4 llamadas
            Local      l1 = new Local("Bernal", 30, "Rosario", 2.65f);
            Provincial l2 = new Provincial("Morón", Provincial.Franja.Franja_1, 21, "Bernal");
            Local      l3 = new Local("Lanús", 45, "San Rafael", 1.99f);
            Provincial l4 = new Provincial(Provincial.Franja.Franja_3, l2);

            // Las llamadas se irán registrando en la Centralita.
            // La centralita mostrará por pantalla todas las llamadas según las vaya registrando.
            c += l1;
            c += l2;

            //c.OrdenarLlamadas();
            Console.WriteLine(c.ToString());

            //Excepciones, try, catch
            Console.ReadKey();
            Console.WriteLine("Cargo con exito las llamadas. Tenes mensajes amigables?");
            Console.ReadKey();
            try
            {
                c += l3;
            }
            catch (CentralitaException mensaje)
            {
                Console.WriteLine(mensaje);
            }
            finally
            {
                Console.ReadKey();
            }

            try
            {
                c += l4;
            }
            catch (CentralitaException mensaje)
            {
                Console.WriteLine(mensaje);
            }
            finally
            {
                Console.ReadKey();
            }
        }
예제 #5
0
        static void Main(string[] args)
        {
            Centralita central1 = new Centralita("Telefonica");

            Local      l1 = new Local("4512-4578", "7845-4512", 0.3f, 2.65f);
            Provincial l2 = new Provincial("4578-8956", Franja.Franja_1, 0.2f, "7845-4512");
            Local      l3 = new Local("7845-7845", "7845-4512", 0.45f, 1.99f);
            Provincial l4 = new Provincial(Franja.Franja_3, l2);

            central1 += l1;
            central1 += l2;
            central1 += l3;
            central1 += l4;
            Console.WriteLine(central1.ToString());

            Console.ReadLine();
        }
예제 #6
0
        static void Main(string[] args)
        {
            Centralita c = new Centralita("Fede Center");

            Local      l1 = new Local("Bernal", 30, "Rosario", 2.65f);
            Provincial l2 = new Provincial("Morón", Franja.Franja_1, 21, "Bernal");
            Local      l3 = new Local("Lanús", 45, "San Rafael", 1.99f);
            Provincial l4 = new Provincial(Franja.Franja_3, l2);

            c += l1;
            c += l2;
            c += l3;
            c += l4;

            Console.WriteLine(c.ToString());

            Console.ReadKey();
        }
예제 #7
0
        static void Main(string[] args)
        {
            // Mi central
            Centralita c = new Centralita("Fede Center");
            // Mis 4 llamadas
            Local      l1 = new Local("Bernal", 30, "Rosario", 2.65f);
            Provincial l2 = new Provincial("Morón", Provincial.Franja.Franja_1, 21, "Bernal");
            Local      l3 = new Local("Lanús", 45, "San Rafael", 1.99f);
            Provincial l4 = new Provincial(Provincial.Franja.Franja_3, l2);

            // Las llamadas se irán registrando en la Centralita.
            c = c + l1;
            c = c + l2;
            c = c + l3;
            c = c + l4;
            Console.WriteLine("\t\t LLAMADAS ORDENADAS\n\n");
            c.OrdenarLlamadas();
            Console.WriteLine(c.ToString());
            Console.ReadKey();
        }
예제 #8
0
        static void Main(string[] args)
        {
            // Mi central
            Centralita c = new Centralita("Cin Center");
            // Mis 4 llamadas
            Local      l1 = new Local("Bernal", 30, "Rosario", 2.65f);
            Provincial l2 = new Provincial(Provincial.Franja.Franja_1, "Morón", 21, "Bernal");
            Local      l3 = new Local("Lanús", 45, "San Rafael", 1.99f);
            Provincial l4 = new Provincial(Provincial.Franja.Franja_3, "Avellaneda", 12, "Quilmes");
            Llamada    l5 = new Provincial(Provincial.Franja.Franja_3, "Avellaneda", 12, "Quilmes");

            // Las llamadas se irán registrando en la Centralita.
            // La centralita mostrará por pantalla todas las llamadas según las vaya registrando.
            try
            {
                c += l1;
                c += l2;
                c += l3;
                c += l4;
                c += l5;
                c.OrdenarLlamadas();
                Console.WriteLine(c.ToString());
            }
            catch (CentralitaException e)
            {
                Console.WriteLine(e.Message);
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
            Console.ReadKey();


            // object objeto = new object();
        }
예제 #9
0
        static void Main(string[] args)
        {
            Centralita central = new Centralita("Telefonica");
            Local      l1      = new Local("Avellaneda", 50, "Lanus", 2.65F);
            Provincial l2      = new Provincial("Buenos Aires", Franja.Franja_1, 40, "Cordoba");
            Local      l3      = new Local("Barracas", 30, "Palermo", 1.99F);
            Provincial l4      = new Provincial(Franja.Franja_3, l2);

            if (central + l1)
            {
                Console.WriteLine("Se agrego la llamada");
            }
            else
            {
                Console.WriteLine("No se pudo agregar la llamada");
            }
            Console.WriteLine(central.ToString());

            if (central + l2)
            {
                Console.WriteLine("Se agrego la llamada");
            }
            else
            {
                Console.WriteLine("No se pudo agregar la llamada");
            }
            Console.WriteLine(central.ToString());

            if (central + l3)
            {
                Console.WriteLine("Se agrego la llamada");
            }
            else
            {
                Console.WriteLine("No se pudo agregar la llamada");
            }
            Console.WriteLine(central.ToString());

            if (central + l4)
            {
                Console.WriteLine("Se agrego la llamada");
            }
            else
            {
                Console.WriteLine("No se pudo agregar la llamada");
            }
            Console.WriteLine(central.ToString());

            if (central + l1)
            {
                Console.WriteLine("Se agrego la llamada");
            }
            else
            {
                Console.WriteLine("No se pudo agregar la llamada");
            }
            Console.WriteLine(central.ToString());

            central.OrdenarLLamdas();
            Console.WriteLine(central.ToString());

            Console.ReadKey();
        }