示例#1
0
 private void btnAgregar_Click(object sender, EventArgs e)
 {
     if (!String.IsNullOrEmpty(txtNumero.Text))
     {
         try
         {
             if (!String.IsNullOrEmpty(txtTipoCama.Text))
             {
                 if (!String.IsNullOrEmpty(txtPrecio.Text))
                 {
                     try
                     {
                         if (!String.IsNullOrEmpty(txtAccesorios.Text))
                         {
                             HabitacionController hc = new HabitacionController();
                             if (hc.AgregarHabitacion(int.Parse(txtNumero.Text), txtTipoCama.Text, txtAccesorios.Text, int.Parse(txtPrecio.Text)))
                             {
                                 hc.LlenarGrid(App.fh.dataHabitaciones);
                                 this.Dispose();
                             }
                         }
                         else
                         {
                             MessageBox.Show("Ingrese Accesorios.", "Crear Habitacion", MessageBoxButtons.OK);
                         }
                     }
                     catch (Exception ex)
                     {
                         MessageBox.Show("Ingrese precio valido.", "Crear Habitacion", MessageBoxButtons.OK);
                     }
                 }
                 else
                 {
                     MessageBox.Show("Ingrese Numero.", "Crear Habitacion", MessageBoxButtons.OK);
                 }
             }
             else
             {
                 MessageBox.Show("Ingrese Tipo de Cama.", "Crear Habitacion", MessageBoxButtons.OK);
             }
         }
         catch (Exception ex)
         {
             MessageBox.Show("Ingrese Numero Valido.", "Crear Habitacion", MessageBoxButtons.OK);
         }
     }
     else
     {
         MessageBox.Show("Ingrese Numero de Habitacion.", "Crear Habitacion", MessageBoxButtons.OK);
     }
 }
示例#2
0
 private void btnEliminar_Click(object sender, EventArgs e)
 {
     try
     {
         HabitacionController hc = new HabitacionController();
         int id = int.Parse(dataHabitaciones.CurrentRow.Cells[0].Value.ToString());
         hc.EliminarHabitacion(id);
         hc.LlenarGrid(App.fh.dataHabitaciones);
     }
     catch (Exception ex)
     {
         MessageBox.Show("Debe seleccionar una habitacion.", "Eliminar Habitacion", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
示例#3
0
 private void btnModificar_Click(object sender, EventArgs e)
 {
     try
     {
         HabitacionController hc = new HabitacionController();
         int id = int.Parse(dataHabitaciones.CurrentRow.Cells[0].Value.ToString());
         ModificarHabitacion mh = new ModificarHabitacion();
         hc.LlenarComboEstado(mh.comboEstado);
         hc.LlenarCampos(id, mh.txtNumero, mh.txtTipoCama, mh.txtPrecio, mh.comboEstado, mh.txtAccesorios, mh.labelidHabitacion);
         mh.Show();
     }
     catch (Exception ex)
     {
         MessageBox.Show("Debe seleccionar una habitacion.", "Modificar Habitacion", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
示例#4
0
        private void FormularioHabitacion_Load(object sender, EventArgs e)
        {
            HabitacionController hc = new HabitacionController();

            hc.LlenarGrid(dataHabitaciones);
        }