Exemple #1
0
        public void ComprobarReservas()
        {
            using (reservacion = new Reservacion())
            {
                foreach (Button b in tableLayoutPanel1.Controls)
                {
                    if (b.BackColor == ocupada)
                    {
                        if (!reservacion.HayReserva(int.Parse(b.Name.Remove(0, 6))))
                        {
                            //MessageBox.Show(b.Name.Remove(0, 6));
                            CambiarEstadoHabitacion(false, "disponible", b.Name.Remove(0, 6));
                            b.BackColor = disponible;
                            //ActualizarColores();
                        }
                    }

                    /*if (b.BackColor == disponible)
                     * {
                     *  if (reservacion.HayReserva(int.Parse(b.Name.Remove(0, 6))))
                     *  {
                     *      //MessageBox.Show(b.Name.Remove(0, 6));
                     *      CambiarEstadoHabitacion(true, "ocupada", b.Name.Remove(0, 6));
                     *      b.BackColor = ocupada;
                     *      //ActualizarColores();
                     *
                     *  }
                     * }*/
                }
            }
        }
Exemple #2
0
        private void btnEliminar_Click(object sender, EventArgs e)
        {
            if (lst.SelectedItems.Count > 0)
            {
                if (opcion == "cliente" || opcion == "actual" || opcion == "lista_negra")
                {
                    msg = new Msg();

                    msg.lblMsg.Text = $"¿Está seguro de que desea eliminar el registro? \nAdvertencia: Se eliminarán todos los datos asociados (reservaciones y vehículos). \n\nCliente a eliminar: \"{lst.SelectedItems[0].SubItems[2].Text}\" \nCédula: \"{lst.SelectedItems[0].SubItems[3].Text}\".";
                    DialogResult dlgres = msg.ShowDialog();
                    {
                        if (dlgres == DialogResult.Yes)
                        {
                            EliminarCliente(lst.SelectedItems[0].SubItems[0].Text.ToString());
                            CargarListView("cliente");
                            OcultarListbox();
                        }
                        else
                        {
                            return;
                        }
                    }
                }
                else // Habitacion
                {
                    reservacion = new Reservacion();

                    reservacion.CargarReservacion(int.Parse(lst.SelectedItems[0].SubItems[2].Text.ToString()), "ocupada");
                    reservacion.ShowDialog();

                    //MessageBox.Show("De momento da error el método de Actualizar Colores porque Form1 no está activa. Verificar si sigue siendo el caso una vez que cambie Application.Run a Form1 nuevamente.");
                }
            }
        }
Exemple #3
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (((Button)sender).BackColor == limpieza || ((Button)sender).BackColor == mantenimiento)
            {
                msg = new Msg();

                msg.lblMsg.Text = "¿Desea cambiar el estado a disponible?";
                msg.Text        = $"Confirmación | Habitación {((Button)sender).Name.Remove(0, 6)}";
                DialogResult dlgres = msg.ShowDialog();
                {
                    if (dlgres == DialogResult.Yes)
                    {
                        if (CambiarEstadoHabitacion(false, "disponible", ((Button)sender).Name.Remove(0, 6)))
                        {
                            ((Button)sender).BackColor = disponible;
                            return;
                        }
                    }
                    else
                    {
                        return;
                    }
                }
            }

            if (((Button)sender).BackColor == disponible || (((Button)sender).BackColor == ocupada))
            {
                ActivarTimerEspera();

                int numeroHabitacion = int.Parse(((Button)sender).Name.Remove(0, 6));//Text);
                reservacion = new Reservacion();

                reservacion.PanelCedula(false);

                if (((Button)sender).BackColor == ocupada)
                {
                    if (!reservacion.HayReserva(numeroHabitacion)) // Aparece como ocupada pero NO tiene datos de reserva almacenados
                    {
                        CambiarEstadoHabitacion(false, "disponible", numeroHabitacion.ToString());
                        ActualizarColores();
                        return;
                    }
                    reservacion.CargarReservacion(numeroHabitacion, "ocupada");
                }
                else if (((Button)sender).BackColor == disponible)
                {
                    if (reservacion.HayReserva(numeroHabitacion)) // Aparece como disponible pero aún tiene datos de reserva almacenados
                    {
                        CambiarEstadoHabitacion(true, "disponible", numeroHabitacion.ToString());
                    }

                    reservacion.CargarReservacion(numeroHabitacion, "disponible");
                }

                reservacion.ShowDialog();
            }
        }
Exemple #4
0
        private void listboxVehiculoHabitacion_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            f1.ActivarTimerEspera();

            Reservacion reservacion = new Reservacion();

            reservacion.CargarReservacion(int.Parse(listboxVehiculoHabitacion.Text), "ocupada");
            reservacion.ShowDialog();
        }
Exemple #5
0
        private void btnAgregarListaNegra_Click(object sender, EventArgs e)
        {
            msg = new Msg();

            msg.lblMsg.Text = "¿Está seguro de que desea agregar al cliente a la lista negra? \nNota: Cualquier reserva activa se eliminará.";
            DialogResult dlgres = msg.ShowDialog();
            {
                if (dlgres == DialogResult.Yes)
                {
                    using (AgregarListaNegra agregarListaNegra = new AgregarListaNegra())
                    {
                        agregarListaNegra.lblCliente.Text = nombre;
                        DialogResult agregar = agregarListaNegra.ShowDialog();

                        if (agregar == DialogResult.Yes)
                        {
                            using (ListaNegra lista = new ListaNegra())
                            {
                                lista.AgregarLista(cedula, agregarListaNegra.txtMotivo.Text.Trim());
                                using (Reservacion reserva = new Reservacion())
                                {
                                    if (reserva.TieneReserva(cedula))
                                    {
                                        reserva.EliminarReservacion(cedula);
                                    }
                                }
                                f1.ActivarTimerEspera();

                                // Desactivar botón de Eliminar cuando agrego a alguien a la lista
                                btnEliminar.Enabled   = false;
                                btnEliminar.ForeColor = Color.Black;
                                btnEliminar.BackColor = Color.Transparent;

                                if (this.Text != "") // Como cuando se llama desde ListaNegra
                                {
                                    CargarCliente(idCliente);
                                }
                                else
                                {
                                    Close();
                                }
                            }
                        }
                        else
                        {
                            return;
                        }
                    }
                }
                else
                {
                    return;
                }
            }
        }
Exemple #6
0
        private void listboxReservaciones_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            f1.ActivarTimerEspera();

            reservacion = new Reservacion();

            reservacion.CargarReservacion(int.Parse(listboxReservaciones.Text), "ocupada");
            reservacion.ShowDialog();
            //this.Hide();

            //MessageBox.Show("De momento da error el método de Actualizar Colores porque Form1 no está activa. Verificar si sigue siendo el caso una vez que cambie Application.Run a Form1 nuevamente.");
        }
Exemple #7
0
        private void btnNuevaReservacion_Click(object sender, EventArgs e)
        {
            f1.ActivarTimerEspera();

            reservacion = new Reservacion();

            reservacion.txtCedula.Text = txtCedula.Text.Trim();
            reservacion.ShowDialog();
            CargarCliente(idCliente);
            //Hide();

            //MessageBox.Show("De momento da error el método de Actualizar Colores porque Form1 no está activa. Verificar si sigue siendo el caso una vez que cambie Application.Run a Form1 nuevamente.");
        }
Exemple #8
0
        private void button53_Click(object sender, EventArgs e) // Nueva reservación
        {
            ActivarTimerEspera();

            foreach (Button b in tableLayoutPanel1.Controls) // Verifica si hay al menos una habitación disponible
            {
                if (b.BackColor == disponible)
                {
                    reservacion = new Reservacion();
                    reservacion.ShowDialog();
                    return;
                }
            }

            MessageBox.Show("No hay ninguna habitación disponible.", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Exemple #9
0
        private void lst_MouseDoubleClick(object sender, MouseEventArgs e)
        {
            f1.ActivarTimerEspera();

            if (opcion == "cliente" || opcion == "actual" || opcion == "buscar" || opcion == "lista_negra")
            {
                btnModificar_Click(null, null);
            }
            else // Habitacion
            {
                reservacion = new Reservacion();

                reservacion.CargarReservacion(int.Parse(lst.SelectedItems[0].SubItems[2].Text.ToString()), "ocupada");
                //this.Hide();
                reservacion.ShowDialog();
                CargarListView("habitacion");
                //this.Show();

                //MessageBox.Show("De momento da error el método de Actualizar Colores porque Form1 no está activa. Verificar si sigue siendo el caso una vez que cambie Application.Run a Form1 nuevamente.");
            }
        }
Exemple #10
0
        private void btnAgregar_Click(object sender, EventArgs e)
        {
            if (lst.SelectedItems.Count > 0)
            {
                msg = new Msg();

                msg.lblMsg.Text = $"¿Está seguro de que desea agregar al cliente a la lista negra? \nNota: Cualquier reserva activa se eliminará. \n\nCliente: \"{lst.SelectedItems[0].SubItems[2].Text}\" \nCédula: \"{lst.SelectedItems[0].SubItems[3].Text}\".";
                DialogResult dlgres = msg.ShowDialog();
                {
                    if (dlgres == DialogResult.Yes)
                    {
                        confirmar = new AgregarListaNegra();
                        Reservacion reserva = new Reservacion();
                        confirmar.lblCliente.Text = nombre;
                        DialogResult agregarResult = confirmar.ShowDialog();

                        if (agregarResult == DialogResult.Yes)
                        {
                            motivo = confirmar.txtMotivo.Text;
                            AgregarLista(cedula, motivo);
                            if (reserva.TieneReserva(cedula))
                            {
                                reserva.EliminarReservacion(cedula);
                            }

                            CargarListView("");
                            txtBuscar.Clear();
                        }
                        else
                        {
                            return;
                        }
                    }
                    else
                    {
                        return;
                    }
                }
            }
        }