Esempio n. 1
0
        private void AltaReserva()
        {
            command = UtilesSQL.crearCommand("INSERT INTO DERROCHADORES_DE_PAPEL.Reserva (rese_cliente, rese_cantidadDeNoches, rese_estado, rese_fecha, rese_inicio, rese_fin, rese_hotel, rese_regimen, rese_usuario, rese_cantidadDePersonas) VALUES (@clie, @noches, @estado, CONVERT(datetime,@fecha, 121), CONVERT(datetime,@incio, 121), CONVERT(datetime,@fin, 121), @hotel, @regimen ,@user, @personas) SELECT SCOPE_IDENTITY()");
            command.Parameters.AddWithValue("@clie", reserva.cliente);
            command.Parameters.AddWithValue("@noches", reserva.cantidad_de_noches);
            command.Parameters.AddWithValue("@estado", CargarEstadosDeReserva("RESERVA CORRECTA"));
            command.Parameters.AddWithValue("@fecha", reserva.fecha_que_se_realizo_reserva.ToString("yyyy-MM-dd HH:mm:ss.fff"));
            command.Parameters.AddWithValue("@incio", reserva.fecha_desde.ToString("yyyy-MM-dd HH:mm:ss.fff"));
            command.Parameters.AddWithValue("@fin", reserva.fecha_hasta.ToString("yyyy-MM-dd HH:mm:ss.fff"));
            command.Parameters.AddWithValue("@hotel", reserva.hotel.ID);
            command.Parameters.AddWithValue("@regimen", reserva.regimen_seleccionado);
            command.Parameters.AddWithValue("@user", reserva.usuario);
            command.Parameters.AddWithValue("@personas", reserva.personas);

            reserva.codigo = Convert.ToInt32(command.ExecuteScalar());

            for (int indice = 0; indice < reserva.habitaciones_reservadas.Count; indice++)
            {
                command = UtilesSQL.crearCommand("INSERT INTO DERROCHADORES_DE_PAPEL.ReservaXHabitacion (rexh_reserva, rexh_hotel, rexh_numero, rexh_piso) VALUES (@reserva, @hotel, @numero, @piso)");
                command.Parameters.AddWithValue("@reserva", reserva.codigo);
                command.Parameters.AddWithValue("@hotel", reserva.hotel.ID);
                command.Parameters.AddWithValue("@piso", reserva.habitaciones_reservadas[indice].piso);
                command.Parameters.AddWithValue("@numero", reserva.habitaciones_reservadas[indice].numero);
                UtilesSQL.ejecutarComandoNonQuery(command);
            }
        }
Esempio n. 2
0
        private void realizarCambios()
        {
            //Crea el hotel
            SqlCommand com = UtilesSQL.crearCommand("INSERT INTO DERROCHADORES_DE_PAPEL.Hotel (hote_nombre, hote_mail, hote_telefono, hote_calle, hote_numeroDeCalle, hote_localidad, hote_estrellas, hote_recargaEstrella, hote_ciudad, hote_pais, hote_fechaDeCreacion) VALUES (@nom, @mail, @tel, @calle, @numCalle, @loc, @estr, @recEstr, @ciudad, @pais, CONVERT(datetime, @fecha, 121))");

            com.Parameters.AddWithValue("@nom", textBoxNombre.Text);
            com.Parameters.AddWithValue("@mail", textBoxMail.Text);
            com.Parameters.AddWithValue("@tel", textBoxTelefono.Text);
            com.Parameters.AddWithValue("@calle", textBoxDireccion.Text);
            com.Parameters.AddWithValue("@numCalle", textBoxNumeroCalle.Text);
            com.Parameters.AddWithValue("@loc", textBoxLocalidad.Text);
            com.Parameters.AddWithValue("@estr", comboBoxEstrellas.SelectedIndex);
            com.Parameters.AddWithValue("@recEstr", 10);
            com.Parameters.AddWithValue("@ciudad", textBoxCiudad.Text);
            com.Parameters.AddWithValue("@pais", textBoxPais.Text);
            com.Parameters.AddWithValue("@fecha", textBoxFecha.Text);
            UtilesSQL.ejecutarComandoNonQuery(com);

            com = UtilesSQL.crearCommand("SELECT MAX(hote_id) FROM DERROCHADORES_DE_PAPEL.Hotel");
            var hoteId = com.ExecuteScalar();

            //Crea los regimenes que esten seleccionados
            SqlCommand com1;
            int        i = 0;

            foreach (DataGridViewRow row in dataGridViewRegimenes.Rows)
            {
                i++;
                if (row.Cells[0].Value.ToString() == true.ToString())
                {
                    com1 = UtilesSQL.crearCommand("INSERT INTO DERROCHADORES_DE_PAPEL.RegimenXHotel VALUES (@reg, @hote)");
                    com1.Parameters.AddWithValue("@reg", i);
                    com1.Parameters.AddWithValue("@hote", hoteId);
                    UtilesSQL.ejecutarComandoNonQuery(com1);
                }
            }

            //Asigna el rol de administrador del hotel al usuario logueado
            SqlCommand com2;

            com2 = UtilesSQL.crearCommand("INSERT INTO DERROCHADORES_DE_PAPEL.RolXUsuarioXHotel VALUES (2, @user, @hotel, 1)");
            com2.Parameters.AddWithValue("@user", userId);
            com2.Parameters.AddWithValue("@hotel", hoteId);
            UtilesSQL.ejecutarComandoNonQuery(com2);

            //Asigna al usuario guest el rol de guest para el hotel creado
            SqlCommand com3;

            com3 = UtilesSQL.crearCommand("INSERT INTO DERROCHADORES_DE_PAPEL.RolXUsuarioXHotel VALUES (4, 2, @hotel, 1)");
            com3.Parameters.AddWithValue("@hotel", hoteId);
            UtilesSQL.ejecutarComandoNonQuery(com3);

            //Asigna al usuario admin el rol de administrador general para el hotel creado
            SqlCommand com4;

            com4 = UtilesSQL.crearCommand("INSERT INTO DERROCHADORES_DE_PAPEL.RolXUsuarioXHotel VALUES (1, 1, @hotel, 1)");
            com4.Parameters.AddWithValue("@hotel", hoteId);
            UtilesSQL.ejecutarComandoNonQuery(com4);
            MessageBox.Show("Creacion exitosa!");
        }
Esempio n. 3
0
        private void buttonFinalizar_Click(object sender, EventArgs e)
        {
            var confirmResult = MessageBox.Show("Esta seguro que los datos son correctos?", "Finalizar factura?", MessageBoxButtons.YesNo);

            if (confirmResult == DialogResult.No)
            {
                return;
            }

            SqlCommand com = UtilesSQL.crearCommand("UPDATE DERROCHADORES_DE_PAPEL.Estadia SET esta_usuarioCheckOut = " + Login.SeleccionFuncionalidad.getUserId() + " WHERE esta_id = @est");

            com.Parameters.AddWithValue("@est", dtF.Rows[0][2].ToString());
            UtilesSQL.ejecutarComandoNonQuery(com);

            if (!comboBoxFormaDePago.Text.Equals("TARJETA DE CREDITO"))
            {
                resetearLabels();
                finalizarFactura();
                MessageBox.Show("Check out completado!");
                this.Close();
            }
            else
            {
                if (validar())
                {
                    finalizarFacturaTarjeta();
                    MessageBox.Show("Check out completado!");
                    this.Close();
                }
            }
        }
Esempio n. 4
0
        private void cargarComboBox()
        {
            dtDoc.Clear();
            dtNac.Clear();
            command = UtilesSQL.crearCommand("select docu_detalle, docu_tipo from DERROCHADORES_DE_PAPEL.Documento");
            SqlDataReader reader;

            reader = command.ExecuteReader();
            dt.Columns.Add("docu_detalle", typeof(string));
            dt.Columns.Add("docu_tipo", typeof(string));
            dtDoc.Load(reader);

            comboBoxTipoDocumento.ValueMember   = "docu_tipo";
            comboBoxTipoDocumento.DisplayMember = "docu_detalle";
            comboBoxTipoDocumento.DataSource    = dtDoc;

            SqlDataReader reader2;

            command2 = UtilesSQL.crearCommand("SELECT naci_detalle, naci_id from DERROCHADORES_DE_PAPEL.Nacionalidad");
            reader2  = command2.ExecuteReader();
            dtNac.Columns.Add("naci_detalle", typeof(string));
            dtNac.Columns.Add("naci_id", typeof(string));
            dtNac.Load(reader2);

            comboBoxNacionalidad.ValueMember   = "naci_id";
            comboBoxNacionalidad.DisplayMember = "naci_detalle";
            comboBoxNacionalidad.DataSource    = dtNac;
        }
Esempio n. 5
0
        private void Consumibles()
        {
            //Si ya registro consumibles va directo al check out, sino pregunta
            SqlCommand com = UtilesSQL.crearCommand("SELECT item_id FROM DERROCHADORES_DE_PAPEL.ItemDeFactura WHERE item_factura = @factura AND item_habitacionNumero = @hab AND item_habitacionPiso = @piso AND item_consumible IS NOT NULL");

            com.Parameters.AddWithValue("@factura", factura);
            com.Parameters.AddWithValue("@hab", dtH.Rows[0][0].ToString());
            com.Parameters.AddWithValue("@piso", dtH.Rows[0][1].ToString());
            object itemPrevio = com.ExecuteScalar();

            if (itemPrevio != null)
            {
                this.Hide();
                Form f1 = new CheckOut(factura);
                f1.ShowDialog();
                return;
            }
            var confirmResult = MessageBox.Show("Desea registrar consumibles?", "Registrar consumibles?", MessageBoxButtons.YesNo);

            if (confirmResult == DialogResult.Yes)
            {
                this.Hide();
                new RegistrarConsumible.ElegirHabitacion(factura, dtH).ShowDialog();
                new CheckOut(factura).ShowDialog();
                this.Close();
            }
            else
            {
                this.Hide();
                Form f1 = new CheckOut(factura);
                f1.ShowDialog();
                this.Close();
            }
        }
Esempio n. 6
0
        private void checkout_Click(object sender, EventArgs e)
        {
            if (!estado.Text.Equals("RESERVA EFECTIVIZADA"))
            {
                MessageBox.Show("La reserva no hizo el check-in o fue cancelada");
                return;
            }

            //Checkea que no se haya realizado el check out
            dtH.Clear();
            UtilesSQL.llenarTabla(dtH, "SELECT h.habi_numero, h.habi_piso, e.esta_id FROM DERROCHADORES_DE_PAPEL.Habitacion AS h JOIN DERROCHADORES_DE_PAPEL.ReservaXHabitacion AS rh ON rh.rexh_piso = h.habi_piso AND rh.rexh_numero = h.habi_numero JOIN DERROCHADORES_DE_PAPEL.Reserva AS r ON r.rese_codigo = rh.rexh_reserva JOIN DERROCHADORES_DE_PAPEL.Estadia AS e ON e.esta_reserva = r.rese_codigo WHERE rh.rexh_reserva = '" + reserva.Text + "' AND e.esta_usuarioCheckOut IS NULL GROUP BY h.habi_numero, h.habi_piso, e.esta_id");
            if (dtH.Rows.Count == 0)
            {
                MessageBox.Show("Esta reserva ya realizo el check out.");
                return;
            }

            //Crea la factura para poder iniciar el proceso de check out
            SqlCommand com = UtilesSQL.crearCommand("INSERT INTO DERROCHADORES_DE_PAPEL.Factura (fact_fecha, fact_estadia, fact_cliente) VALUES (CONVERT(datetime, @fecha, 121), @estadia, @cliente)");

            com.Parameters.AddWithValue("@fecha", Main.fecha());
            com.Parameters.AddWithValue("@estadia", dtH.Rows[0][2].ToString());
            com.Parameters.AddWithValue("@cliente", reserva_dt.Rows[0][9].ToString());
            UtilesSQL.ejecutarComandoNonQuery(com);

            com = UtilesSQL.crearCommand("SELECT f.fact_numero FROM DERROCHADORES_DE_PAPEL.Factura AS f JOIN DERROCHADORES_DE_PAPEL.Estadia AS e ON e.esta_id = f.fact_estadia WHERE e.esta_id = @estadia");
            com.Parameters.AddWithValue("@estadia", dtH.Rows[0][2].ToString());
            factura = com.ExecuteScalar().ToString();

            UtilesSQL.ejecutarComandoNonQuery("INSERT INTO DERROCHADORES_DE_PAPEL.ItemDeFactura (item_cantidad, item_monto, item_factura, item_descripcion, item_consumible, item_habitacionNumero, item_habitacionPiso) VALUES (1, (SELECT regi_precioBase * SUM(tipo_cantidadDePersonas) * rese_cantidadDeNoches + 10 FROM DERROCHADORES_DE_PAPEL.Reserva JOIN DERROCHADORES_DE_PAPEL.ReservaXHabitacion ON rese_codigo = rexh_reserva JOIN DERROCHADORES_DE_PAPEL.Habitacion ON habi_hotel = rexh_hotel AND habi_numero = rexh_numero AND habi_piso = rexh_piso JOIN DERROCHADORES_DE_PAPEL.TipoDeHabitacion ON habi_tipo = tipo_codigo JOIN DERROCHADORES_DE_PAPEL.Regimen ON regi_codigo = rese_regimen WHERE rese_codigo = " + reserva.Text + " AND habi_hotel = " + Login.SeleccionFuncionalidad.getHotelId() + " GROUP BY regi_precioBase, rese_cantidadDeNoches), " + factura + ", \'Hospedaje\', NULL, " + dtH.Rows[0][0].ToString() + ", " + dtH.Rows[0][1].ToString() + ")");

            Consumibles();
        }
Esempio n. 7
0
        private void volver_Click(object sender, EventArgs e)
        {
            var confirmResult = MessageBox.Show("¿Está seguro de que quiere terminar la carga de consumibles?", "Finalizar carga", MessageBoxButtons.YesNo);

            if (confirmResult == DialogResult.Yes)
            {
                //En caso de ser un régimen "All inclusive" hay que netear los costos de los consumibles
                SqlCommand com3 = UtilesSQL.crearCommand("SELECT re.regi_descripcion FROM DERROCHADORES_DE_PAPEL.Estadia AS e JOIN DERROCHADORES_DE_PAPEL.Reserva AS r ON e.esta_reserva = r.rese_codigo JOIN DERROCHADORES_DE_PAPEL.Regimen AS re ON re.regi_codigo = r.rese_regimen WHERE esta_id = @est");
                com3.Parameters.AddWithValue("@est", estadia);
                object regimen = com3.ExecuteScalar();
                if (regimen != null)
                {
                    if (regimen.ToString().Equals("All inclusive") || regimen.ToString().Equals("All Inclusive moderado"))
                    {
                        //Creamos el item de factura con el descuento
                        UtilesSQL.ejecutarComandoNonQuery("INSERT INTO DERROCHADORES_DE_PAPEL.ItemDeFactura (item_cantidad, item_monto, item_factura, item_descripcion, item_consumible, item_habitacionNumero, item_habitacionPiso) "
                                                          + "SELECT 1, SUM(item_monto), item_factura, '1x Descuento por régimen All Inclusive', NULL, MAX(item_habitacionNumero), MAX(item_habitacionPiso) "
                                                          + "FROM DERROCHADORES_DE_PAPEL.ItemDeFactura "
                                                          + "WHERE item_factura = " + factura + " AND item_consumible IS NOT NULL "
                                                          + "GROUP BY item_factura");
                    }
                }
                this.Close();
            }
        }
Esempio n. 8
0
        private void enviar_Click(object sender, EventArgs e)
        {
            //txtbox_motivo tiene MaxLength = 255, así que no hay que verificar eso
            labelMotivo.Visible = false;
            if (!String.IsNullOrWhiteSpace(txtbox_motivo.Text))
            {
                SqlCommand command = UtilesSQL.crearCommand("INSERT INTO DERROCHADORES_DE_PAPEL.CancelacionReserva (canc_reserva, canc_motivo, canc_fechaDeCancelacion, canc_usuario) VALUES (@reserva, @motivo, CONVERT(DATETIME, @fecha, 121), @user)");
                command.Parameters.AddWithValue("@reserva", Convert.ToInt64(codigo));
                command.Parameters.AddWithValue("@motivo", txtbox_motivo.Text);
                command.Parameters.AddWithValue("@fecha", Main.fecha());
                command.Parameters.AddWithValue("@user", usuario);
                UtilesSQL.ejecutarComandoNonQuery(command);

                SqlCommand command2 = UtilesSQL.crearCommand("UPDATE DERROCHADORES_DE_PAPEL.Reserva SET rese_estado = @estado WHERE rese_codigo = @reserva");
                command2.Parameters.AddWithValue("@reserva", Convert.ToInt64(codigo));
                command2.Parameters.AddWithValue("@estado", getEstadosDeReserva(tipo_cancelacion));
                UtilesSQL.ejecutarComandoNonQuery(command2);
                MessageBox.Show("Se canceló la reserva " + codigo);
                Close();
            }
            else
            {
                labelMotivo.Visible = true;
            }
        }
Esempio n. 9
0
        private void realizarCambios()
        {
            SqlCommand command1 = UtilesSQL.crearCommand("INSERT INTO DERROCHADORES_DE_PAPEL.Usuario (usur_username, usur_password, usur_nombre, usur_apellido, usur_mail, usur_telefono, usur_fechaDeNacimiento, usur_calle, usur_numeroDeCalle, usur_piso, usur_departamento, usur_localidad, usur_tipoDeDocumento, usur_numeroDeDocumento, usur_habilitado) VALUES (@user, @pass, @nombre, @ape, @mail, @tel, CONVERT(datetime, @fecha, 121), @calle, @numCalle, @piso, @depto, @loc, @doc, @numDoc, @hab)");

            command1.Parameters.AddWithValue("@user", textBoxUsuario.Text);
            command1.Parameters.AddWithValue("@pass", sha256.GenerarSHA256String(textBoxContraseña.Text));
            command1.Parameters.AddWithValue("@nombre", textBoxNombre.Text);
            command1.Parameters.AddWithValue("@ape", textBoxApellido.Text);
            command1.Parameters.AddWithValue("@mail", textBoxMail.Text);
            if (teleNull)
            {
                command1.Parameters.AddWithValue("@tel", DBNull.Value);
            }
            else
            {
                command1.Parameters.AddWithValue("@tel", textBoxTelefono.Text);
            }
            command1.Parameters.AddWithValue("@fecha", textBoxFecha.Text);
            command1.Parameters.AddWithValue("@calle", textBoxDireccion.Text);
            command1.Parameters.AddWithValue("@numCalle", textBoxNumeroCalle.Text);
            if (pisoNull)
            {
                command1.Parameters.AddWithValue("@piso", DBNull.Value);
            }
            else
            {
                command1.Parameters.AddWithValue("@piso", textBoxPiso.Text);
            }
            if (deptoNull)
            {
                command1.Parameters.AddWithValue("@depto", DBNull.Value);
            }
            else
            {
                command1.Parameters.AddWithValue("@depto", textBoxDepto.Text);
            }
            if (locNull)
            {
                command1.Parameters.AddWithValue("@loc", DBNull.Value);
            }
            else
            {
                command1.Parameters.AddWithValue("@loc", textBoxLocalidad.Text);
            }
            command1.Parameters.AddWithValue("@doc", comboBoxTipoDocumento.SelectedValue.ToString());
            command1.Parameters.AddWithValue("@numDoc", textBoxNumeroDocumento.Text);
            command1.Parameters.AddWithValue("@hab", checkBoxHabilitado.Checked);
            UtilesSQL.ejecutarComandoNonQuery(command1);

            SqlCommand command2 = UtilesSQL.crearCommand("INSERT INTO DERROCHADORES_DE_PAPEL.RolXUsuarioXHotel SELECT @rol, u.usur_id, @hotel, u.usur_habilitado FROM DERROCHADORES_DE_PAPEL.Usuario AS u WHERE u.usur_username = @username");

            command2.Parameters.AddWithValue("@username", textBoxUsuario.Text);
            command2.Parameters.AddWithValue("@rol", comboBoxRoles.SelectedValue.ToString());
            command2.Parameters.AddWithValue("@hotel", textBoxHotel.Text);
            UtilesSQL.ejecutarComandoNonQuery(command2);

            MessageBox.Show("Creación exitosa!");
            this.Close();
        }
Esempio n. 10
0
        private void finalizarFactura()
        {
            SqlCommand com = UtilesSQL.crearCommand("UPDATE DERROCHADORES_DE_PAPEL.Factura SET fact_costoTotal = @costo, fact_modoDePago = @modo WHERE fact_estadia = @est");

            com.Parameters.AddWithValue("@costo", costoTotal.ToString());
            com.Parameters.AddWithValue("@modo", comboBoxFormaDePago.SelectedIndex + 1);
            com.Parameters.AddWithValue("@est", dtF.Rows[0][2].ToString());
            UtilesSQL.ejecutarComandoNonQuery(com);
        }
Esempio n. 11
0
        private void guardar_Click(object sender, EventArgs e)
        {
            //Validar que se hayan elegido consumibles
            if (consumibles_elegidos_dt.Rows.Count == 0)
            {
                MessageBox.Show("Debe elegir al menos un consumible");
                return;
            }

            var confirmResult = MessageBox.Show("¿Está seguro que desea registrar estos consumibles?", "¿Registrar consumibles?", MessageBoxButtons.YesNo);

            if (confirmResult == DialogResult.No)
            {
                return;
            }

            //Validar que no se hayan registrado consumibles para la habitación elegida
            SqlCommand com = UtilesSQL.crearCommand("SELECT item_id FROM DERROCHADORES_DE_PAPEL.ItemDeFactura WHERE item_factura = @factura AND item_habitacionNumero = @hab AND item_habitacionPiso = @piso AND item_consumible IS NOT NULL");

            com.Parameters.AddWithValue("@factura", factura);
            com.Parameters.AddWithValue("@hab", habitacion.Text);
            com.Parameters.AddWithValue("@piso", piso.Text);
            object itemPrevio = com.ExecuteScalar();

            if (itemPrevio != null)
            {
                MessageBox.Show("Ya se agregaron items previamente para la habitación elegida");
                return;
            }

            //Agregar cada item correspondiente a los consumibles adquiridos
            float costoTotal = 0;

            foreach (DataRow consumible in consumibles_elegidos_dt.Rows)
            {
                String costo = consumible[2].ToString();
                costo.Replace(',', '.'); //Se reemplaza la coma por un punto para su correcta conversión
                String cantidad = consumible[3].ToString();

                float costoConsumible = float.Parse(costo) * float.Parse(cantidad);
                costoTotal += costoConsumible;

                SqlCommand com2 = UtilesSQL.crearCommand("INSERT INTO DERROCHADORES_DE_PAPEL.ItemDeFactura (item_cantidad, item_monto, item_factura, item_descripcion, item_consumible, item_habitacionNumero, item_habitacionPiso) VALUES (@cant, CONVERT(NUMERIC(18,2),@monto), @fact, LTRIM(STR(@cant))+\'x \'+@desc, @cons, @hab, @piso)");
                com2.Parameters.AddWithValue("@cant", consumible[3].ToString());
                com2.Parameters.AddWithValue("@monto", costoConsumible.ToString());
                com2.Parameters.AddWithValue("@fact", factura);
                com2.Parameters.AddWithValue("@desc", consumible[1].ToString());
                com2.Parameters.AddWithValue("@cons", consumible[0].ToString());
                com2.Parameters.AddWithValue("@hab", habitacion.Text);
                com2.Parameters.AddWithValue("@piso", piso.Text);
                UtilesSQL.ejecutarComandoNonQuery(com2);
            }

            MessageBox.Show("Consumibles registrados!");
            this.Close();
        }
Esempio n. 12
0
        private void darDeBaja_Click(object sender, EventArgs e)
        {
            var confirmResult = MessageBox.Show("Esta seguro que quiere dar de baja el cliente?", "Esta seguro?", MessageBoxButtons.YesNo);

            if (confirmResult == DialogResult.Yes)
            {
                command = UtilesSQL.crearCommand("UPDATE DERROCHADORES_DE_PAPEL.Cliente set clie_habilitado = 0 WHERE clie_mail = '" + dataGridViewClientes.CurrentRow.Cells[2].Value.ToString() + "'");
                command.ExecuteNonQuery();
                MessageBox.Show("El usuario ha sido dado de baja");
                limpiarTodo();
            }
        }
Esempio n. 13
0
 private void inicializarComboBox()
 {
     com = UtilesSQL.crearCommand("select f.func_detalle, u.rouh_hotel from DERROCHADORES_DE_PAPEL.FuncionalidadXRol as fxr  join DERROCHADORES_DE_PAPEL.Funcionalidad as f on f.func_id = fxro_funcionalidad  join DERROCHADORES_DE_PAPEL.Rol as r ON r.rol_id = fxr.fxro_rol  left join DERROCHADORES_DE_PAPEL.RolXUsuarioXHotel as u ON u.rouh_rol = r.rol_id  where u.rouh_usuario = @id AND u.rouh_hotel = @hote AND r.rol_nombre LIKE @rol group by f.func_detalle, u.rouh_hotel");
     com.Parameters.AddWithValue("@id", idUser);
     com.Parameters.AddWithValue("@hote", hotelId);
     com.Parameters.AddWithValue("@rol", "%" + rolElegido);
     da.SelectCommand = com;
     da.Fill(ds);
     comboBoxFuncionalidad.DisplayMember = "func_detalle";
     comboBoxFuncionalidad.ValueMember   = "func_detalle";
     comboBoxFuncionalidad.DataSource    = ds.Tables[0];
 }
Esempio n. 14
0
        private void realizarCambios()
        {
            //Modifica el hotel
            SqlCommand com = UtilesSQL.crearCommand("UPDATE DERROCHADORES_DE_PAPEL.Hotel SET hote_nombre=@nom, hote_mail=@mail, hote_telefono=@tel, hote_calle=@calle, hote_numeroDeCalle=@numCalle, hote_localidad=@loc, hote_estrellas=@estr, hote_ciudad=@ciudad, hote_pais=@pais, hote_fechaDeCreacion=CONVERT(datetime, @fecha, 121) WHERE hote_id = @id");

            com.Parameters.AddWithValue("@nom", textBoxNombre.Text);
            com.Parameters.AddWithValue("@mail", textBoxMail.Text);
            com.Parameters.AddWithValue("@tel", textBoxTelefono.Text);
            com.Parameters.AddWithValue("@calle", textBoxDireccion.Text);
            com.Parameters.AddWithValue("@numCalle", textBoxNumeroCalle.Text);
            com.Parameters.AddWithValue("@loc", textBoxLocalidad.Text);
            com.Parameters.AddWithValue("@estr", comboBoxEstrellas.SelectedIndex);
            com.Parameters.AddWithValue("@ciudad", textBoxCiudad.Text);
            com.Parameters.AddWithValue("@pais", textBoxPais.Text);
            com.Parameters.AddWithValue("@fecha", textBoxFecha.Text);
            com.Parameters.AddWithValue("@id", Int32.Parse(dtH.Rows[0][0].ToString()));
            UtilesSQL.ejecutarComandoNonQuery(com);

            //Modifica los regimenes
            int        i = 1;
            SqlCommand com1;

            foreach (DataGridViewRow row in dataGridViewRegimenes.Rows)
            {
                if (row.Cells[0].Value.ToString() == false.ToString()) //Checkea si el regimen esta seleccionado
                {
                    if (!hotelTieneRegimen(i))                         //Checkea que no haya huespedes o reservas en ese regimen
                    {
                        com = UtilesSQL.crearCommand("DELETE FROM DERROCHADORES_DE_PAPEL.RegimenXHotel WHERE rexh_regimen = @reg AND rexh_hotel = @hotel");
                        com.Parameters.AddWithValue("@reg", i);
                        com.Parameters.AddWithValue("@hotel", Int32.Parse(dtH.Rows[0][0].ToString()));
                        UtilesSQL.ejecutarComandoNonQuery(com);
                    }
                    else
                    {   //Si hay huespedes o reservas no se modifica ese regimen
                        MessageBox.Show("No es posible desactivar el regimen: " + dtRegimen.Rows[i][1].ToString() + " ya que este hotel tiene reservas o huespedes bajo el mismo");
                    }
                }
                else
                {
                    if (!regimenIncorporado(i)) //Se fija si el regimen no esta en efecto
                    {
                        com1 = UtilesSQL.crearCommand("INSERT INTO DERROCHADORES_DE_PAPEL.RegimenXHotel VALUES (@reg, @hotel)");
                        com1.Parameters.AddWithValue("@reg", i);
                        com1.Parameters.AddWithValue("@hotel", Int32.Parse(dtH.Rows[0][0].ToString()));
                        UtilesSQL.ejecutarComandoNonQuery(com1);
                    }
                }
                i++;
            }

            MessageBox.Show("Modificación exitosa!");
        }
Esempio n. 15
0
        private void cargarRoles()
        {
            command = UtilesSQL.crearCommand("select rol_nombre from DERROCHADORES_DE_PAPEL.Rol");
            SqlDataReader reader = command.ExecuteReader();

            dtRoles.Columns.Add("rol_nombre", typeof(string));
            dtRoles.Rows.Add("");
            dtRoles.Load(reader);

            comboBoxRol.ValueMember = "rol_nombre";
            comboBoxRol.DataSource  = dtRoles;
        }
Esempio n. 16
0
 private void realizarCambios()
 {
     command = UtilesSQL.crearCommand("UPDATE DERROCHADORES_DE_PAPEL.Cliente SET clie_nombre = @nom, clie_apellido = @ape, clie_mail = @mail, clie_telefono = @tel, clie_tipoDeDocumento = @doc, clie_numeroDeDocumento = @numeroDoc, clie_calle = @calle, clie_numeroDeCalle = @numCalle, clie_piso = @piso, clie_departamento = @depto, clie_localidad = @loc, clie_nacionalidad = @nac, clie_fechaDeNacimiento = CONVERT(datetime, @fecha, 121), clie_habilitado = @habilitado WHERE clie_id = @id");
     command.Parameters.AddWithValue("@nom", textBoxNombre.Text);
     command.Parameters.AddWithValue("@ape", textBoxApellido.Text);
     command.Parameters.AddWithValue("@mail", textBoxMail.Text);
     if (teleNull)
     {
         command.Parameters.AddWithValue("@tel", DBNull.Value);
     }
     else
     {
         command.Parameters.AddWithValue("@tel", textBoxTelefono.Text);
     }
     command.Parameters.AddWithValue("@doc", comboBoxTipoDocumento.SelectedValue.ToString());
     command.Parameters.AddWithValue("@numeroDoc", textBoxNumeroDocumento.Text);
     command.Parameters.AddWithValue("@calle", textBoxDireccion.Text);
     command.Parameters.AddWithValue("@numCalle", textBoxNumeroCalle.Text);
     if (pisoNull)
     {
         command.Parameters.AddWithValue("@piso", DBNull.Value);
     }
     else
     {
         command.Parameters.AddWithValue("@piso", textBoxPiso.Text);
     }
     if (deptoNull)
     {
         command.Parameters.AddWithValue("@depto", DBNull.Value);
     }
     else
     {
         command.Parameters.AddWithValue("@depto", textBoxDepto.Text);
     }
     if (locNull)
     {
         command.Parameters.AddWithValue("@loc", DBNull.Value);
     }
     else
     {
         command.Parameters.AddWithValue("@loc", textBoxLocalidad.Text);
     }
     command.Parameters.AddWithValue("@nac", comboBoxNacionalidad.SelectedValue.ToString());
     command.Parameters.AddWithValue("@fecha", textBoxFecha.Text);
     command.Parameters.AddWithValue("@habilitado", checkBoxHabilitado.Checked);
     command.Parameters.AddWithValue("@id", id);
     command.ExecuteNonQuery();
     MessageBox.Show("Cambios exitosos!");
     f1.Show();
     this.Close();
 }
Esempio n. 17
0
        private String costoDeEstadia()
        {
            SqlCommand com = UtilesSQL.crearCommand("(SELECT regi_precioBase * SUM(tipo_cantidadDePersonas) * rese_cantidadDeNoches "
                                                    + "FROM DERROCHADORES_DE_PAPEL.Reserva JOIN "
                                                    + "DERROCHADORES_DE_PAPEL.ReservaXHabitacion ON rese_codigo = rexh_reserva JOIN "
                                                    + "DERROCHADORES_DE_PAPEL.Habitacion ON habi_hotel = rexh_hotel AND habi_numero = rexh_numero AND habi_piso = rexh_piso JOIN "
                                                    + "DERROCHADORES_DE_PAPEL.TipoDeHabitacion ON habi_tipo = tipo_codigo JOIN "
                                                    + "DERROCHADORES_DE_PAPEL.Regimen ON regi_codigo = rese_regimen "
                                                    + "WHERE rese_codigo = " + reserva.Text + " AND habi_hotel = " + Login.SeleccionFuncionalidad.getHotelId() + " "
                                                    + "GROUP BY regi_precioBase, rese_cantidadDeNoches)");

            return(com.ExecuteScalar().ToString());
            //"(SELECT regi_precioBase * SUM(tipo_cantidadDePersonas) * rese_cantidadDeNoches FROM DERROCHADORES_DE_PAPEL.Reserva JOIN DERROCHADORES_DE_PAPEL.ReservaXHabitacion ON rese_codigo = rexh_reserva JOIN DERROCHADORES_DE_PAPEL.Habitacion ON habi_hotel = rexh_hotel AND habi_numero = rexh_numero AND habi_piso = rexh_piso JOIN DERROCHADORES_DE_PAPEL.TipoDeHabitacion ON habi_tipo = tipo_codigo JOIN DERROCHADORES_DE_PAPEL.Regimen ON regi_codigo = rese_regimen WHERE rese_codigo = "+reserva.Text+" AND habi_hotel = "+Login.SeleccionFuncionalidad.getHotelId()+" GROUP BY regi_precioBase, rese_cantidadDeNoches)"
        }
Esempio n. 18
0
        private void cargarTipoDocumento()
        {
            command = UtilesSQL.crearCommand("select docu_detalle from DERROCHADORES_DE_PAPEL.Documento");
            SqlDataReader reader;

            reader = command.ExecuteReader();
            dt     = new DataTable();
            dt.Columns.Add("docu_detalle", typeof(string));
            dt.Rows.Add("");
            dt.Load(reader);

            comboBoxTipoDocumento.ValueMember = "docu_detalle";
            comboBoxTipoDocumento.DataSource  = dt;
        }
Esempio n. 19
0
 private void realizarCambios()
 {
     command = UtilesSQL.crearCommand("INSERT INTO DERROCHADORES_DE_PAPEL.Cliente (clie_nombre, clie_apellido, clie_mail, clie_telefono, clie_fechaDeNacimiento, clie_calle, clie_numeroDeCalle, clie_piso, clie_departamento, clie_localidad, clie_tipoDeDocumento, clie_numeroDeDocumento, clie_habilitado, clie_nacionalidad) VALUES (@nom, @ape, @mail, @tel, CONVERT(datetime, @fecha, 121), @calle, @numCalle, @piso, @depto, @loc, @doc, @numeroDoc, @habilitado, @nac)");
     command.Parameters.AddWithValue("@nom", textBoxNombre.Text);
     command.Parameters.AddWithValue("@ape", textBoxApellido.Text);
     command.Parameters.AddWithValue("@mail", textBoxMail.Text);
     if (teleNull)
     {
         command.Parameters.AddWithValue("@tel", DBNull.Value);
     }
     else
     {
         command.Parameters.AddWithValue("@tel", textBoxTelefono.Text);
     }
     command.Parameters.AddWithValue("@doc", comboBoxTipoDocumento.SelectedValue.ToString());
     command.Parameters.AddWithValue("@numeroDoc", textBoxNumeroDocumento.Text);
     command.Parameters.AddWithValue("@calle", textBoxDireccion.Text);
     command.Parameters.AddWithValue("@numCalle", textBoxNumeroCalle.Text);
     if (pisoNull)
     {
         command.Parameters.AddWithValue("@piso", DBNull.Value);
     }
     else
     {
         command.Parameters.AddWithValue("@piso", textBoxPiso.Text);
     }
     if (deptoNull)
     {
         command.Parameters.AddWithValue("@depto", DBNull.Value);
     }
     else
     {
         command.Parameters.AddWithValue("@depto", textBoxDepto.Text);
     }
     if (locNull)
     {
         command.Parameters.AddWithValue("@loc", DBNull.Value);
     }
     else
     {
         command.Parameters.AddWithValue("@loc", textBoxLocalidad.Text);
     }
     command.Parameters.AddWithValue("@nac", comboBoxNacionalidad.SelectedValue.ToString());
     command.Parameters.AddWithValue("@fecha", textBoxFecha.Text);
     command.Parameters.AddWithValue("@habilitado", checkBoxHabilitado.Checked);
     UtilesSQL.ejecutarComandoNonQuery(command);
     MessageBox.Show("Creación exitosa!");
     this.Close();
 }
Esempio n. 20
0
        private void realizarCambios()
        {
            SqlCommand com = UtilesSQL.crearCommand("INSERT INTO DERROCHADORES_DE_PAPEL.Habitacion VALUES (@hote, @num, @piso, @frente, @desc, @tipo, @hab)");

            com.Parameters.AddWithValue("@hote", idH);
            com.Parameters.AddWithValue("@num", textBoxNumero.Text);
            com.Parameters.AddWithValue("@piso", textBoxPiso.Text);
            com.Parameters.AddWithValue("@frente", comboBoxUbicacion.SelectedIndex);
            com.Parameters.AddWithValue("@desc", richTextBoxDesc.Text);
            com.Parameters.AddWithValue("@tipo", comboBoxTipoHabitacion.SelectedValue.ToString());
            com.Parameters.AddWithValue("@hab", checkBoxHabilitada.Checked);
            UtilesSQL.ejecutarComandoNonQuery(com);

            MessageBox.Show("Creación exitosa!");
        }
Esempio n. 21
0
 private void LoginIncorrecto()
 {
     loginsIncorrectos++;         //incrementa los logins incorrectos (max 3)
     if (loginsIncorrectos != 3)
     {
         MessageBox.Show("Contraseña incorrecta. Intentos restantes: " + (3 - loginsIncorrectos).ToString());
     }
     else
     {
         command = UtilesSQL.crearCommand("UPDATE DERROCHADORES_DE_PAPEL.Usuario SET usur_habilitado = '0' WHERE usur_username = @user");
         command.Parameters.AddWithValue("@user", usuarioTextBox.Text);
         command.ExecuteNonQuery();
         MessageBox.Show("Contraseña incorrecta. La cuenta ha sido bloqueada");
     }
     dt.Clear();
 }
Esempio n. 22
0
        private void realizarCambios()
        {
            SqlCommand com = UtilesSQL.crearCommand("UPDATE DERROCHADORES_DE_PAPEL.Habitacion SET habi_estado = @hab, habi_numero = @num, habi_piso = @piso, habi_frente = @ubicacion, habi_descripcion = @desc WHERE habi_hotel = @hote AND habi_numero = @numO AND habi_piso = @pisoO");

            com.Parameters.AddWithValue("@hote", dtH.Rows[0][0]);
            com.Parameters.AddWithValue("@num", textBoxNumero.Text);
            com.Parameters.AddWithValue("@numO", dtH.Rows[0][1]);
            com.Parameters.AddWithValue("@piso", textBoxPiso.Text);
            com.Parameters.AddWithValue("@pisoO", dtH.Rows[0][2]);
            com.Parameters.AddWithValue("@ubicacion", comboBoxUbicacion.SelectedIndex);
            com.Parameters.AddWithValue("@desc", richTextBoxDesc.Text);
            com.Parameters.AddWithValue("@hab", checkBoxHabilitada.Checked);
            UtilesSQL.ejecutarComandoNonQuery(com);

            MessageBox.Show("Modificación exitosa!");
        }
Esempio n. 23
0
        private void iniciarComboBox()
        {
            comboBoxTipoHabitacion.Items.Add("");
            SqlCommand    command = UtilesSQL.crearCommand("SELECT tipo_descripcion, tipo_codigo FROM DERROCHADORES_DE_PAPEL.TipoDeHabitacion");
            SqlDataReader reader  = command.ExecuteReader();

            dtT.Columns.Add("docu_detalle", typeof(string));
            dtT.Load(reader);

            comboBoxTipoHabitacion.ValueMember   = "tipo_codigo";
            comboBoxTipoHabitacion.DisplayMember = "tipo_descripcion";
            comboBoxTipoHabitacion.DataSource    = dtT;
            comboBoxTipoHabitacion.SelectedIndex = 0;

            comboBoxUbicacion.Items.Add("Vista interna");
            comboBoxUbicacion.Items.Add("Vista al exterior");
            comboBoxUbicacion.SelectedIndex = 0;
        }
Esempio n. 24
0
        private void cargarCosas()
        {
            SqlCommand    command = UtilesSQL.crearCommand("SELECT modo_descripcion FROM DERROCHADORES_DE_PAPEL.ModoDePago");
            SqlDataReader reader  = command.ExecuteReader();

            dtModos.Columns.Add("modo_descripcion", typeof(string));
            dtModos.Load(reader);

            comboBoxFormaDePago.ValueMember   = "modo_descripcion";
            comboBoxFormaDePago.DataSource    = dtModos;
            comboBoxFormaDePago.SelectedIndex = 0;

            SqlDataAdapter sda = UtilesSQL.crearDataAdapter("SELECT item_descripcion, item_cantidad, item_monto, item_habitacionNumero, item_habitacionPiso FROM DERROCHADORES_DE_PAPEL.ItemDeFactura WHERE item_factura = @fact");

            sda.SelectCommand.Parameters.AddWithValue("@fact", factId);
            sda.Fill(dtC);
            dataGridViewConsumibles.DataSource = dtC;

            sda = UtilesSQL.crearDataAdapter("SELECT fact_fecha, fact_costoTotal, fact_estadia, fact_cliente, clie_apellido, clie_nombre FROM DERROCHADORES_DE_PAPEL.Factura JOIN DERROCHADORES_DE_PAPEL.Cliente ON clie_id = fact_cliente WHERE fact_numero = @fact");
            sda.SelectCommand.Parameters.AddWithValue("@fact", factId);
            sda.Fill(dtF);

            textBoxFecha.Text      = dtF.Rows[0][0].ToString();
            textBoxCostoTotal.Text = dtF.Rows[0][1].ToString() + "U$S";
            textBoxEstadia.Text    = dtF.Rows[0][2].ToString();
            textBoxCliente.Text    = dtF.Rows[0][4].ToString() + ", " + dtF.Rows[0][5].ToString();

            //calculo de costo total de consumibles
            foreach (DataRow row in dtC.Rows)
            {
                if (row[0].ToString().Equals("1x Descuento por régimen All Inclusive"))
                {
                    costoTotal -= float.Parse(row[2].ToString());
                }
                else
                {
                    costoTotal += float.Parse(row[2].ToString());
                }
            }
            textBoxCostoTotal.Text = costoTotal.ToString() + "U$S";
        }
Esempio n. 25
0
        private void btn_reservar_Click(object sender, EventArgs e)
        {
            //ELIMINAR las reserva x habitacion que ya estan
            command = UtilesSQL.crearCommand("DELETE FROM DERROCHADORES_DE_PAPEL.ReservaXHabitacion WHERE rexh_reserva = @reserva");
            command.Parameters.AddWithValue("@reserva", reserva.codigo);
            UtilesSQL.ejecutarComandoNonQuery(command);

            //UPDATE la reserva que ya esta
            command = UtilesSQL.crearCommand("UPDATE DERROCHADORES_DE_PAPEL.Reserva SET rese_cantidadDeNoches = @noches , rese_estado = @estado , rese_inicio = CONVERT(DATETIME, @incio, 121), rese_fin = CONVERT(DATETIME, @fin, 121), rese_regimen =  @regimen, rese_cantidadDePersonas = @personas WHERE rese_codigo = @reserva");
            command.Parameters.AddWithValue("@noches", reserva.cantidad_de_noches);
            command.Parameters.AddWithValue("@estado", CargarEstadosDeReserva("RESERVA MODIFICADA"));
            command.Parameters.AddWithValue("@incio", reserva.fecha_desde.ToString("yyyy-MM-dd"));
            command.Parameters.AddWithValue("@fin", reserva.fecha_hasta.ToString("yyyy-MM-dd"));
            command.Parameters.AddWithValue("@hotel", reserva.hotel.ID);
            command.Parameters.AddWithValue("@regimen", reserva.regimen_seleccionado);
            command.Parameters.AddWithValue("@personas", reserva.personas);
            command.Parameters.AddWithValue("@reserva", reserva.codigo);
            UtilesSQL.ejecutarComandoNonQuery(command);

            //PONER LAS NUEVAS RESERVAS X HABITACION
            for (int indice = 0; indice < reserva.habitaciones_reservadas.Count; indice++)
            {
                command = UtilesSQL.crearCommand("INSERT INTO DERROCHADORES_DE_PAPEL.ReservaXHabitacion (rexh_reserva, rexh_hotel, rexh_numero, rexh_piso) VALUES (@reserva, @hotel, @numero, @piso)");
                command.Parameters.AddWithValue("@reserva", reserva.codigo);
                command.Parameters.AddWithValue("@hotel", reserva.hotel.ID);
                command.Parameters.AddWithValue("@piso", reserva.habitaciones_reservadas[indice].piso);
                command.Parameters.AddWithValue("@numero", reserva.habitaciones_reservadas[indice].numero);
                UtilesSQL.ejecutarComandoNonQuery(command);
            }

            //Insertar una nueva modificacion
            command = UtilesSQL.crearCommand("INSERT INTO DERROCHADORES_DE_PAPEL.ModificacionReserva (modi_reserva, modi_fechaDeModificacion, modi_usuario) VALUES (@reserva ,CONVERT(DATETIME, @fecha, 121) ,@usuario)");
            command.Parameters.AddWithValue("@reserva", reserva.codigo);
            command.Parameters.AddWithValue("@fecha", Convert.ToDateTime(Main.fecha()).ToString("yyyy-MM-dd HH:mm:ss.fff"));
            command.Parameters.AddWithValue("@usuario", usuario);
            UtilesSQL.ejecutarComandoNonQuery(command);

            MessageBox.Show("Se modifico la reserva correctamente");
            this.Close();
        }
Esempio n. 26
0
        private void finalizarFacturaTarjeta()
        {
            SqlCommand com = UtilesSQL.crearCommand("INSERT INTO DERROCHADORES_DE_PAPEL.TarjetaBancaria VALUES (@nombre, @numero)");

            com.Parameters.AddWithValue("@nombre", propietario.Text);
            com.Parameters.AddWithValue("@numero", tarjeta.Text);
            UtilesSQL.ejecutarComandoNonQuery(com);

            SqlCommand com2 = UtilesSQL.crearCommand("SELECT tarj_id FROM DERROCHADORES_DE_PAPEL.TarjetaBancaria WHERE @nombre = tarj_nombreDeEntidad AND @numero = tarj_numeroDeCuenta");

            com2.Parameters.AddWithValue("@nombre", propietario.Text);
            com2.Parameters.AddWithValue("@numero", tarjeta.Text);
            String tarjetaId = com2.ExecuteScalar().ToString();

            SqlCommand com3 = UtilesSQL.crearCommand("UPDATE DERROCHADORES_DE_PAPEL.Factura SET fact_costoTotal = @costo, fact_modoDePago = @modo, fact_tarjeta = @tarj WHERE fact_estadia = @est");

            com3.Parameters.AddWithValue("@costo", costoTotal.ToString());
            com3.Parameters.AddWithValue("@modo", comboBoxFormaDePago.SelectedIndex + 1);
            com3.Parameters.AddWithValue("@tarj", tarjetaId);
            com3.Parameters.AddWithValue("@est", dtF.Rows[0][2].ToString());
            UtilesSQL.ejecutarComandoNonQuery(com3);
        }
Esempio n. 27
0
        private void buttonAgregarRol_Click(object sender, EventArgs e)
        {
            SqlCommand    command2 = UtilesSQL.crearCommand("SELECT rol_nombre FROM DERROCHADORES_DE_PAPEL.Rol WHERE rol_nombre NOT IN (SELECT rol_nombre  from DERROCHADORES_DE_PAPEL.Rol WHERE rol_nombre = 'ADMINISTRADOR GENERAL' OR rol_nombre = 'GUEST')");
            SqlDataReader reader2  = command2.ExecuteReader();
            DataTable     dtRol    = new DataTable();

            dtRol.Columns.Add("rol_nombre", typeof(string));
            DataColumn[] keyColumns = new DataColumn[1];
            keyColumns[0]    = dtRol.Columns["rol_nombre"];
            dtRol.PrimaryKey = keyColumns;
            dtRol.Load(reader2);

            foreach (DataRow row in dtRoles.Rows)
            {
                for (int i = 0; i < dtRol.Rows.Count; i++)
                {
                    if (dtRol.Rows[i][0].ToString() == row[0].ToString())
                    {
                        dtRol.Rows.RemoveAt(i);
                    }
                }
            }

            if (dtRol.Rows.Count == 0)
            {
                MessageBox.Show("No hay mas roles para agregar");
                return;
            }
            else
            {
                SeleccionarRol f1 = new SeleccionarRol(dtRol);
                f1.ShowDialog();
                rol = f1.rol;
                if (f1.rol != null)
                {
                    dtRoles.Rows.Add(rol);
                }
            }
        }
Esempio n. 28
0
        private void buttonAceptar_Click(object sender, EventArgs e)
        {
            resetearLabels();
            if (validarFechas())
            {
                SqlCommand com = UtilesSQL.crearCommand("DERROCHADORES_DE_PAPEL.CrearBajaHotel");
                com.CommandType = CommandType.StoredProcedure;
                com.Parameters.AddWithValue("@hotel", SqlDbType.BigInt).Value    = idH;
                com.Parameters.AddWithValue("@fechaF", SqlDbType.VarChar).Value  = textBoxFecha.Text;
                com.Parameters.AddWithValue("@fechaI", SqlDbType.VarChar).Value  = textBoxFecha2.Text;
                com.Parameters.AddWithValue("@motivo", SqlDbType.NVarChar).Value = richTextBoxMotivo.Text;
                int resultado = (int)com.ExecuteScalar();

                if (resultado == 1)
                {
                    MessageBox.Show("Baja exitosa!");
                    this.Close();
                }
                else
                {
                    MessageBox.Show("Este hotel tiene reservas o huespedes o un periodo de cierre en esas fechas, por lo que no se pudo realizar la baja");
                }
            }
        }
Esempio n. 29
0
        private void cargarComboBox()
        {
            SqlCommand    command = UtilesSQL.crearCommand("select docu_detalle, docu_tipo from DERROCHADORES_DE_PAPEL.Documento");
            SqlDataReader reader  = command.ExecuteReader();

            dtDocu.Columns.Add("docu_detalle", typeof(string));
            dtDocu.Columns.Add("docu_tipo", typeof(string));
            dtDocu.Load(reader);

            comboBoxTipoDocumento.ValueMember   = "docu_tipo";
            comboBoxTipoDocumento.DisplayMember = "docu_detalle";
            comboBoxTipoDocumento.DataSource    = dtDocu;

            SqlCommand    command2 = UtilesSQL.crearCommand("SELECT rol_nombre, rol_id FROM DERROCHADORES_DE_PAPEL.Rol WHERE rol_nombre NOT IN (SELECT rol_nombre  from DERROCHADORES_DE_PAPEL.Rol WHERE rol_nombre = 'ADMINISTRADOR GENERAL' OR rol_nombre = 'GUEST')");
            SqlDataReader reader2  = command2.ExecuteReader();

            dtRol.Columns.Add("rol_nombre", typeof(string));
            dtRol.Columns.Add("rol_id", typeof(string));
            dtRol.Load(reader2);

            comboBoxRoles.ValueMember   = "rol_id";
            comboBoxRoles.DisplayMember = "rol_nombre";
            comboBoxRoles.DataSource    = dtRol;
        }
Esempio n. 30
0
        private void cargarCosas()
        {
            SqlCommand    command = UtilesSQL.crearCommand("select docu_detalle, docu_tipo from DERROCHADORES_DE_PAPEL.Documento");
            SqlDataReader reader  = command.ExecuteReader();

            dtDoc.Columns.Add("docu_detalle", typeof(string));
            dtDoc.Columns.Add("docu_tipo", typeof(string));
            dtDoc.Load(reader);

            comboBoxTipoDocumento.ValueMember   = "docu_tipo";
            comboBoxTipoDocumento.DisplayMember = "docu_detalle";
            comboBoxTipoDocumento.DataSource    = dtDoc;

            SqlCommand command2 = UtilesSQL.crearCommand("SELECT rol_nombre FROM DERROCHADORES_DE_PAPEL.Rol AS r JOIN DERROCHADORES_DE_PAPEL.RolXUsuarioXHotel AS ru ON r.rol_id = ru.rouh_rol JOIN DERROCHADORES_DE_PAPEL.Usuario AS u ON ru.rouh_usuario = u.usur_id WHERE ru.rouh_habilitado = 1 AND rol_nombre NOT IN (SELECT rol_nombre from DERROCHADORES_DE_PAPEL.Rol WHERE rol_nombre = 'ADMINISTRADOR GENERAL' OR rol_nombre = 'GUEST') AND u.usur_id = @user AND ru.rouh_hotel = @hote");

            command2.Parameters.AddWithValue("@user", dtUsuario.Rows[0][0].ToString());
            command2.Parameters.AddWithValue("@hote", hotelU);
            SqlDataReader reader2 = command2.ExecuteReader();

            dtRoles.Columns.Add("rol_nombre", typeof(string));
            dtRoles.Load(reader2);

            dataGridViewRoles.DataSource = dtRoles;
        }