示例#1
0
        private void ModificarReserva_Load(object sender, EventArgs e)
        {
            textNroReserva.Text = reserva_elegida.CodigoReserva.ToString();
            Huesped huesped = DAOHuesped.obtener(reserva_elegida.Huesped);

            if (huesped == null)
            {
                MessageBox.Show("Error al obtener los datos de la Base de Datos. Se volverá a la ventana anterior.",
                                "", MessageBoxButtons.OK);
                this.Close();
                return;
            }
            textHuesped.Text = huesped.Nombre + " " + huesped.Apellido;

            lista_regimenes = DAORegimen.obtenerByHotel(hotel.CodHotel);
            regimen_elegido = DAORegimen.obtener(reserva_elegida.CodigoRegimen);

            tipos_habitacion = DAOHabitacion.obtenerTipoTodos();
            tipo_elegido     = DAOHabitacion.obtenerTipoByReserva(reserva_elegida.CodigoReserva);

            //Rellenar Tipo Habitacion
            foreach (Tipo_Habitacion tipo in tipos_habitacion)
            {
                comboTipoHab.Items.Add(tipo.Descripcion);
            }
            //Rellenar Regimenes
            foreach (Regimen reg in lista_regimenes)
            {
                comboTipoRegimen.Items.Add(reg.Descripcion);
            }
            limpiarDatos();
        }
示例#2
0
        private void botonBuscar_Click(object sender, EventArgs e)
        {
            limpiar();
            if (textEstadia.Text == "")
            {
                showToolTip("Ingrese un número de reserva.", textEstadia, textEstadia.Location);
                return;
            }
            reserva_seleccionada = DAOReserva.obtener(Int32.Parse(textEstadia.Text));
            if (reserva_seleccionada == null)
            {
                showToolTip("Ingrese un número de reserva válido.", textEstadia, textEstadia.Location);
                return;
            }
            //DAOReserva
            if (reserva_seleccionada.Estado > 2 && reserva_seleccionada.Estado < 6)
            {
                MessageBox.Show("La reserva seleccionada se encuentra cancelada.", "", MessageBoxButtons.OK);
                return;
            }

            datos_huesped       = DAOHuesped.obtener(reserva_seleccionada.Huesped);
            textHuesped.Text    = datos_huesped.Nombre + " " + datos_huesped.Apellido;
            textFecReserva.Text = reserva_seleccionada.Fecha_Reserva_struct.Value.ToShortDateString();
            textFecInicio.Text  = reserva_seleccionada.Fecha_Inicio_struct.Value.ToShortDateString();
            textFecFin.Text     = reserva_seleccionada.Fecha_Fin_struct.Value.ToShortDateString();
        }
示例#3
0
 private void botonBuscar_Click(object sender, EventArgs e)
 {
     if (chequearDatos())
     {
         //Mostrar en DataGrid el Cliente
         dataGridClientes.DataSource = DAOHuesped.obtenerTabla(comboTipoDoc.SelectedItem.ToString(), Int32.Parse(textNroDoc.Text), textMail.Text);
         dataGridClientes.Columns["campoBaja"].Visible = false;
         dataGridClientes.AutoSizeColumnsMode          = DataGridViewAutoSizeColumnsMode.AllCells;
         dataGridClientes.AutoResizeColumns();
         dataGridClientes.AutoResizeRows();
     }
 }
示例#4
0
        private DataTable FiltrarHuesped(string nombre, string apellido, string mail, int tipoDoc, string numDoc)
        {
            DataTable tabla_huesped   = DAOHuesped.obtenerTabla();
            var       final_rol       = "";
            var       posFiltro       = true;
            var       filtrosBusqueda = new List <string>();

            if (nombre != "")
            {
                filtrosBusqueda.Add("nombre LIKE '%" + nombre + "%'");
            }
            if (apellido != "")
            {
                filtrosBusqueda.Add("apellido LIKE '%" + apellido + "%'");
            }
            if (mail != "")
            {
                filtrosBusqueda.Add("mail LIKE '%" + mail + "%'");
            }
            if (numDoc != "")
            {
                filtrosBusqueda.Add("numDocu = " + numDoc);
            }
            if (tipoDoc != -1)
            {
                filtrosBusqueda.Add("tipoDocu LIKE '%" + comboTipoDoc.Items[tipoDoc] + "%'");
            }
            foreach (var filtro in filtrosBusqueda)
            {
                if (!posFiltro)
                {
                    final_rol += " AND " + filtro;
                }
                else
                {
                    final_rol += filtro;
                    posFiltro  = false;
                }
            }
            if (tabla_huesped != null)
            {
                tabla_huesped.DefaultView.RowFilter = final_rol;
            }
            return(tabla_huesped);
        }
示例#5
0
 public ClienteMod(int idHuesped)
 {
     InitializeComponent();
     huesped_seleccionado = DAOHuesped.obtener(idHuesped);
     if (huesped_seleccionado == null)
     {
         MessageBox.Show("Error al cargar el cliente.", "Error al Modificar Cliente",
                         MessageBoxButtons.OK, MessageBoxIcon.Error);
         Globals.habilitarAnterior();
         this.Dispose();
     }
     foreach (string tipo in Documento.string_docu)
     {
         comboTipoDoc.Items.Add(tipo);
     }
     foreach (string pais in Globals.paises)
     {
         textPais.Items.Add(pais);
     }
 }
示例#6
0
 private void botonGuardar_Click(object sender, EventArgs e)
 {
     toolTip.Hide(this.textApellido);
     if (chequearDatos())
     {
         Huesped huesped = new Huesped();
         huesped.Nombre                    = textNombre.Text;
         huesped.Apellido                  = textApellido.Text;
         huesped.TipoDocu                  = Documento.string_docu[comboTipoDoc.SelectedIndex];
         huesped.NroDocu                   = Int32.Parse(textNumDoc.Text);
         huesped.Fecha_nacimiento          = dateTimeNacimiento.Text;
         huesped.Mail                      = textMail.Text;
         huesped.Telefono                  = Int32.Parse(textTelefono.Text);
         huesped.Direccion.calle_direccion = textDirCalle.Text;
         huesped.Direccion.calle_altura    = Int32.Parse(textDirAltura.Text);
         if (textDirPiso.Text != "")
         {
             huesped.Direccion.calle_piso = Int32.Parse(textDirPiso.Text);
         }
         if (textDirDpto.Text != "")
         {
             huesped.Direccion.calle_dpto = textDirDpto.Text;
         }
         huesped.Localidad    = textLocalidad.Text;
         huesped.Nacionalidad = (string)textPais.SelectedItem;
         if (!DAOHuesped.insertar(huesped))
         {
             MessageBox.Show("Error al crear el cliente.", "Error al crear Nuevo Cliente",
                             MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             MessageBox.Show("Cliente Creado Correctamente.", "Nuevo Cliente",
                             MessageBoxButtons.OK, MessageBoxIcon.None);
             //((ClienteBajaMod)Globals.VentanaAnterior).updateGrid();
             this.Close();
         }
     }
 }
示例#7
0
 private void botonGuardar_Click(object sender, EventArgs e)
 {
     if (chequearDatos())
     {
         huesped_seleccionado.Nombre                    = textNombre.Text;
         huesped_seleccionado.Apellido                  = textApellido.Text;
         huesped_seleccionado.TipoDocu                  = Documento.string_docu[comboTipoDoc.SelectedIndex];
         huesped_seleccionado.NroDocu                   = Int32.Parse(textNumDoc.Text);
         huesped_seleccionado.Fecha_nacimiento          = dateTimeNacimiento.Text;
         huesped_seleccionado.Mail                      = textMail.Text;
         huesped_seleccionado.Telefono                  = Int32.Parse(textTelefono.Text);
         huesped_seleccionado.Direccion.calle_direccion = textDirCalle.Text;
         huesped_seleccionado.Direccion.calle_altura    = Int32.Parse(textDirAltura.Text);
         if (textDirPiso.Text != "")
         {
             huesped_seleccionado.Direccion.calle_piso = Int32.Parse(textDirPiso.Text);
         }
         if (textDirDpto.Text != "")
         {
             huesped_seleccionado.Direccion.calle_dpto = textDirDpto.Text;
         }
         huesped_seleccionado.Localidad    = textLocalidad.Text;
         huesped_seleccionado.Nacionalidad = (string)textPais.SelectedItem;
         huesped_seleccionado.Campo_Baja   = checkBaja.Checked;
         if (!DAOHuesped.actualizar(huesped_seleccionado))
         {
             MessageBox.Show("Error al modificar el huesped.", "Error al Modificar Huesped",
                             MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
         else
         {
             MessageBox.Show("Huesped Modificado Correctamente.", "Modificar Huesped",
                             MessageBoxButtons.OK, MessageBoxIcon.None);
             ((ClienteBajaMod)Globals.VentanaAnterior).updateGrid();
             this.Close();
         }
     }
 }
示例#8
0
 private void BajaHuesped(int id)
 {
     DAOHuesped.borrar(id);
     updateGrid();
 }