Ejemplo n.º 1
0
        //Comprar boletos
        public void BuyTickets(List <Movie> movies, List <Employee> empl, ExhibitionRoom er)
        {
            int id, pass = 0, index = 0;
            int opt = 0;

            Console.Clear();
            Console.WriteLine("        KODIMAX - Comprar boletos");
            //Verificar que el codigo sea correcto
            do
            {
                Console.Write("\nIngrese el Id de la pelicula que desea ver: ");
                id = int.Parse(Console.ReadLine());
                for (int i = 0; i < movies.Count; i++)
                {
                    if (id == movies[i].Id)
                    {
                        index = i;
                        pass  = 1;
                        break;
                    }
                    else
                    {
                        pass = 0;
                    }
                }
                if (pass == 0)
                {
                    Console.WriteLine("\nEl id es incorrecto, ingeselo de nuevo");
                }
            }while(pass == 0);
            //Poner los datos de la pelicula
            movieName = movies[index].Name;
            Console.WriteLine("\n---------------------------------------------");
            Console.WriteLine("\n    {0}\n", movies[index].Name);
            Console.WriteLine("Id: {0}", movies[index].Id);
            Console.WriteLine("Duracion: {0}", movies[index].Duration);
            Console.WriteLine("Tipo de pelicula: {0}\n", movies[index].Type);
            Console.WriteLine("---------------------------------------------\n");
            //Pedir los datos
            Console.WriteLine("Elija la sala de exhibicion (digite el numero)\n");
            Console.WriteLine("1.{0} - $3.55", er.nStan);
            Console.WriteLine("2.{0} - $4.75", er.nPrem);
            Console.WriteLine("3.{0} - $6.50\n", er.nVip);
            opt = int.Parse(Console.ReadLine());
            if (opt == 1)
            {
                exhibRoom   = er.nStan;
                ticketPrice = pStan;
                available   = er.saStan;
            }
            else if (opt == 2)
            {
                exhibRoom   = er.nPrem;
                ticketPrice = pPrem;
                available   = er.saPrem;
            }
            else if (opt == 3)
            {
                exhibRoom   = er.nVip;
                ticketPrice = pVip;
                available   = er.saVip;
            }
            //Compra de boletos
            do
            {
                Console.Write("\nIngrese la cantidad de boletos que comprara: ");
                tickAmount = int.Parse(Console.ReadLine());
                if (tickAmount > available)
                {
                    Console.WriteLine("\nSolo hay {0} espacios disponibles", available);
                    Console.WriteLine("Ingrese una cantidad menor o igual a esa");
                    pass = 0;
                }
                else
                {
                    if (opt == 1)
                    {
                        er.saStan -= tickAmount;
                    }
                    else if (opt == 2)
                    {
                        er.saPrem -= tickAmount;
                    }
                    else if (opt == 3)
                    {
                        er.saVip -= tickAmount;
                    }
                    pass = 1;
                }
            }while(pass == 0);
            //Calcular el total
            if (opt == 1)
            {
                movieTotal = tickAmount * ticketPrice;
            }
            else if (opt == 2)
            {
                movieTotal = tickAmount * ticketPrice;
            }
            else if (opt == 3)
            {
                movieTotal = tickAmount * ticketPrice;
            }

            movieDisc       = movieTotal * 0.3533m;
            movieFinalTotal = movieTotal + movieDisc;
            //Pagar
            Payment(movieFinalTotal);
            //Mostrar el ticket
            TicketsBill(empl);
        }
Ejemplo n.º 2
0
        public static void Main()
        {
            int    pass = 0, opt, regis, optmenu;
            int    again = 1, exit, modify;
            string user, password;
            char   selectRep;
            int    count = 3, count2 = 5;

            //Instancias de clases
            Admin          admin  = new Admin("admin-max", "@dminM@x");
            People         p      = new People();
            Client         client = new Client();
            Employee       empl   = new Employee();
            ExhibitionRoom er     = new ExhibitionRoom();
            Reports        reps   = new Reports();
            Branch         bran   = new Branch();

            //Lista de Clientes
            List <People> clients = new List <People>();

            clients.Add(new People("David", "Mendoza", "*****@*****.**", "87654321", 'M', "19/06/01", "david", "9182"));
            clients.Add(new People("Carmen", "Morales", "*****@*****.**", "78494999", 'F', "31/09/99", "carmen", "0192"));
            clients.Add(new People("Eduardo", "Guevara", "*****@*****.**", "83839396", 'M', "12/03/99", "eduardo", "8374"));
            //Lista de empledos
            List <Employee> employees = new List <Employee>();

            employees.Add(new Employee(1, "Angel", "Servellon", "*****@*****.**", "12345678", 'M', "19/06/01", "angel", "1234"));
            employees.Add(new Employee(2, "Kevin", "Gutierrez", "*****@*****.**", "91234567", 'M', "14/01/01", "kevin", "5678"));
            employees.Add(new Employee(3, "Jennifer", "Beltran", "*****@*****.**", "89123456", 'F', "23/10/01", "jenny", "9123"));
            //Lista de peliculas
            List <Movie> movies = new List <Movie>();

            movies.Add(new Movie(1, "Mulan", "2h", "Accion/Aventura"));
            movies.Add(new Movie(2, "Aladdin", "2h 8m", "Aventura/Infantil"));
            movies.Add(new Movie(3, "Detective pikachu", "1h 45m", "Infantil/Misterio"));
            movies.Add(new Movie(4, "Shazam", "2h 12m", "Accion/Comedia"));
            movies.Add(new Movie(5, "Joker", "2h 2m", "Crimen/Drama"));
            //Lista de dulces
            List <Candy> candies = new List <Candy>();

            candies.Add(new Candy(1, "Snickers", "Chocolate", 3.25m));
            candies.Add(new Candy(2, "Ositos de goma", "Gomitas", 2.90m));
            candies.Add(new Candy(3, "M&M's", "Chocolate", 3.85m));
            candies.Add(new Candy(4, "Mentas", "Dulce", 1.25m));
            candies.Add(new Candy(5, "Bon o Bon", "Chocolate", 0.75m));
            //Lista de sucursales
            List <Branch> branches = new List <Branch>();

            branches.Add(new Branch(1, "Soyapango", 5.25m));
            branches.Add(new Branch(2, "San Salvador", 6.00m));
            branches.Add(new Branch(3, "Santa Tecla", 5.45m));
            branches.Add(new Branch(4, "Ciudad Delgado", 5.90m));
            branches.Add(new Branch(5, "Merliot", 6.15m));
            //Lista de ventas por sucursal
            List <Sales> sales = new List <Sales>();

            do
            {
                exit = 0;
                //Login
                do
                {
                    Console.Clear();
                    Console.WriteLine("            KODIMAX\n");
                    Console.WriteLine("Elija el tipo de usuario al que \npertenece(digite el numero): ");
                    Console.WriteLine("\n1.Cliente\n2.Empleado\n3.Administrador\n");
                    Console.WriteLine("Si no desea ingresar digite 4.\n");
                    opt = int.Parse(Console.ReadLine());
                    //No ingresar
                    if (opt == 4)
                    {
                        break;
                    }
                    Console.Clear();

                    Console.WriteLine("            KODIMAX\n");
                    Console.Write("Usuario: ");
                    user = Console.ReadLine();
                    Console.Write("Contraseña: ");
                    password = Console.ReadLine();
                    switch (opt)
                    {
                    case 1:
                        foreach (People c in clients)
                        {
                            if (user == c.User && password == c.Password)
                            {
                                pass = 1;
                                break;
                            }
                            else
                            {
                                pass = 0;
                            }
                        }
                        break;

                    case 2:
                        foreach (Employee e in employees)
                        {
                            if (user == e.User && password == e.Password)
                            {
                                pass = 1;
                                break;
                            }
                            else
                            {
                                pass = 0;
                            }
                        }
                        break;

                    case 3:
                        if (user == admin.User && password == admin.Password)
                        {
                            pass = 1;
                            break;
                        }
                        else
                        {
                            pass = 0;
                        }
                        break;
                    }
                    if (pass == 0)
                    {
                        if (opt == 1 || opt == 2)
                        {
                            Console.WriteLine("\nEl usuario no esta registrado en Clientes");
                            Console.Write("Desea registrarse(digite el numero) ? \n1.Si\n2.No\n\n");
                            regis = int.Parse(Console.ReadLine());
                            if (regis == 1)
                            {
                                count++;
                                p.Register(clients, employees, count);
                            }
                        }
                        if (opt == 3)
                        {
                            Console.WriteLine("\nUsted no es el administrador");
                            Console.ReadKey();
                        }
                    }
                } while (pass == 0);
                //No ingresar
                if (opt == 4)
                {
                    break;
                }
                //Entrar al sistema
                do
                {
                    if (pass == 1)
                    {
                        Console.Clear();
                        switch (opt)
                        {
                        case 1:    //Cliente
                            Console.WriteLine("              KODIMAX - Cliente\n");
                            Console.WriteLine("Bienvenido, elija una de las opciones(digite el numero)\n");
                            Console.WriteLine("1.Ver cartelera\n2.Ver tienda de golosinas");
                            Console.WriteLine("3.Comprar boletos\n4.Comprar golosinas");
                            Console.WriteLine("5.Ver sucursales\n6.Cerrar sesion\n");
                            optmenu = int.Parse(Console.ReadLine());
                            switch (optmenu)
                            {
                            case 1:
                                client.SeeMovies(movies);
                                break;

                            case 2:
                                client.SeeCandiesShop(candies);
                                break;

                            case 3:
                                client.BuyTickets(movies, employees, er, branches, sales);
                                break;

                            case 4:
                                client.BuyCandies(candies, employees);
                                break;

                            case 5:
                                client.SeeBranches(branches);
                                break;

                            case 6:
                                exit = 1;
                                break;
                            }
                            break;

                        case 2:    //Empleado
                            Console.WriteLine("       KODIMAX - Empleado\n");
                            Console.WriteLine("Bienvenido, elija una de las opciones(digite el numero)\n");
                            Console.WriteLine("1.Modificar cartelera\n2.Modificar tienda de golosinas");
                            Console.WriteLine("3.Modificar sucursales\n4.Cerrar sesion\n");
                            optmenu = int.Parse(Console.ReadLine());
                            switch (optmenu)
                            {
                            case 1:
                                Console.Clear();
                                Console.WriteLine("     KODIMAX - Modificar cartelera\n");
                                Console.WriteLine("Digite el numero: \n\n1.Agregar pelicula\n2.Eliminar pelicula");
                                Console.WriteLine("3.Modificar sala de exhibicion\n4.Salir\n");
                                modify = int.Parse(Console.ReadLine());
                                switch (modify)
                                {
                                case 1:
                                    empl.AddMovie(movies);
                                    break;

                                case 2:
                                    empl.DeleteMovie(movies);
                                    break;

                                case 3:
                                    er.ModifyExibitRooms();
                                    break;

                                case 4:
                                    break;
                                }
                                break;

                            case 2:
                                Console.Clear();
                                Console.WriteLine(" KODIMAX - Modificar tienda de golosinas\n");
                                Console.WriteLine("Digite el numero: \n\n1.Agregar golosina\n2.Eliminar golosina");
                                Console.WriteLine("3.Modificar precio y/o tipo\n4.Salir\n");
                                modify = int.Parse(Console.ReadLine());
                                switch (modify)
                                {
                                case 1:
                                    empl.AddCandy(candies);
                                    break;

                                case 2:
                                    empl.DeleteCandy(candies);
                                    break;

                                case 3:
                                    empl.ModifyCandies(candies);
                                    break;

                                case 4:
                                    break;
                                }
                                break;

                            case 3:
                                Console.Clear();
                                Console.WriteLine("     KODIMAX - Modificar sucursales\n");
                                Console.WriteLine("Digite el numero: \n\n1.Agregar sucursal\n2.Modificar sucursal\n3.Salir\n");
                                modify = int.Parse(Console.ReadLine());
                                switch (modify)
                                {
                                case 1:
                                    count2++;
                                    bran.AddBranch(branches, count2);
                                    break;

                                case 2:
                                    bran.ModifyBranch(branches);
                                    break;

                                case 3:
                                    break;
                                }
                                break;

                            case 4:
                                exit = 1;
                                break;
                            }
                            break;

                        case 3:    //Administrador
                            Console.WriteLine("     KODIMAX - Administrador\n");
                            Console.WriteLine("Bienvenido, elija una de las opciones(digite el numero)\n");
                            Console.WriteLine("1.Crear o eliminar empleados\n2.Eliminar usuarios");
                            Console.WriteLine("3.Modificar cartelera\n4.Modificar tienda de golosinas");
                            Console.WriteLine("5.Modificar sucursales\n6.Reportes");
                            Console.WriteLine("7.Cerrar sesion\n");
                            optmenu = int.Parse(Console.ReadLine());
                            switch (optmenu)
                            {
                            case 1:
                                Console.Clear();
                                Console.WriteLine("   KODIMAX - Crear o eliminar empleados\n");
                                Console.WriteLine("Digite el numero: \n\n1.Agregar empleado\n2.Eliminar empleado\n3.Salir\n");
                                modify = int.Parse(Console.ReadLine());
                                switch (modify)
                                {
                                case 1:
                                    count++;
                                    admin.RegisterEmployee(employees, count);
                                    break;

                                case 2:
                                    admin.DeleteEmployee(employees);
                                    break;

                                case 3:
                                    break;
                                }
                                break;

                            case 2:
                                admin.DeleteClient(clients);
                                break;

                            case 3:
                                Console.Clear();
                                Console.WriteLine("  KODIMAX - Modificar cartelera\n");
                                Console.WriteLine("Digite el numero: \n\n1.Agregar pelicula\n2.Eliminar pelicula");
                                Console.WriteLine("3.Modificar sala de exhibicion\n4.Salir\n");
                                modify = int.Parse(Console.ReadLine());
                                switch (modify)
                                {
                                case 1:
                                    admin.AddMovie(movies);
                                    break;

                                case 2:
                                    admin.DeleteMovie(movies);
                                    break;

                                case 3:
                                    er.ModifyExibitRooms();
                                    break;

                                case 4:
                                    break;
                                }
                                break;

                            case 4:
                                Console.Clear();
                                Console.WriteLine(" KODIMAX - Modificar tienda de golosinas\n");
                                Console.WriteLine("Digite el numero: \n\n1.Agregar golosina\n2.Eliminar golosina");
                                Console.WriteLine("3.Modificar precio y/o tipo\n4.Salir\n");
                                modify = int.Parse(Console.ReadLine());
                                switch (modify)
                                {
                                case 1:
                                    admin.AddCandy(candies);
                                    break;

                                case 2:
                                    admin.DeleteCandy(candies);
                                    break;

                                case 3:
                                    admin.ModifyCandies(candies);
                                    break;

                                case 4:
                                    break;
                                }
                                break;

                            case 5:
                                Console.Clear();
                                Console.WriteLine("     KODIMAX - Modificar sucursales\n");
                                Console.WriteLine("Digite el numero: \n\n1.Agregar sucursal\n2.Modificar sucursal\n3.Salir\n");
                                modify = int.Parse(Console.ReadLine());
                                switch (modify)
                                {
                                case 1:
                                    count2++;
                                    bran.AddBranch(branches, count2);
                                    break;

                                case 2:
                                    bran.ModifyBranch(branches);
                                    break;

                                case 3:
                                    break;
                                }
                                break;

                            case 6:
                                Console.Clear();
                                Console.WriteLine("\tKODIMAX - Reportes\n");
                                Console.WriteLine("Digite la letra: \n\nU - Lista de todos los usuarios");
                                Console.WriteLine("C - Lista de peliculas\nG - Lista de golosinas");
                                Console.WriteLine("V - Lista de ventas por sucursal\n");
                                selectRep = char.Parse(Console.ReadLine());
                                switch (selectRep)
                                {
                                case 'u':
                                case 'U':
                                    reps.UsersReport(clients, employees);
                                    break;

                                case 'C':
                                case 'c':
                                    reps.MoviesReport(movies);
                                    break;

                                case 'G':
                                case 'g':
                                    reps.CandiesReport(candies);
                                    break;

                                case 'V':
                                case 'v':
                                    reps.SalesReport(sales);
                                    break;
                                }
                                break;

                            case 7:
                                exit = 1;
                                break;
                            }
                            break;
                        }
                        if (exit == 1)
                        {
                            break;
                        }
                        Console.Write("\nPresione enter...");
                        Console.ReadKey();
                    }
                } while (again == 1);
            } while (exit == 1);
        }
Ejemplo n.º 3
0
        //Comprar boletos
        public void BuyTickets(List <Movie> movies, List <Employee> empl, ExhibitionRoom er, List <Branch> branches, List <Sales> sales)
        {
            int id, pass = 0, index = 0;
            int opt = 0;

            Console.Clear();
            Console.WriteLine("        KODIMAX - Comprar boletos");
            //Mostrar info de la pelicula
            ShowMovieData(movies);
            //Escoger la sucursal
            do
            {
                Console.Write("\nIngrese el Id de la sucursal donde vera la pelicula: ");
                id = int.Parse(Console.ReadLine());
                for (int i = 0; i < branches.Count; i++)
                {
                    if (id == branches[i].Id)
                    {
                        Console.WriteLine("\nSucursal: {0}", branches[i].Name);
                        index = i;
                        pass  = 1;
                        break;
                    }
                    else
                    {
                        pass = 0;
                    }
                }
                if (pass == 0)
                {
                    Console.WriteLine("\nEl id es incorrecto, ingeselo de nuevo");
                }
            } while (pass == 0);
            branch = branches[index].Name;
            //Pedir la modalidad
            Console.WriteLine("\nElija la modalidad en que vera la pelicula (digite el numero):");
            Console.WriteLine("\n1.Sala de cine\n2.Autocine\n");
            type = int.Parse(Console.ReadLine());
            if (type == 1)
            {
                //Pedir los datos
                Console.WriteLine("\nElija la sala de exhibicion (digite el numero)\n");
                Console.WriteLine("1.{0} - $3.55", er.nStan);
                Console.WriteLine("2.{0} - $4.75", er.nPrem);
                Console.WriteLine("3.{0} - $6.50\n", er.nVip);
                opt = int.Parse(Console.ReadLine());
                if (opt == 1)
                {
                    exhibRoom   = er.nStan;
                    ticketPrice = pStan;
                    available   = er.saStan;
                }
                else if (opt == 2)
                {
                    exhibRoom   = er.nPrem;
                    ticketPrice = pPrem;
                    available   = er.saPrem;
                }
                else if (opt == 3)
                {
                    exhibRoom   = er.nVip;
                    ticketPrice = pVip;
                    available   = er.saVip;
                }
                //Compra de boletos en sala de cine
                do
                {
                    Console.Write("\nIngrese la cantidad de boletos que comprara: ");
                    tickAmount = int.Parse(Console.ReadLine());
                    if (tickAmount > available)
                    {
                        Console.WriteLine("\nSolo hay {0} espacios disponibles", available);
                        Console.WriteLine("Ingrese una cantidad menor o igual a esa");
                        pass = 0;
                    }
                    else
                    {
                        if (opt == 1)
                        {
                            er.saStan -= tickAmount;
                        }
                        else if (opt == 2)
                        {
                            er.saPrem -= tickAmount;
                        }
                        else if (opt == 3)
                        {
                            er.saVip -= tickAmount;
                        }
                        pass = 1;
                    }
                } while (pass == 0);
            }
            else if (type == 2)
            {
                //Compra de boletos en autocine
                Console.WriteLine("\nPrecio por persona: ${0}", branches[index].Price);
                ticketPrice = branches[index].Price;
                Console.Write("\nIngrese la cantidad de boletos que comprara: ");
                tickAmount = int.Parse(Console.ReadLine());
            }
            //Calcular el total
            movieTotal = tickAmount * ticketPrice;
            movieDisc  = movieTotal * 0.3533m;
            if (type == 1)
            {
                movieFinalTotal = movieTotal + movieDisc;           //Total para salas de cine
            }
            else if (type == 2)
            {
                movieFinalTotal = movieTotal + movieDisc + parking;               //Total para autocine
            }
            //Pagar
            Payment(movieFinalTotal);
            //Mostrar el ticket
            TicketsBill(empl, branches, sales);
        }