Ejemplo n.º 1
0
 public void ReservedRoomsCount(ref Simple Room101, ref Simple Room102, ref Simple Room103, ref Simple Room104, ref Simple Room105, ref Double Room106, ref Double Room107, ref Double Room108, ref Luxor Room109, ref Luxor Room110)
 {
     if (Room101.ReservationStatus)
     {
         ReservedRooms++;
         UnreservedRooms--;
         SimpleReserved++;
         SimpleUnreserved--;
     }
     if (Room102.ReservationStatus)
     {
         ReservedRooms++;
         UnreservedRooms--;
         SimpleReserved++;
         SimpleUnreserved--;
     }
     if (Room103.ReservationStatus)
     {
         ReservedRooms++;
         UnreservedRooms--;
         SimpleReserved++;
         SimpleUnreserved--;
     }
     if (Room104.ReservationStatus)
     {
         ReservedRooms++;
         UnreservedRooms--;
         SimpleReserved++;
         SimpleUnreserved--;
     }
     if (Room105.ReservationStatus)
     {
         ReservedRooms++;
         UnreservedRooms--;
         SimpleReserved++;
         SimpleUnreserved--;
     }
     if (Room106.ReservationStatus)
     {
         ReservedRooms++;
         UnreservedRooms--;
         DoubleReserved++;
         DoubleUnreserved--;
     }
     if (Room107.ReservationStatus)
     {
         ReservedRooms++;
         UnreservedRooms--;
         DoubleReserved++;
         DoubleUnreserved--;
     }
     if (Room108.ReservationStatus)
     {
         ReservedRooms++;
         UnreservedRooms--;
         DoubleReserved++;
         DoubleUnreserved--;
     }
     if (Room109.ReservationStatus)
     {
         ReservedRooms++;
         UnreservedRooms--;
         LuxorReserved++;
         LuxorUnreserved--;
     }
     if (Room110.ReservationStatus)
     {
         ReservedRooms++;
         UnreservedRooms--;
         LuxorReserved++;
         LuxorUnreserved--;
     }
 }
Ejemplo n.º 2
0
        public void Pay(ref Simple Room101, ref Simple Room102, ref Simple Room103, ref Simple Room104, ref Simple Room105, ref Double Room106, ref Double Room107, ref Double Room108, ref Luxor Room109, ref Luxor Room110)
        {
            string input  = null;
            string input2 = null;

            do
            {
                WindowLogged("HOTEL HOLIDAY INN - RESERVACION: HABITACION", 23);
                Write("Elija tipo de  habitacion disponible", 5, 7);
                Write("Opcion elegida: ", 5, 9);
                Write("1. Habitaciones simples ocupadas: " + SimpleReserved, 5, 10);
                Write("2. Habitaciones dobles ocupadas: " + DoubleReserved, 5, 11);
                Write("3. Habitaciones luxor ocupadas: " + LuxorReserved, 5, 12);
                Write("*. Cancelar reservacion en curso: " + LuxorReserved, 5, 13);
                input = MoveRead(22, 9);

                switch (input)
                {
                case "1":
                    WindowLogged("HOTEL HOLIDAY INN - RESERVACION: HABITACION", 23);
                    Write("Elija habitacion disponible", 5, 7);
                    Write("Opcion elegida: ", 5, 9);
                    Write("1. 101 Ocupada: " + Room101.ReservationStatus, 5, 10);
                    Write("2. 102 Ocupada: " + Room102.ReservationStatus, 5, 11);
                    Write("3. 103 Ocupada: " + Room103.ReservationStatus, 5, 12);
                    Write("5. 104 Ocupada: " + Room104.ReservationStatus, 5, 13);
                    Write("5. 105 Ocupada: " + Room105.ReservationStatus, 5, 14);
                    input2 = MoveRead(22, 9);
                    switch (input2)
                    {
                    case "1":
                        Room101.ReservationStatus = false;
                        Room102.ReservationStatus = false;
                        Room103.ReservationStatus = false;
                        Room104.ReservationStatus = false;
                        Room105.ReservationStatus = false;
                        Room106.ReservationStatus = false;
                        Room107.ReservationStatus = false;
                        Room108.ReservationStatus = false;
                        Room109.ReservationStatus = false;
                        Room110.ReservationStatus = false;

                        Write("Habitacion reservada", 30, 16);
                        Room101.ReservationStatus = true;
                        ReservedRoomsCount(ref Room101, ref Room102, ref Room103, ref Room104, ref Room105, ref Room106, ref Room107, ref Room108, ref Room109, ref Room110);

                        break;

                    case "2":
                        Room101.ReservationStatus = false;
                        Room102.ReservationStatus = false;
                        Room103.ReservationStatus = false;
                        Room104.ReservationStatus = false;
                        Room105.ReservationStatus = false;
                        Room106.ReservationStatus = false;
                        Room107.ReservationStatus = false;
                        Room108.ReservationStatus = false;
                        Room109.ReservationStatus = false;
                        Room110.ReservationStatus = false;

                        Write("Habitacion reservada", 30, 16);
                        Room102.ReservationStatus = true;
                        ReservedRoomsCount(ref Room101, ref Room102, ref Room103, ref Room104, ref Room105, ref Room106, ref Room107, ref Room108, ref Room109, ref Room110);

                        break;

                    case "3":
                        Room101.ReservationStatus = false;
                        Room102.ReservationStatus = false;
                        Room103.ReservationStatus = false;
                        Room104.ReservationStatus = false;
                        Room105.ReservationStatus = false;
                        Room106.ReservationStatus = false;
                        Room107.ReservationStatus = false;
                        Room108.ReservationStatus = false;
                        Room109.ReservationStatus = false;
                        Room110.ReservationStatus = false;

                        Write("Habitacion reservada", 30, 16);
                        Room103.ReservationStatus = true;
                        ReservedRoomsCount(ref Room101, ref Room102, ref Room103, ref Room104, ref Room105, ref Room106, ref Room107, ref Room108, ref Room109, ref Room110);

                        break;

                    case "4":
                        Room101.ReservationStatus = false;
                        Room102.ReservationStatus = false;
                        Room103.ReservationStatus = false;
                        Room104.ReservationStatus = false;
                        Room105.ReservationStatus = false;
                        Room106.ReservationStatus = false;
                        Room107.ReservationStatus = false;
                        Room108.ReservationStatus = false;
                        Room109.ReservationStatus = false;
                        Room110.ReservationStatus = false;

                        Write("Habitacion reservada", 30, 16);
                        Room104.ReservationStatus = true;
                        ReservedRoomsCount(ref Room101, ref Room102, ref Room103, ref Room104, ref Room105, ref Room106, ref Room107, ref Room108, ref Room109, ref Room110);

                        break;

                    case "5":
                        Room101.ReservationStatus = false;
                        Room102.ReservationStatus = false;
                        Room103.ReservationStatus = false;
                        Room104.ReservationStatus = false;
                        Room105.ReservationStatus = false;
                        Room106.ReservationStatus = false;
                        Room107.ReservationStatus = false;
                        Room108.ReservationStatus = false;
                        Room109.ReservationStatus = false;
                        Room110.ReservationStatus = false;

                        Write("Habitacion reservada", 30, 16);
                        Room105.ReservationStatus = true;
                        ReservedRoomsCount(ref Room101, ref Room102, ref Room103, ref Room104, ref Room105, ref Room106, ref Room107, ref Room108, ref Room109, ref Room110);

                        break;

                    default:
                        PopUp("Elija una opcion valida", "ERROR");
                        break;
                    }
                    break;

                case "2":
                    WindowLogged("HOTEL HOLIDAY INN - RESERVACION: HABITACION", 23);
                    Write("Elija habitacion disponible", 5, 7);
                    Write("Opcion elegida: ", 5, 9);
                    Write("1. 106 Ocupada: " + Room106.ReservationStatus, 5, 10);
                    Write("2. 107 Ocupada: " + Room107.ReservationStatus, 5, 11);
                    Write("3. 108 Ocupada: " + Room108.ReservationStatus, 5, 12);
                    input2 = MoveRead(22, 9);
                    switch (input2)
                    {
                    case "1":
                        Write("Habitacion reservada", 30, 16);
                        Room106.ReservationStatus = true;
                        ReservedRoomsCount(ref Room101, ref Room102, ref Room103, ref Room104, ref Room105, ref Room106, ref Room107, ref Room108, ref Room109, ref Room110);

                        break;

                    case "2":
                        Write("Habitacion reservada", 30, 16);
                        Room107.ReservationStatus = true;
                        ReservedRoomsCount(ref Room101, ref Room102, ref Room103, ref Room104, ref Room105, ref Room106, ref Room107, ref Room108, ref Room109, ref Room110);

                        break;

                    case "3":
                        Write("Habitacion reservada", 30, 16);
                        Room108.ReservationStatus = true;
                        ReservedRoomsCount(ref Room101, ref Room102, ref Room103, ref Room104, ref Room105, ref Room106, ref Room107, ref Room108, ref Room109, ref Room110);

                        break;

                    default:
                        PopUp("Elija una opcion valida", "ERROR");
                        break;
                    }
                    break;

                case "3":
                    WindowLogged("HOTEL HOLIDAY INN - RESERVACION: HABITACION", 23);
                    Write("Elija habitacion disponible", 5, 7);
                    Write("Opcion elegida: ", 5, 9);
                    Write("1. 109 Ocupada: " + Room106.ReservationStatus, 5, 10);
                    Write("2. 110 Ocupada: " + Room107.ReservationStatus, 5, 11);
                    input2 = MoveRead(22, 9);
                    switch (input2)
                    {
                    case "1":
                        Write("Habitacion reservada", 30, 16);
                        Room109.ReservationStatus = true;
                        ReservedRoomsCount(ref Room101, ref Room102, ref Room103, ref Room104, ref Room105, ref Room106, ref Room107, ref Room108, ref Room109, ref Room110);

                        break;

                    case "2":
                        Write("Habitacion reservada", 30, 16);
                        Room110.ReservationStatus = true;
                        ReservedRoomsCount(ref Room101, ref Room102, ref Room103, ref Room104, ref Room105, ref Room106, ref Room107, ref Room108, ref Room109, ref Room110);

                        break;

                    default:
                        PopUp("Elija una opcion valida", "ERROR");
                        break;
                    }
                    break;

                case "*":

                    break;

                default:
                    PopUp("Elija una opcion valida", "ERROR");
                    break;
                }
            }while(input != "*" && input != "1" && input != "2" && input != "3");
        }
Ejemplo n.º 3
0
        public Person(string name, long phone, string email, bool paymethodwithcard, ref Simple Room101, ref Simple Room102, ref Simple Room103, ref Simple Room104, ref Simple Room105, ref Double Room106, ref Double Room107, ref Double Room108, ref Luxor Room109, ref Luxor Room110)
        {
            this.name              = name;
            this.phone             = phone;
            this.email             = email;
            this.paymethodwithcard = paymethodwithcard;

            ReservedRoomsCount(ref Room101, ref Room102, ref Room103, ref Room104, ref Room105, ref Room106, ref Room107, ref Room108, ref Room109, ref Room110);
        }
Ejemplo n.º 4
0
        public static void Main(string[] args)
        {
            Console.Title = "Login";
            string       username = null, password = null, userIn = null, passIn = null;
            const string pathLogin = @"C:\Users\Admin\Documents\Programacion\C#\ConsoleEx\proyeto-poo\docs\username-pass.txt";
            bool         Login = false, exit = false;
            int          ThisDay = DateTime.Now.Hour;
            int          SimpleRoom = 500, DoubleRoom = 700, LuxorRoom = 1000;

            long      phone = 0;
            string    name = null;
            bool      paymethodwithcard = false;
            string    email = null, input = null, todayHour = TimeHour(ThisDay);
            ArrayList PayData = new ArrayList();
            Simple    Room101 = new Simple(ThisDay);
            Simple    Room102 = new Simple(ThisDay);
            Simple    Room103 = new Simple(ThisDay);
            Simple    Room104 = new Simple(ThisDay);
            Simple    Room105 = new Simple(ThisDay);
            Double    Room106 = new Double(ThisDay);
            Double    Room107 = new Double(ThisDay);
            Double    Room108 = new Double(ThisDay);
            Luxor     Room109 = new Luxor(ThisDay);
            Luxor     Room110 = new Luxor(ThisDay);
            Program   p = new Program();

            p.ReservedRoomsCount(ref Room101, ref Room102, ref Room103, ref Room104, ref Room105, ref Room106, ref Room107, ref Room108, ref Room109, ref Room110);


            if (ThisDay >= 12 && ThisDay < 13)
            {
                SimpleRoom = 400;
                DoubleRoom = 600;
                LuxorRoom  = 850;
            }
            else
            {
                SimpleRoom = 500;
                DoubleRoom = 700;
                LuxorRoom  = 1000;
            }


            while (Login != true)
            {
                WindowLog();                                        // creacion de la ventana de login
                Write("HOTEL HOLIDAY INN * LOGIN USUARIO", 22, 11); // mensaje en coordenada

                using (StreamReader ReadLogin = new StreamReader(File.Open(pathLogin, FileMode.Open))) {
                    username = ReadLogin.ReadLine();
                    password = ReadLogin.ReadLine();
                    ReadLogin.Close();
                }                 // se lee un txt

                Write("Nombre: ", 24, 13);
                Write("Contraseña: ", 24, 14);
                userIn = MoveRead(32, 13);                 // un readline pero con coordenadas

                if (userIn != username)
                {
                    PopUp("Nombre de usuario incorrecto", "LOGIN");
                }                 // messagebox con texto y titulo

                passIn = MoveRead(36, 14);
                if (passIn != password)
                {
                    PopUp("Contraseña incorrecta", "LOGIN");
                }

                ConsoleEx.CursorVisible = false;
                if (username == userIn && password == passIn)
                {
                    WindowLog();
                    Write("LOGIN EXITOSO", 30, 11);
                    Login = true;
                    Pause();
                }
                else
                {
                    WindowLog();
                    Write("LOGIN FALLIDO", 30, 11);
                    Pause();
                }
            }

            do
            {
                do
                {
                    // titulo de la ventana
                    WindowLogged("HOTEL HOLIDAY INN - INICIO", 25);
                    // fin de titulo

                    Write("Hora: " + todayHour, 65, 7);
                    Write("Presiona 'r' para reservar.", 5, 7);
                    Write("Presiona 's' para salir.", 5, 8);

                    Write("INFO", 15, 12);

                    Write("Habitaciones reservadas: " + p.ReservedRooms, 5, 13);
                    Write("Habitaciones sin reservar: " + p.UnreservedRooms, 5, 14);

                    Write("PRECIOS", 55, 12);
                    Write("Habitaciones simples: " + SimpleRoom, 45, 13);
                    Write("Habitaciones dobles: " + DoubleRoom, 45, 14);
                    Write("Habitaciones luxor: " + LuxorRoom, 45, 15);

                    Write("Horario de oferta de 12 PM a 1 PM", 25, 18);



                    Write("Entrada: ", 17, 10);


                    input = MoveRead(26, 10);

                    if (input != "r" && input != "s")
                    {
                        PopUp("Error: entrada incorrecta\nIngrese de nuevo", "ERROR");
                    }
                }while (input != "r" && input != "s");



                if (input == "r")
                {
                    Write("Cargando reservaciones.", 10, 20);
                    Thread.Sleep(100);
                    Write(".", 33, 20);
                    Thread.Sleep(300);
                    Write(".", 34, 20);
                    Thread.Sleep(50);
                    Write(".", 35, 20);
                    Thread.Sleep(100);
                    Write(".", 36, 20);
                    Thread.Sleep(300);
                    Write(".", 37, 20);
                    Thread.Sleep(50);
                    Write(".", 38, 20);
                    Thread.Sleep(500);
                    Write("presione enter para continuar.", 40, 20);

                    Pause();

                    WindowLogged("HOTEL HOLIDAY INN - RESERVACION", 23);
                    Write("REGISTRO DE LA PERSONA", 5, 7);
                    Write("Nombre: ", 5, 9);
                    name = MoveRead(13, 9);
                    Write("Numero: ", 5, 10);

                    bool phoneBool = false;
                    while (phoneBool != true)
                    {
                        try {
                            do
                            {
                                WindowLogged("HOTEL HOLIDAY INN - RESERVACION", 23);
                                Write("REGISTRO DE LA PERSONA", 5, 7);
                                Write("Nombre: ", 5, 9);
                                Write(name, 13, 9);
                                Write("Numero: ", 5, 10);
                                phone     = Convert.ToInt64(MoveRead(13, 10));
                                phoneBool = true;
                                if (phone.ToString().Length != 10)
                                {
                                    PopUp("Ingrese un numero valido", "ERROR");
                                }
                            }while(phone.ToString().Length != 10);
                        } catch (Exception e) {
                            PopUp("Error: " + e.Message + "\nIngrese de nuevo", "ERROR");
                            phoneBool = false;
                        }
                    }



                    Write("Email: ", 5, 11);
                    email = MoveRead(12, 11);
                    Write("Pago con tarjeta? (false / true): ", 5, 12);

                    bool payBool = false;
                    while (payBool != true)
                    {
                        try {
                            WindowLogged("HOTEL HOLIDAY INN - RESERVACION", 23);
                            Write("REGISTRO DE LA PERSONA", 5, 7);
                            Write("Nombre: ", 5, 9);
                            Write(name, 13, 9);
                            Write("Numero: ", 5, 10);
                            Write(phone.ToString(), 13, 10);
                            Write("Email: ", 5, 11);
                            Write(email, 12, 11);
                            Write("Pago con tarjeta? (false / true): ", 5, 12);
                            paymethodwithcard = Convert.ToBoolean(MoveRead(39, 12));
                            payBool           = true;
                        } catch (Exception e) {
                            PopUp("Error: " + e.Message + "\nIngrese solamente false o true", "ERROR");
                            payBool = false;
                        }
                    }



                    Person person1 = new Person(name, phone, email, paymethodwithcard, ref Room101, ref Room102, ref Room103, ref Room104, ref Room105, ref Room106, ref Room107, ref Room108, ref Room109, ref Room110);

                    PayData = person1.PayData(paymethodwithcard);
                    person1.Pay(ref Room101, ref Room102, ref Room103, ref Room104, ref Room105, ref Room106, ref Room107, ref Room108, ref Room109, ref Room110);
                }

                if (input == "s")
                {
                    Write("Cerrando sesion, presione enter.", 10, 20);
                    exit = true;
                }

                p.ReservedRoomsCount(ref Room101, ref Room102, ref Room103, ref Room104, ref Room105, ref Room106, ref Room107, ref Room108, ref Room109, ref Room110);


                Pause();
            }while (exit != true);
            Write("Saliendo, enter para salir.", 43, 20);



            Pause();
        }         // fin del main